-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
operator-sdk generate openapi fails when json name does not match attribute name #1222
Comments
Not sure this is an issue with operator-sdk, think this might be an issue with |
@miguelsorianod Having the json name differ from the field name causes a problem with the kube-openapi name_match rule. Since this is an API rule violation for the generator I'm not sure that there's another way around it, except your json field name has to match the struct attribute name. |
@miguelsorianod @hasbro17 @lilic @estroz Just wanted to follow up on this issue, which hasn't had any movement for awhile. Since it looks like this is working as intended based on kube-openapi's rules, I think it makes sense to close this issue. If anyone disagrees, feel free to re-open. |
Yes I was incorrect when I mentioned a work around or fixing this upstream.
I think that's something @miguelsorianod seems to have already fixed judging from the recent commits. |
Hi,
We have installed operator-sdk v0.6.0 and we have observed the problem that when you define an attribute in the *Spec struct of a defined API type and the attribute name differs from its json struct tag name, the
operator-sdk generate openapi
command fails, whereas that did not happen in older versions that we were using.An example of the error we observe in that case is:
Investigating, we have seen that one of the changes between v0.4.0 and v0.5.0 is that in v0.5.0 and newer versions the sentence
// +k8s:openapi-gen=true
is used in the *Spec and *Status struct types additionally to the struct type of the defined API type. In v0.4.0 it was only used in the struct type of the defined API type.Upgrading from an older version would break the existing functionality due to this changes, which is the action we were trying to perform.
For example, in v0.4.0, for a 'ExampleApp' API type you would have the following code:
Whereas in v0.6.0 you have (notice the additional
// +k8s:openapi-gen=true
):To reproduce the problem, in v0.6.0 you can:
Environment
The text was updated successfully, but these errors were encountered: