-
Notifications
You must be signed in to change notification settings - Fork 232
feat(docs): add @Sample annotation for documentation #2954
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(docs): add @Sample annotation for documentation #2954
Conversation
Marks integration test classes so that markdown pages can be auto generated.
|
I wasn't sure where to place @sample, so I put it in a temporary module for now. I thought about putting it in sample-operators. Do you have any recommendations? I'm happy to move it. |
|
I think that is fine by now, since the implementation will be I guess an annotation processor. |
refactor: remove unneeded properties in pom.xml
Implemented a sample processor to scan all samples and write the tldr/description to a md file Moved Sample.java to the annotation package
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.
Pull Request Overview
This PR introduces a @Sample annotation and corresponding annotation processor to enable automatic generation of markdown documentation from integration test classes. The feature allows developers to mark test classes with metadata that gets compiled into a samples.md file for documentation purposes.
- Adds a new
@Sampleannotation withtldranddescriptionfields for marking integration test classes - Implements a
SampleProcessorannotation processor that collects annotated classes and generates markdown output - Creates a new Maven module
operator-annotationsto house the annotation infrastructure
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pom.xml | Adds the new operator-annotations module to the parent POM |
| operator-annotations/pom.xml | Defines the new Maven module for annotation processing |
| operator-annotations/src/main/java/io/javaoperatorsdk/annotation/Sample.java | Defines the @sample annotation with tldr and description fields |
| operator-annotations/src/main/java/io/javaoperatorsdk/processor/SampleProcessor.java | Implements the annotation processor that generates samples.md from annotated classes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| /** | ||
| * |
Copilot
AI
Oct 14, 2025
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.
Empty Javadoc comment should either be removed or contain meaningful documentation describing the method's purpose, parameters, and behavior.
| /** | |
| * | |
| /** | |
| * Writes a markdown file named {@code samples.md} listing all provided samples. | |
| * Each sample is written as a section with its TLDR and description. | |
| * | |
| * @param samples the list of samples to include in the markdown file | |
| * @throws RuntimeException if an I/O error occurs during file writing |
operator-annotations/src/main/java/io/javaoperatorsdk/processor/SampleProcessor.java
Show resolved
Hide resolved
7e9be4a to
feab885
Compare
|
Hi @Choconaut , looks good maybe what we could do is to use this now in |
62da213 to
ad9cb00
Compare
This commit also adds an example sample annotation to the CRDMappingInTestExtensionIT class to test the sample annotation processor.
ad9cb00 to
db5b9b2
Compare
This commit also adds an example sample annotation to the CRDMappingInTestExtensionIT class to test the sample annotation processor.
…/java-operator-sdk into docs-sample-annotation
Hi, I added the sample annotations to these 2 classes: RDMappingInTestExtensionIT.java, ChangeNamespaceIT.java in |
Marks integration test classes so that markdown pages can be auto generated.