Package io.github.glaforge.gemini.schema
Class Schema
java.lang.Object
io.github.glaforge.gemini.schema.Schema
- Direct Known Subclasses:
ArraySchema,BooleanSchema,NumberSchema,ObjectSchema,StringSchema
Abstract base class for all Gemini JSON Schemas.
-
Field Details
-
type
The JSON schema type. -
description
The description of the parameter. -
title
The title of the parameter. -
nullable
protected boolean nullableWhether the parameter is nullable.
-
-
Constructor Details
-
Schema
Initializes a new schema with the given type.- Parameters:
type- The JSON schema type.
-
-
Method Details
-
desc
Set the description for this schema.- Parameters:
description- The description string.- Returns:
- The schema instance.
-
title
Set the title for this schema.- Parameters:
title- The title string.- Returns:
- The schema instance.
-
nullable
Mark this schema as nullable. This will change the type in the JSON output to an array ["originalType", "null"].- Returns:
- The schema instance.
-
toMap
Convert this Schema object into a Map suitable for JSON serialization.- Returns:
- A Map representing the JSON schema.
-