Introspections

Utility object for annotation-based introspection, providing methods to process annotations, especially those related to descriptions.

This object provides a configurable mechanism for recognizing description annotations from multiple frameworks (kotlinx-schema, Jackson, LangChain4j, Koog, etc.) by their simple names. Configuration is loaded from kotlinx-schema.properties on the classpath.

Configuration

The annotation detection behavior is controlled by two properties in kotlinx-schema.properties:

  • introspector.annotations.description.names: Comma-separated list of annotation simple names to recognize as description providers (e.g., "Description,LLMDescription,P")

  • introspector.annotations.description.attributes: Comma-separated list of annotation parameter names that contain description text (e.g., "value,description")

Customizing Configuration

To add support for custom annotations, create kotlinx-schema.properties in your project's src/main/resources/ directory (or src/commonMain/resources/ for multiplatform projects):

introspector.annotations.description.names=Description,MyCustomDescription
introspector.annotations.description.attributes=value,description,text

Your project's properties file will take precedence over the library's default configuration.

See also

Functions

Link copied to clipboard
fun getDescriptionFromAnnotation(annotationName: String, annotationArguments: List<Pair<String, Any?>>): String?

Extracts the description text from an annotation if it matches a recognized description annotation.