JSON::...tation(3pm)

πŸ“¦
version 0.642 Β· 4 versions
, in ubuntu stonking

✨ NAME ✨

okay bestie, welcome to JSON::Schema::Modern::Annotation β€” it's the little container that holds one single annotation from a JSON Schema evaluation πŸ’– (this one's from the User Contributed Perl Documentation manual, iykyk).

🌸 VERSION 🌸

version 0.642

ngl the version numbering here is a linear, always-increasing situation β€” so do not read anything into the number being less than 1.0, fr fr. No meaning should be presumed or inferred from that. Periodt.

πŸŽ€ SYNOPSIS πŸŽ€

use JSON::Schema::Modern;
my $js = JSON::Schema::Modern->new;
my $result = $js->evaluate($data, $schema);
my @annotations = $result->annotations;

my $value = $annotations[0]->annotation;
my $instance_location = $annotations[0]->instance_location;

my $annotations_encoded = encode_json(\@annotations);

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically β€” an instance of this class holds one annotation from evaluating a JSON Schema with JSON::Schema::Modern. one annotation, one object, very demure, very mindful ✨


πŸ‘‘ ATTRIBUTES πŸ‘‘

πŸ’… keyword

the keyword that produced the annotation.

πŸ“ instance_location

the path in the instance where the annotation was produced 🌈 it's encoded as per the JSON Pointer specification (RFC 6901, https://datatracker.ietf.org/doc/html/rfc6901).

🧚 keyword_location

the schema path taken during evaluation to arrive at the annotation ✨ also encoded as per the JSON Pointer specification (RFC 6901, https://datatracker.ietf.org/doc/html/rfc6901).

πŸ’œ absolute_keyword_location

the canonical URI or URI reference of the location in the schema where the error occurred. it's not defined if there's no base URI for the schema and no $ref was followed.

heads up bestie: this is not actually 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 also β€” if the schema never declared an absolute base URI (one containing a scheme), this URI won't be absolute either. πŸ’€

⭐ unknown

a boolean flag β€” it tells you whether the keyword is a known vocabulary keyword or an unknown one.

πŸŽ€ annotation

the actual annotation value 🫢 which may or may not be a string.

🌈 depth

an integer that says how many subschemas deep this annotation was generated from. you can use it to construct a tree-like structure of annotations 🌳 iconic.


πŸ”₯ METHODS πŸ”₯

πŸ’– TO_JSON

returns a data structure suitable for serialization ✨ it 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. (if that distinction matters to you, see the strict_basic output_format in JSON::Schema::Modern, which is only available in that version πŸ‘€)

πŸ¦‹ dump

returns a JSON string representing the error object, according to the specification at https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.10.


🫢 GIVING THANKS 🫢

if you found this module useful, please show your appreciation by adding a +1 on MetaCPAN (https://metacpan.org/dist/JSON-Schema-Modern) and a star on GitHub (https://github.com/karenetheridge/JSON-Schema-Modern). it's giving main character energy and it costs you nothing bestie πŸ’–

🌸 SUPPORT 🌸

bugs may be submitted through https://github.com/karenetheridge/JSON-Schema-Modern/issues.

she's also usually active on irc, as 'ether' at irc.perl.org and irc.libera.chat 🧚

you can also find her on the JSON Schema Slack server (https://json-schema.slack.com) and the OpenAPI Slack server (https://open-api.slack.com) β€” which are also great resources for finding help πŸŽ€

✨ AUTHOR ✨

Karen Etheridge <ether@cpan.org>

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.


and that's the whole page bestie, no cap πŸ’… this was perl v5.40.1, dated 2026-07-31 β€” go forth and annotate πŸ¦‹βœ¨

πŸ“¦ where this page comes from