-
Notifications
You must be signed in to change notification settings - Fork 237
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
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. |
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.
operator-annotations/src/main/java/io/javaoperatorsdk/processor/SampleProcessor.java
Show resolved
Hide resolved
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 |
ad9cb00 to
db5b9b2
Compare
Hi, I added the sample annotations to these 2 classes: RDMappingInTestExtensionIT.java, ChangeNamespaceIT.java in |
thank you will take a look next week |
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
This commit also adds an example sample annotation to the CRDMappingInTestExtensionIT class to test the sample annotation processor.
…r/SampleProcessor.java Co-authored-by: Copilot <[email protected]>
8cc9a4e to
58b4776
Compare
| <dependency> | ||
| <groupId>io.javaoperatorsdk</groupId> | ||
| <artifactId>operator-annotations</artifactId> | ||
| <version>5.1.3-SNAPSHOT</version> |
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.
We should use ${project.version} here.
|
Hi @Choconaut pls rebase it on to main and fix the build, I also tried it to locally but does not seem to generate the file, is it working for you locally? |
|
Hi @Choconaut I'm sorry but wanted to make progress with this, and quickly implemented this today: feel free to make improvements on that later. |
Marks integration test classes so that markdown pages can be auto generated.