Class SchemaUtils
java.lang.Object
com.google.adk.SchemaUtils
Utility class for validating schemas.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
validateMapOnSchema
(Map<String, Object> args, com.google.genai.types.Schema schema, Boolean isInput) Validates a map against a schema.validateOutputSchema
(String output, com.google.genai.types.Schema schema) Validates an output string against a schema.
-
Method Details
-
validateMapOnSchema
public static void validateMapOnSchema(Map<String, Object> args, com.google.genai.types.Schema schema, Boolean isInput) throws IllegalArgumentExceptionValidates a map against a schema.- Parameters:
args
- The map to validate.schema
- The schema to validate against.isInput
- Whether the map is an input or output.- Throws:
IllegalArgumentException
- If the map does not match the schema.
-
validateOutputSchema
public static Map<String,Object> validateOutputSchema(String output, com.google.genai.types.Schema schema) throws IllegalArgumentException, com.fasterxml.jackson.core.JsonProcessingException Validates an output string against a schema.- Parameters:
output
- The output string to validate.schema
- The schema to validate against.- Returns:
- The output map.
- Throws:
IllegalArgumentException
- If the output string does not match the schema.com.fasterxml.jackson.core.JsonProcessingException
- If the output string cannot be parsed.
-