Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Fix crd flattening for structType marker to not create duplicate entries for XMapType #698

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/crd/flatten.go
Expand Up @@ -143,6 +143,8 @@ func flattenAllOfInto(dst *apiext.JSONSchemaProps, src apiext.JSONSchemaProps, e
dstProps.Schema = &apiext.JSONSchemaProps{}
}
flattenAllOfInto(dstProps.Schema, *srcProps.Schema, errRec)
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 @@ -7277,9 +7277,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 @@ -7291,6 +7288,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