-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: support @JsonClassDescription for top-level CRD description (#7375) #7390
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
base: main
Are you sure you want to change the base?
feat: support @JsonClassDescription for top-level CRD description (#7375) #7390
Conversation
…bric8io#7375) Signed-off-by: taole33 <[email protected]>
shawkins
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR, it looks very good.
Just wanted to add that it's not required to make changes to the older implementation. You can just add a v2 generator specific test.
|
|
||
| private static final Map<TypeRef, String> COMMON_MAPPINGS = new HashMap<>(); | ||
| public static final String ANNOTATION_JSON_FORMAT = "com.fasterxml.jackson.annotation.JsonFormat"; | ||
| public static final String ANNOTATION_JSON_CLASS_DESCRIPTION = "com.fasterxml.jackson.annotation.JsonClassDescription"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't appear to be used.
|
@shawkins |
|
@shawkins |
…v2 generator Signed-off-by: taole33 <[email protected]>
c62c2d0 to
254ec3b
Compare
|
@shawkins
All CI checks should be green now. Thanks for waiting. |
shawkins
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. The only nit would be that the description annotation is used at any level, not just the top-level object.
Could the changelog and a doc entry in https://github.com/fabric8io/kubernetes-client/blob/main/doc/CRD-generator.md#features-cheatsheet be updated to reflect this?
Sure, I’d be happy to update the changelog and documentation. |
Description
This PR introduces support for the Jackson
@JsonClassDescriptionannotation to provide a top-level description for generated Custom Resource Definitions (CRDs), addressing the request in #7375.Previously, only property-level descriptions via
@JsonPropertyDescriptionwere supported. With this change, bothv1andv2CRD generators can now extract and include the description at the root of the OpenAPI v3 schema when a Custom Resource class is annotated with@JsonClassDescription.Changes
AbstractJsonSchemaincrd-generator-api(v1) andcrd-generator-api-v2to process class-level annotations.crd-generator/testusing a sampleDescribedresource to verify the output YAML across all supported CRD versions.Type of change
Checklist
Fixes #7375