Skip to content

CRDGenerator: JSON Schema annotation for full control #6999

@MikeEdgar

Description

@MikeEdgar

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions