Package com.google.genkit.core
Class SchemaUtils
java.lang.Object
com.google.genkit.core.SchemaUtils
SchemaUtils provides utilities for JSON Schema generation and validation.
-
Method Summary
Modifier and TypeMethodDescriptionarraySchema(Map<String, Object> itemsSchema) Creates a schema for an array type with the given items schema.Creates a schema for a boolean type.inferSchema(Class<?> clazz) Generates a JSON Schema for the given class.Creates a schema for an integer type.Creates a schema for a number type.objectSchema(Map<String, Object> properties) Creates a schema for an object type with the given properties.simpleSchema(String typeName) Generates a JSON Schema for a primitive type.Creates a schema for a string type.
-
Method Details
-
inferSchema
Generates a JSON Schema for the given class.- Parameters:
clazz- the class to generate schema for- Returns:
- the JSON schema as a map
-
simpleSchema
Generates a JSON Schema for a primitive type.- Parameters:
typeName- the type name (string, number, integer, boolean, array, object)- Returns:
- the JSON schema as a map
-
stringSchema
Creates a schema for a string type.- Returns:
- the string schema
-
integerSchema
Creates a schema for an integer type.- Returns:
- the integer schema
-
numberSchema
Creates a schema for a number type.- Returns:
- the number schema
-
booleanSchema
Creates a schema for a boolean type.- Returns:
- the boolean schema
-
arraySchema
Creates a schema for an array type with the given items schema.- Parameters:
itemsSchema- the schema for array items- Returns:
- the array schema
-
objectSchema
Creates a schema for an object type with the given properties.- Parameters:
properties- the property schemas- Returns:
- the object schema
-