Skip to content

Commit

Permalink
Merge pull request #697 from chrischdi/pr-fix-XMapTypeFlatten
Browse files Browse the repository at this point in the history
馃悰 Fix crd flattening for structType marker to not create duplicate entries for XMapType
  • Loading branch information
k8s-ci-robot committed Jun 29, 2022
2 parents 6bfa604 + 1bb8449 commit 1878064
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pkg/crd/flatten.go
Expand Up @@ -145,6 +145,8 @@ func flattenAllOfInto(dst *apiext.JSONSchemaProps, src apiext.JSONSchemaProps, e
flattenAllOfInto(dstProps.Schema, *srcProps.Schema, errRec)
case "XPreserveUnknownFields":
dstField.Set(srcField)
case "XMapType":
dstField.Set(srcField)
// NB(directxman12): no need to explicitly handle nullable -- false is considered to be the zero value
// TODO(directxman12): src isn't necessarily the field value -- it's just the most recent allOf entry
default:
Expand Down
4 changes: 1 addition & 3 deletions pkg/crd/testdata/testdata.kubebuilder.io_cronjobs.yaml
Expand Up @@ -7278,9 +7278,6 @@ spec:
description: Checks that multiply-nested maps work
type: object
nestedStructWithSeveralFields:
allOf:
- x-kubernetes-map-type: atomic
- x-kubernetes-map-type: atomic
description: A struct that can only be entirely replaced via a nested
type.
properties:
Expand All @@ -7292,6 +7289,7 @@ spec:
- bar
- foo
type: object
x-kubernetes-map-type: atomic
nestedassociativeList:
description: This tests that associative lists work via a nested type.
items:
Expand Down

0 comments on commit 1878064

Please sign in to comment.