Ensure optional AWSResourceReference can be omitted when marshalled#1134
Conversation
|
@JoelSpeed: all tests passed! Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
elmiko
left a comment
There was a problem hiding this comment.
makes sense to me, thanks for the detailed commit message
/lgtm
|
oh the mysteries of openapi /approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, elmiko, JoelSpeed 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 |
|
This project is not part of the no-FF process, will manually apply the labels /label px-approved |
While setting up the API in #1112 I had been testing using kubectl to make sure the API behaved as expected. When then trying to use it from a go client, omitting the
subnetfrom the struct (an optional field with required fields within it), and then using client-go to create the object results in the following error:The go client is marshalling the empty struct which then causes the validation to fail as the required fields within it are not being set.
To avoid this, we need to make this field a pointer so that the struct is omitted when marshalled into json. I have tested this with the test cases I was writing in Go and it resolves the error being returned from the OpenAPI validation.