From 5953136d9db96c1c9ccf67d13be8a27a4700ca8b Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Sat, 20 Sep 2025 21:01:12 -0400 Subject: [PATCH] feat(docs): add @Sample annotation for documentation Marks integration test classes so that markdown pages can be auto generated. --- operator-annotations/pom.xml | 20 ++++++++++++++ .../main/java/io/javaoperatorsdk/Sample.java | 26 +++++++++++++++++++ pom.xml | 1 + 3 files changed, 47 insertions(+) create mode 100644 operator-annotations/pom.xml create mode 100644 operator-annotations/src/main/java/io/javaoperatorsdk/Sample.java diff --git a/operator-annotations/pom.xml b/operator-annotations/pom.xml new file mode 100644 index 0000000000..41e94777ce --- /dev/null +++ b/operator-annotations/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + io.javaoperatorsdk + java-operator-sdk + 5.1.3-SNAPSHOT + + + operator-annotations + + + 22 + 22 + UTF-8 + + + \ No newline at end of file diff --git a/operator-annotations/src/main/java/io/javaoperatorsdk/Sample.java b/operator-annotations/src/main/java/io/javaoperatorsdk/Sample.java new file mode 100644 index 0000000000..49c6d9bc20 --- /dev/null +++ b/operator-annotations/src/main/java/io/javaoperatorsdk/Sample.java @@ -0,0 +1,26 @@ +package io.javaoperatorsdk; + +import java.lang.annotation.*; + +/** + * This annotation marks an integration test class as a sample for the documentation. + * Intended for use on test classes only. + * + *

Example: + *

{@code
+ * @Sample(
+ *  tldr="Usage of PrimaryToSecondaryMapper",
+ *  description="Showcases the usage of PrimaryToSecondaryMapper, in what situation it needs to be used and how to optimize typical uses with Informer indexes."
+ * )
+ * class PrimaryToSecondaryIT {
+ *   // details omitted
+ * }
+ * }
+ */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.SOURCE) +@Documented +public @interface Sample { + String tldr(); + String description(); +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2afcd8448a..69524810b7 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,7 @@ sample-operators caffeine-bounded-cache-support bootstrapper-maven-plugin + operator-annotations