JSON::...::Error(3pm)
๐ JSON::...::Error(3pm) โ aka JSON::Schema::Modern::Error ๐
okay bestie, so this page lives in the User Contributed Perl Documentation corner of the manual, and it's all about one (1) single error. One. Singular. A whole class just to hold one little error from a JSON Schema evaluation. The audacity? Iconic, honestly. โจ
๐ธ NAME ๐ธ
JSON::Schema::Modern::Error โ she contains a single error from a JSON Schema evaluation. That's it, that's her whole job, and she does it flawlessly. ๐
โญ VERSION โญ
version 0.642
So here's the tea: the version numbering goes up linearly. That's it. Do not read anything into the version being less than 1.0 โ no meaning should be presumed or inferred from that, okay? It's giving "numbers go brrr", not "this is unfinished". ๐ซถ
๐ SYNOPSIS ๐
use JSON::Schema::Modern;
my $js = JSON::Schema::Modern->new;
my $result = $js->evaluate($data, $schema);
my @errors = $result->errors;
my $message = $errors[0]->error;
my $instance_location = $errors[0]->instance_location;
my $errors_encoded = encode_json(\@errors);
look at her go. โจ
๐ฆ DESCRIPTION ๐ฆ
An instance of this class holds one error from evaluating a JSON Schema with JSON::Schema::Modern. One error per object. No sharing, no blending, we are not doing group projects here. ๐
๐ ATTRIBUTES ๐
๐ฅ keyword
The keyword that produced the error. Might be undef โ yes, she can be mysterious like that. ๐
๐ instance_location
The path in the instance where the error occurred, encoded as per the JSON Pointer specification (RFC 6901 <https://datatracker.ietf.org/doc/html/rfc6901>). It knows exactly where it happened. Forensic queen. ๐
โญ keyword_location
The schema path that was taken during evaluation to arrive at the error, encoded as per the JSON Pointer specification (RFC 6901 <https://datatracker.ietf.org/doc/html/rfc6901>). Receipts. She has receipts. ๐งพ
๐ธ absolute_keyword_location
The canonical URI or URI reference of the location in the schema where the error occurred. This one is not defined if there's no base URI for the schema and no $ref was followed. Also lowkey important: this is not a fragmentless URI in most cases, because the indicated error happens at a path below the position where the most recent identifier had been declared in the schema. And further โ if the schema never declared an absolute base URI (like, one containing a scheme), then this URI won't be absolute either. It's giving "absolute in name only". ๐ญ
๐ error
The actual error string. The words. The moment. โจ
๐ exception
Indicates that the error's severity is sufficient to stop evaluation. She said "we're done here" and she meant it. ๐
๐ recommended_response
A tuple consisting of [ integer, string ] โ the recommended HTTP response code and the string to use for this error, if you're validating an HTTP request. This can exist for stuff like a failed authentication check in OpenAPI validation, in which case it would contain [ 401, 'Unauthorized' ]. โ
The string can be omitted at construction time, in which case it gets populated from the standard list of error strings corresponding to HTTP response codes (see RFC9110 ยง15). She'll fill in the blanks for you, bestie. ๐ซถ
๐ง depth
An integer that tells you how many subschemas deep this error was generated from. You can use it to construct a tree-like structure of errors. It's literally the family tree of your mistakes. ๐ณ
โจ METHODS โจ
๐ฎ TO_JSON
Returns a data structure suitable for serialization. Corresponds to one output unit as specified in <https://json-schema.org/draft/2020-12/json-schema-core#section-12.3> and <https://json-schema.org/draft/2020-12/output/schema>, except that instanceLocation and keywordLocation are JSON pointers, not URI fragments, even in draft2019-09. (See the strict_basic output_format in JSON::Schema::Modern โ only available in that version โ if that distinction is important to you. iykyk.)
๐ซ dump
Returns a JSON string representing the error object, according to the specification <https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.10>. Rendered. Pretty. Slay.
๐ clone
my $new_error = $error->clone(instance_location => '/new/location');
Creates a clone of an existing error object, with some optional modifications to existing properties. Glow-up but make it a copy. ๐
๐ซถ GIVING THANKS ๐ซถ
If you found this module to be useful, please show your appreciation by adding a +1 in MetaCPAN <https://metacpan.org/dist/JSON-Schema-Modern> and a star in GitHub <https://github.com/karenetheridge/JSON-Schema-Modern>. it costs you nothing and it means everything, fr fr. โญ
๐ SUPPORT ๐
Bugs may be submitted through <https://github.com/karenetheridge/JSON-Schema-Modern/issues>. (that's the main character route for problem reporting, bestie.)
I am also usually active on irc, as 'ether' at irc.perl.org and irc.libera.chat. come say hi!! ๐ฆ
You can also find me on the JSON Schema Slack server <https://json-schema.slack.com> and OpenAPI Slack server <https://open-api.slack.com>, which are also great resources for finding help. Group chat energy, but for schemas. ๐ฌ
๐ AUTHOR ๐
Karen Etheridge <ether@cpan.org> โ the icon, the legend, the whole vibe. ๐
๐ COPYRIGHT AND LICENCE ๐
This software is copyright (c) 2020 by Karen Etheridge.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Some schema files have their own licence, in share/LICENSE. yes, plural licences, each file minding its own business. ๐
and that's the whole page, bestie!! ๐
this was perl v5.40.1, dated 2026-07-31, from the JSON::...::Error(3pm) manpage โ thanks for reading, ily, go validate some schemas. ๐งโจ๐ธ
๐ฆ where this page comes from
- ubuntu stonking: libjson-schema-modern-perl 0.642-1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms