apiextensions: prune {any,one}Of + Not recursively on OpenAPI v2 conversion#71137
Conversation
|
@sttts: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sttts The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/assign @roycaihw |
|
/retest |
c41f44c to
017d2bd
Compare
017d2bd to
0d9a022
Compare
roycaihw
left a comment
There was a problem hiding this comment.
/lgtm
The new unit test capturing the bug has passed.
| for k, v := range in.Enum { | ||
| out.Enum[k] = v | ||
| if in.Enum != nil { | ||
| out.Enum = make([]interface{}, len(in.Enum)) |
There was a problem hiding this comment.
Nice catch. This makes input and output more consistent.
There was a problem hiding this comment.
And makes tests green :-)
| } | ||
|
|
||
| // ConvertJSONSchemaProps converts the schema from apiextensions.JSONSchemaPropos to go-openapi/spec.Schema | ||
| // ConvertJSONSchemaProps converts the schema from apiextensions.JSONSchemaPropos to go-openapi/spec.Schema. |
There was a problem hiding this comment.
These functions probably fit better in a util/helper package
| type PostProcessFunc func(*spec.Schema) error | ||
|
|
||
| // ConvertJSONSchemaPropsWithPostProcess converts the schema from apiextensions.JSONSchemaPropos to go-openapi/spec.Schema | ||
| // and run a post process step on each JSONSchemaProps node. |
There was a problem hiding this comment.
The post process option looks like a good hot-fix to me. It's a little bit too flexible/powerful IMO.
In future maybe we want a walker processing on a single type like #71132 suggested (I checked kube-openapi and it's not straight-forward to use the refWalker there). So we don't have to mix conversion and object-processing up
There was a problem hiding this comment.
Yes, a walker would be great. This is kind of a walker, but does the conversion in parallel.
|
/retest |
|
/retest failed 2 out of 30 times today due to timeout. I think we can increase the timeout to 3 minutes when updating the e2e test |
|
/priority critical-urgent |
Fixes #71132.