-
Notifications
You must be signed in to change notification settings - Fork 229
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
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. |
operator-annotations/pom.xml
Outdated
<artifactId>operator-annotations</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>22</maven.compiler.source> |
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.
I'm not sure these properties are needed here since they should probably be inherited from the parent. Also, this code should work with Java 21.
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
@Sample
annotation withtldr
anddescription
fields for marking integration test classes - Implements a
SampleProcessor
annotation processor that collects annotated classes and generates markdown output - Creates a new Maven module
operator-annotations
to 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 |
Copilot uses AI. Check for mistakes.
operator-annotations/src/main/java/io/javaoperatorsdk/processor/SampleProcessor.java
Outdated
Show resolved
Hide resolved
Marks integration test classes so that markdown pages can be auto generated.
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
7e9be4a
to
feab885
Compare
Co-authored-by: Copilot <[email protected]>
Marks integration test classes so that markdown pages can be auto generated.