kubernetes-client icon indicating copy to clipboard operation
kubernetes-client copied to clipboard

CRDGenerator: JSON Schema annotation for full control

Open MikeEdgar opened this issue 6 months ago • 0 comments

Is your enhancement related to a problem? Please describe

There are a number of JSON schema properties that we are not able to represent with the code-first approach. Several issues are open in this repository to individually add support for things like oneOf schema assertions or particular Kubernetes extensions like x-kubernetes-list-type.

Describe the solution you'd like

I'd like to propose introducing an annotation @JSONSchema that maps directly to io.fabric8.kubernetes.api.model.apiextensions.v1.JSONSchemaProps. When present, this annotation would be used instead of any other processing/introspection for an element (class, field, method). This would work similar to how Swagger or MicroProfile OpenAPI schema annotations work, giving full control to the user. Since Java annotations cannot be recursive, any nested schema references (e.g. anyOf) would have a type of Class, pointing to the type which would be further scanned to fill in that schema's information.

Describe alternatives you've considered

No response

Additional context

No response

MikeEdgar avatar Apr 10 '25 09:04 MikeEdgar