Class SchemaGenerator
java.lang.Object
com.github.copilot.tool.SchemaGenerator
Compile-time utility that maps
javax.lang.model types to JSON Schema
represented as Java source code literals (Map.of(...) expressions).
This class is invoked by the annotation processor and operates exclusively
with the javax.lang.model API. It does NOT use
java.lang.reflect.
- Since:
- 1.0.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerateParametersSchemaSource(List<? extends VariableElement> parameters, Types typeUtils, Elements elementUtils) Generates the full "parameters" schema source for a method's parameters.generateSchemaSource(TypeMirror type, Types typeUtils, Elements elementUtils) Given aTypeMirrorfrom the annotation processing environment, returns aStringcontaining Java source code for aMapliteral representing the JSON Schema of that type.
-
Constructor Details
-
SchemaGenerator
public SchemaGenerator()
-
-
Method Details
-
generateSchemaSource
Given aTypeMirrorfrom the annotation processing environment, returns aStringcontaining Java source code for aMapliteral representing the JSON Schema of that type. -
generateParametersSchemaSource
public String generateParametersSchemaSource(List<? extends VariableElement> parameters, Types typeUtils, Elements elementUtils) Generates the full "parameters" schema source for a method's parameters. Produces aMap.of("type", "object", "properties", Map.of(...), "required", List.of(...)).
-