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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Allow setting the type for structs that implement json.Marshaler #601

Conversation

alvaroaleman
Copy link
Member

This change re-introduces #427 which was reverted in #505 because it generates a schema with Any in it which the kube api server won't allow. The change compared to the original work is in the last commit: We will fallback to the standard generation when there is no marker, rather than inserting the invalid Any.

Fixes #552
Fixes #560
Original issue: #391

/assign @vincepri
/cc @markusthoemmes

Slavomir Kaslev and others added 3 commits August 27, 2021 18:07
Currently controller-gen complains about structs with missing json tags
even when those structs implement custom JSON marshalling.

With this change we check if a type implements custom JSON marshalling and if it
does, we output schema for Any type. This still allows the validation type to
be overriden with a marker.
This slightly extends the initial work in PR 427 to fall back to the
standard generation rather than producing a schema with Any in it, as
that is invalid and led us to revert that PR.
@k8s-ci-robot
Copy link
Contributor

@alvaroaleman: GitHub didn't allow me to request PR reviews from the following users: markusthoemmes.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

This change re-introduces #427 which was reverted in #505 because it generates a schema with Any in it which the kube api server won't allow. The change compared to the original work is in the last commit: We will fallback to the standard generation when there is no marker, rather than inserting the invalid Any.

Fixes #552
Fixes #560
Original issue: #391

/assign @vincepri
/cc @markusthoemmes

Instructions 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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 27, 2021
Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 27, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, vincepri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 27, 2021
@k8s-ci-robot k8s-ci-robot merged commit ee59f32 into kubernetes-sigs:master Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
3 participants