Class JsonSchemaGenerator

java.lang.Object
org.springframework.ai.util.json.schema.JsonSchemaGenerator

public final class JsonSchemaGenerator extends Object
Utilities to generate JSON Schemas from Java types and method signatures. It's designed to work well in the context of tool calling and structured outputs, aiming at ensuring consistency and robustness across different model providers.

Metadata such as descriptions and required properties can be specified using one of the following supported annotations:

  • @ToolParam(required = ..., description = ...)
  • @JsonProperty(required = ...)
  • @Schema(required = ..., description = ...)
  • @Nullable

If none of these annotations are present, the default behavior is to consider the property as required and not to include a description.

Since:
1.0.0
Author:
Thomas Vitale