Skip to content

Commit 5953136

Browse files
committed
feat(docs): add @sample annotation for documentation
Marks integration test classes so that markdown pages can be auto generated.
1 parent 1ab7e43 commit 5953136

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

operator-annotations/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>io.javaoperatorsdk</groupId>
8+
<artifactId>java-operator-sdk</artifactId>
9+
<version>5.1.3-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>operator-annotations</artifactId>
13+
14+
<properties>
15+
<maven.compiler.source>22</maven.compiler.source>
16+
<maven.compiler.target>22</maven.compiler.target>
17+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
</properties>
19+
20+
</project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.javaoperatorsdk;
2+
3+
import java.lang.annotation.*;
4+
5+
/**
6+
* This annotation marks an integration test class as a sample for the documentation.
7+
* Intended for use on test classes only.
8+
*
9+
* <p><b>Example:</b>
10+
* <pre>{@code
11+
* @Sample(
12+
* tldr="Usage of PrimaryToSecondaryMapper",
13+
* description="Showcases the usage of PrimaryToSecondaryMapper, in what situation it needs to be used and how to optimize typical uses with Informer indexes."
14+
* )
15+
* class PrimaryToSecondaryIT {
16+
* // details omitted
17+
* }
18+
* }</pre>
19+
*/
20+
@Target(ElementType.TYPE)
21+
@Retention(RetentionPolicy.SOURCE)
22+
@Documented
23+
public @interface Sample {
24+
String tldr();
25+
String description();
26+
}

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<module>sample-operators</module>
3737
<module>caffeine-bounded-cache-support</module>
3838
<module>bootstrapper-maven-plugin</module>
39+
<module>operator-annotations</module>
3940
</modules>
4041

4142
<scm>

0 commit comments

Comments
 (0)