Skip to content
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

CRDGenerator: Support for externalDocs #6667

Open
baloo42 opened this issue Nov 27, 2024 · 0 comments
Open

CRDGenerator: Support for externalDocs #6667

baloo42 opened this issue Nov 27, 2024 · 0 comments
Labels
component/crd-generator Related to the CRD generator enhancement

Comments

@baloo42
Copy link
Contributor

baloo42 commented Nov 27, 2024

Is your enhancement related to a problem? Please describe

The JSONSchemaProps in CRDs allow to reference external documentation resources:

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#externaldocumentation-v1-apiextensions-k8s-io

The CRDGenerator should be able to generate those references by searching for an annotation.

Describe the solution you'd like

Suggested annotation:

@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface ExternalDocs {

  /**
   * A short description of the target documentation.
   *
   * @return the documentation description
   **/
  String description() default "";

  /**
   * The URL for the target documentation. Value must be in the format of a URL.
   *
   * @return the documentation URL
   **/
  String url() default "";

}

externalDocs should only appear in the resulting schema if at least url or description is not empty.

Describe alternatives you've considered

No response

Additional context

Example tests:
https://github.com/baloo42/crd-generator-victools/blob/main/test/src/test/java/io/fabric8/crd/generator/victools/approvaltests/externaldocs/ExternalDocSpec.java
https://github.com/baloo42/crd-generator-victools/blob/main/test/src/test/resources/io/fabric8/crd/generator/victools/approvaltests/CRDGeneratorVictoolsApprovalTest.approvalTest.externaldocs.samples.fabric8.io.v1.approved.yml

@baloo42 baloo42 changed the title CRDGenerator: Add support for externalDocs CRDGenerator: Support for externalDocs Nov 27, 2024
@manusa manusa added enhancement component/crd-generator Related to the CRD generator labels Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/crd-generator Related to the CRD generator enhancement
Projects
None yet
Development

No branches or pull requests

2 participants