dev.klok.framework.common.docs.KlokDocs marks a project class, or a whole package on package-info.java, as an
important component that gets its own page in the generated project documentation on docs.klok.dev.
Routes are documented automatically because they extend a framework base class. The classes they depend on are not, and
without them the documentation generator only sees a route's own source. The route KLK007T1_PublishKlokStandard in the
documentation egress calls KlokStandard.get(), and its generated page guessed what get() does, sequence diagram
included. Annotating the class fixes that.
import dev.klok.framework.common.docs.KlokDocs;
/** The Klok standard documentation configuration, shipped with this service as a classpath resource. */
@KlokDocs(summary = "The Klok documentation standard the service ships and publishes")
public final class KlokStandard { ... }
When to use it
- Central configuration or standards that several routes read.
- Shared mappers used by more than one route.
- Domain logic used by several routes.
Not every class. A helper or a DTO used by one route is already given to that route's documentation as context (the
plugin passes every project class a route references, annotated or not); annotating it only adds a thin page.
Attributes
| Attribute |
Default |
Meaning |
summary |
"" |
One sentence for component lists; empty means the first sentence of the Javadoc. |
chapter |
"" |
The documentation chapter the page belongs in; empty means the standard components chapter. |
How it is read
The retention is CLASS: nothing reads the annotation at runtime and it costs nothing in a running service. The Klok
Gradle plugin finds it in the source code while building KlokProjectDocumentationV1, matching the qualified name
dev.klok.framework.common.docs.KlokDocs (or the simple name KlokDocs when that name is imported), and adds the
class's source, Javadoc, public member signatures and the routes that use it to the payload. The documentation egress
renders one page per component. The Javadoc of the annotated element is the most important input; write it for a reader
who has not seen the code.
The annotation lives here rather than in the Quarkus extension so that any Java project, with or without Camel, can use
it.