-
Notifications
You must be signed in to change notification settings - Fork 303
Autogenerated OpenAPI schema classes don't work as expected #417
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
Comments
Take a look at the spec here: I think the issue is that v1beta1.JSONSchemaProps is JSONSchema, not OpenAPI. v1.JSONSchemaProps is OpenAPI v3 There's a big discussion here: So I think you need to use the and I think it will work. |
But you can't really use a different version - the type is hardcoded as part of the object tree. It appears as part of |
We could probably fix this up by changing the type of the two places mentioned above to the V1 type. This can be done as part of the c# second phase gen project |
I checked the newer type (V1) and it has the same issue. I propose the following:
|
Ok, I got the bottom of this whole thing. Kubernetes does not support |
CustomResourceDefinition includes support for specifying OpenAPI schema. The generated classes that define the model for OpenAPI seem to be having issues with some types of common schema semantics. Here's an OpenAPI schema as generated by NJsonSchema
When we try to deserialize this into V1beta1JSONSchemaProps ex.
JsonConvert.DeserializeObject<V1beta1JSONSchemaProps>(schema.ToJson())
, it generates a single item inProperties["spec"].OneOf
with null value. This is incorrect and should have resulted in value being anotherV1beta1JSONSchemaProps
withRefProperty
set to what we see as part of the$ref
in the schema.This is currently acting as a bottleneck for a PR I was getting ready to submit that allows generating and installing CRDs, but I suspect will cause the same issue when trying to read
CustomResourceDefinition
from API server as it will fail correct deserialization (and can potentially corrupt the CRD if used to modify its structure).The text was updated successfully, but these errors were encountered: