Class SchemaUtils

java.lang.Object
com.google.adk.SchemaUtils

public final class SchemaUtils extends Object
Utility class for validating schemas.
  • Method Details

    • validateMapOnSchema

      public static void validateMapOnSchema(Map<String,Object> args, com.google.genai.types.Schema schema, Boolean isInput) throws IllegalArgumentException
      Validates 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.