validateOutputSchema

Parses a model output string as JSON and validates it against a schema.

Mirrors SchemaUtils.validateOutputSchema in the Java ADK and validate_schema in the Python ADK: output is expected to be a JSON object that matches schema. Like the Python ADK, and unlike the Java one, this fills in defaults for missing properties and strips a markdown code fence wrapping the entire output.

Only top-level object schemas are supported: output must parse to a JSON object (it is decoded via Json.fromJsonToMap). Top-level array or primitive schemas are not supported and will yield a Result.failure. This matches the Java ADK; the Python ADK additionally supports list/primitive output schemas.

Return

Result.success wrapping the parsed map, with whole-number doubles in integer fields converted to Long and each missing property's Schema.default filled in, if it is valid JSON matching schema; Result.failure if the string is not a valid JSON object or does not match the schema.

Parameters

output

The model output string to parse and validate.

schema

The schema to validate against.