Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
Signed-off-by: everettraven <[email protected]>
  • Loading branch information
everettraven committed Apr 10, 2024
1 parent 03636fb commit 976dcc9
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions pkg/kapp/crdupgradesafety/change_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ func EnumChangeValidation(diff FieldDiff) (bool, error) {
// ChangeValidator is a Validation implementation focused on
// handling updates to existing fields in a CRD
type ChangeValidator struct {
// Validations is a slice of ChangeValidations
// to run against each changed field
// Validations is a slice of ChangeValidations
// to run against each changed field
Validations []ChangeValidation
}

Expand Down Expand Up @@ -146,23 +146,27 @@ type FlatSchema map[string]*v1.JSONSchemaProps
// FlattenSchema takes in a CRD version OpenAPIV3Schema and returns
// a flattened representation of it. For example, a CRD with a schema of:
// ```yaml
// ...
// spec:
// type: object
// properties:
// foo:
// type: string
// bar:
// type: string
// ...
//
// ...
// spec:
// type: object
// properties:
// foo:
// type: string
// bar:
// type: string
// ...
//
// ```
// would be represented as:
// map[string]*v1.JSONSchemaProps{
// "^": {},
// "^.spec": {},
// "^.spec.foo": {},
// "^.spec.bar": {},
// }
//
// map[string]*v1.JSONSchemaProps{
// "^": {},
// "^.spec": {},
// "^.spec.foo": {},
// "^.spec.bar": {},
// }
//
// where "^" represents the "root" schema
func FlattenSchema(schema *v1.JSONSchemaProps) FlatSchema {
fieldMap := map[string]*v1.JSONSchemaProps{}
Expand Down

0 comments on commit 976dcc9

Please sign in to comment.