NAME
Langertha::Holmgang::ToolSchema - The JSON Schema subset of tool parameters, checked at load and per call
VERSION
version 0.001
SYNOPSIS
use Langertha::Holmgang::ToolSchema qw( check_schema schema_errors );
check_schema( $tool->{parameters}, 'suite.yaml: tools[0].parameters' ); # at load
my @errors = schema_errors( $args, $tool->{parameters} ); # per call
# ( '$.dst: fehlt', '$.metric: erwartet integer' )
DESCRIPTION
Tool parameters are a subset of JSON Schema: the keys type, required, properties, items, enum, const, pattern, minLength, maxLength, minimum, maximum, minItems, maxItems, description, title, nested through properties and items.
"check_schema" is the shape check of the loader: anything else is a loud Langertha::Holmgang::Error. "schema_errors" checks the arguments of one call; its texts go to the model (after Fehler: Argumente passen nicht zum Schema:) and are therefore German, as the suites expect them. Integers and numbers may arrive as text ("3"), as many models send them. enum and const compare like the expectations do. Unlike cai-platform, which accepts const but never checks it, const holds per call: the schema the model sees means what it says.
type may be a list of types, as JSON Schema has it (type: [string, "null"]): the value fits when it fits one of them, and the model reads erwartet string oder null. The other keys apply as they stand: an enum beside "null" has to list null for a null to pass, as in JSON Schema, and a null in enum matches a null (in cai-platform it matches nothing). cai-platform refuses a type list at load.
check_schema
check_schema( $schema, $field );
Refuses an unknown key, an unknown type (a name, or a list of names that is not empty and names none twice), an invalid pattern, a properties that is not a hash, a required or enum that is not a list and a const that is not a scalar (text, number or boolean) — recursively, with the field path. Returns the schema.
schema_errors
my @errors = schema_errors( $data, $schema );
The violations of $data against $schema, each with its path from $ ($.dst, $.peers[1]); empty when the data fit.
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/langertha-holmgang/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.