Blaze 0.0.1
The ultra high-performance JSON Schema evaluator
 
Loading...
Searching...
No Matches
Foundation

A set of JSON Schema utilities across dialects. More...

Classes

class  sourcemeta::blaze::CompilerError
 
class  sourcemeta::blaze::CompilerInvalidRegexError
 
class  sourcemeta::blaze::CompilerReferenceTargetNotSchemaError
 
class  sourcemeta::blaze::CompilerInvalidEntryPoint
 
class  sourcemeta::blaze::SchemaError
 
class  sourcemeta::blaze::SchemaResolutionError
 
class  sourcemeta::blaze::SchemaRelativeMetaschemaResolutionError
 
class  sourcemeta::blaze::SchemaVocabularyError
 
class  sourcemeta::blaze::SchemaReferenceError
 
class  sourcemeta::blaze::SchemaUnknownDialectError
 
class  sourcemeta::blaze::SchemaUnknownBaseDialectError
 
class  sourcemeta::blaze::SchemaReferenceObjectResourceError
 
class  sourcemeta::blaze::SchemaBaseDialectError
 
class  sourcemeta::blaze::SchemaKeywordError
 
struct  sourcemeta::blaze::SchemaWalkerResult
 
struct  sourcemeta::blaze::SchemaIteratorEntry
 
struct  sourcemeta::blaze::Vocabularies
 
class  sourcemeta::blaze::SchemaIterator
 
class  sourcemeta::blaze::SchemaIteratorFlat
 
class  sourcemeta::blaze::SchemaKeywordIterator
 

Typedefs

using sourcemeta::blaze::SchemaResolver = std::function< std::optional< sourcemeta::core::JSON >(std::string_view)>
 
using sourcemeta::blaze::SchemaWalker = std::function< const SchemaWalkerResult &(std::string_view, const Vocabularies &)>
 

Enumerations

enum class  sourcemeta::blaze::SchemaReferenceType : std::uint8_t { Static , Dynamic }
 
enum class  sourcemeta::blaze::SchemaBaseDialect : std::uint8_t {
  JSON_Schema_2020_12 , JSON_Schema_2020_12_Hyper , JSON_Schema_2019_09 , JSON_Schema_2019_09_Hyper ,
  JSON_Schema_Draft_7 , JSON_Schema_Draft_7_Hyper , JSON_Schema_Draft_6 , JSON_Schema_Draft_6_Hyper ,
  JSON_Schema_Draft_4 , JSON_Schema_Draft_4_Hyper , JSON_Schema_Draft_3 , JSON_Schema_Draft_3_Hyper ,
  JSON_Schema_Draft_2_Hyper , JSON_Schema_Draft_1_Hyper , JSON_Schema_Draft_0_Hyper
}
 
enum class  sourcemeta::blaze::SchemaKeywordType : std::uint8_t {
  SchemaKeywordType::Unknown , SchemaKeywordType::Assertion , SchemaKeywordType::Annotation , SchemaKeywordType::Reference ,
  SchemaKeywordType::Other , SchemaKeywordType::Comment , SchemaKeywordType::LocationMembers , SchemaKeywordType::ApplicatorMembersTraversePropertyStatic ,
  SchemaKeywordType::ApplicatorMembersTraversePropertyRegex , SchemaKeywordType::ApplicatorValueTraverseSomeProperty , SchemaKeywordType::ApplicatorValueTraverseAnyPropertyKey , SchemaKeywordType::ApplicatorValueTraverseAnyItem ,
  SchemaKeywordType::ApplicatorValueTraverseSomeItem , SchemaKeywordType::ApplicatorValueTraverseParent , SchemaKeywordType::ApplicatorElementsTraverseItem , SchemaKeywordType::ApplicatorValueOrElementsTraverseAnyItemOrItem ,
  SchemaKeywordType::ApplicatorValueOrElementsInPlace , SchemaKeywordType::ApplicatorMembersInPlaceSome , SchemaKeywordType::ApplicatorElementsInPlace , SchemaKeywordType::ApplicatorElementsInPlaceSome ,
  SchemaKeywordType::ApplicatorElementsInPlaceSomeNegate , SchemaKeywordType::ApplicatorValueInPlaceMaybe , SchemaKeywordType::ApplicatorValueInPlaceOther , SchemaKeywordType::ApplicatorValueInPlaceNegate
}
 

Functions

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::schema_resolver (const std::string_view identifier) -> std::optional< sourcemeta::core::JSON >
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::is_known_schema (const std::string_view identifier) noexcept -> bool
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::is_official_schema (const std::string_view identifier) noexcept -> bool
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::schema_walker (const std::string_view keyword, const Vocabularies &vocabularies) -> const SchemaWalkerResult &
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::to_string (const SchemaBaseDialect base_dialect) -> std::string_view
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::to_base_dialect (const std::string_view base_dialect) -> std::optional< SchemaBaseDialect >
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::schema_keyword_priority (const std::string_view keyword, const Vocabularies &vocabularies, const SchemaWalker &walker) -> std::uint64_t
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::is_schema (const sourcemeta::core::JSON &schema) -> bool
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::is_empty_schema (const sourcemeta::core::JSON &schema) -> bool
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::identify (const sourcemeta::core::JSON &schema, const SchemaResolver &resolver, std::string_view default_dialect="", std::string_view default_id="", bool allow_dialect_override=true) -> std::string_view
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::identify (const sourcemeta::core::JSON &schema, const SchemaBaseDialect base_dialect, std::string_view default_id="") -> std::string_view
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::anonymize (sourcemeta::core::JSON &schema, const SchemaBaseDialect base_dialect) -> void
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::reidentify (sourcemeta::core::JSON &schema, std::string_view new_identifier, const SchemaResolver &resolver, std::string_view default_dialect="") -> void
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::reidentify (sourcemeta::core::JSON &schema, std::string_view new_identifier, const SchemaBaseDialect base_dialect) -> void
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::dialect (const sourcemeta::core::JSON &schema, std::string_view default_dialect="", bool allow_dialect_override=true) -> std::string_view
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::metaschema_try_embedded (const sourcemeta::core::JSON &schema, std::string_view identifier, const SchemaResolver &resolver) -> const sourcemeta::core::JSON *
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::metaschema (const sourcemeta::core::JSON &schema, const SchemaResolver &resolver, std::string_view default_dialect="") -> sourcemeta::core::JSON
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::base_dialect (const sourcemeta::core::JSON &schema, const SchemaResolver &resolver, std::string_view default_dialect="", bool allow_dialect_override=true) -> std::optional< SchemaBaseDialect >
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::parse_vocabularies (const sourcemeta::core::JSON &schema, const SchemaResolver &resolver, std::string_view default_dialect="") -> std::optional< Vocabularies >
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::parse_vocabularies (const sourcemeta::core::JSON &schema, const SchemaBaseDialect base_dialect) -> std::optional< Vocabularies >
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::vocabularies (const sourcemeta::core::JSON &schema, const SchemaResolver &resolver, std::string_view default_dialect="") -> Vocabularies
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::vocabularies (const SchemaResolver &resolver, const SchemaBaseDialect base_dialect, std::string_view dialect) -> Vocabularies
 
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::parse_schema_type (const sourcemeta::core::JSON &type) -> sourcemeta::core::JSON::TypeSet
 

Detailed Description

A set of JSON Schema utilities across dialects.

This functionality is included as follows:

#include <sourcemeta/blaze/foundation.h>

Class Documentation

◆ sourcemeta::blaze::CompilerError

class sourcemeta::blaze::CompilerError

An error that represents a schema compilation failure event

Inheritance diagram for sourcemeta::blaze::CompilerError:

Public Member Functions

 CompilerError (sourcemeta::core::URI base, sourcemeta::core::Pointer schema_location, const char *message)
 
 CompilerError (sourcemeta::core::URI base, sourcemeta::core::Pointer schema_location, std::string message)=delete
 
 CompilerError (sourcemeta::core::URI base, sourcemeta::core::Pointer schema_location, std::string &&message)=delete
 
 CompilerError (sourcemeta::core::URI base, sourcemeta::core::Pointer schema_location, std::string_view message)=delete
 
auto what () const noexcept -> const char *override
 
auto base () const noexcept -> const sourcemeta::core::URI &
 
auto location () const noexcept -> const sourcemeta::core::Pointer &
 

◆ sourcemeta::blaze::CompilerInvalidRegexError

class sourcemeta::blaze::CompilerInvalidRegexError

An error that represents an invalid regular expression during compilation

Inheritance diagram for sourcemeta::blaze::CompilerInvalidRegexError:

Public Member Functions

 CompilerInvalidRegexError (sourcemeta::core::URI base, sourcemeta::core::Pointer schema_location, std::string regex)
 
auto what () const noexcept -> const char *override
 
auto base () const noexcept -> const sourcemeta::core::URI &
 
auto location () const noexcept -> const sourcemeta::core::Pointer &
 
auto regex () const noexcept -> const std::string &
 

◆ sourcemeta::blaze::CompilerReferenceTargetNotSchemaError

class sourcemeta::blaze::CompilerReferenceTargetNotSchemaError

An error that represents a reference target that is not a valid schema

Inheritance diagram for sourcemeta::blaze::CompilerReferenceTargetNotSchemaError:

Public Member Functions

 CompilerReferenceTargetNotSchemaError (const std::string_view identifier, sourcemeta::core::Pointer schema_location)
 
auto what () const noexcept -> const char *override
 
auto identifier () const noexcept -> const std::string &
 
auto location () const noexcept -> const sourcemeta::core::Pointer &
 

◆ sourcemeta::blaze::CompilerInvalidEntryPoint

class sourcemeta::blaze::CompilerInvalidEntryPoint

An error that represents an invalid compilation entrypoint

Inheritance diagram for sourcemeta::blaze::CompilerInvalidEntryPoint:

Public Member Functions

 CompilerInvalidEntryPoint (const std::string_view entrypoint, const char *message)
 
 CompilerInvalidEntryPoint (const std::string_view entrypoint, std::string message)=delete
 
 CompilerInvalidEntryPoint (const std::string_view entrypoint, std::string &&message)=delete
 
 CompilerInvalidEntryPoint (const std::string_view entrypoint, std::string_view message)=delete
 
auto what () const noexcept -> const char *override
 
auto identifier () const noexcept -> const std::string &
 

◆ sourcemeta::blaze::SchemaError

class sourcemeta::blaze::SchemaError

An error that represents a general schema error event

Inheritance diagram for sourcemeta::blaze::SchemaError:

Public Member Functions

 SchemaError (const char *message)
 
 SchemaError (std::string message)=delete
 
 SchemaError (std::string &&message)=delete
 
 SchemaError (std::string_view message)=delete
 
auto what () const noexcept -> const char *override
 

◆ sourcemeta::blaze::SchemaResolutionError

class sourcemeta::blaze::SchemaResolutionError

An error that represents a schema resolution failure event

Inheritance diagram for sourcemeta::blaze::SchemaResolutionError:
sourcemeta::blaze::SchemaRelativeMetaschemaResolutionError

Public Member Functions

 SchemaResolutionError (const std::string_view identifier, const char *message)
 
auto what () const noexcept -> const char *override
 
auto identifier () const noexcept -> std::string_view
 

◆ sourcemeta::blaze::SchemaRelativeMetaschemaResolutionError

class sourcemeta::blaze::SchemaRelativeMetaschemaResolutionError

An error that represents a relative meta-schema resolution failure event Relative references to meta-schemas are invalid as per the specification See https://json-schema.org/draft/2020-12/json-schema-core#section-8.1.1-2

Inheritance diagram for sourcemeta::blaze::SchemaRelativeMetaschemaResolutionError:
sourcemeta::blaze::SchemaResolutionError

Public Member Functions

 SchemaRelativeMetaschemaResolutionError (const std::string_view identifier)
 
- Public Member Functions inherited from sourcemeta::blaze::SchemaResolutionError
 SchemaResolutionError (const std::string_view identifier, const char *message)
 
auto what () const noexcept -> const char *override
 
auto identifier () const noexcept -> std::string_view
 

◆ sourcemeta::blaze::SchemaVocabularyError

class sourcemeta::blaze::SchemaVocabularyError

An error that represents a schema vocabulary error

Inheritance diagram for sourcemeta::blaze::SchemaVocabularyError:

Public Member Functions

 SchemaVocabularyError (const std::string_view uri, const char *message)
 
auto what () const noexcept -> const char *override
 
auto uri () const noexcept -> std::string_view
 

◆ sourcemeta::blaze::SchemaReferenceError

class sourcemeta::blaze::SchemaReferenceError

An error that represents a schema resolution failure event

Inheritance diagram for sourcemeta::blaze::SchemaReferenceError:

Public Member Functions

 SchemaReferenceError (const std::string_view identifier, sourcemeta::core::Pointer schema_location, const char *message)
 
auto what () const noexcept -> const char *override
 
auto identifier () const noexcept -> std::string_view
 
auto location () const noexcept -> const sourcemeta::core::Pointer &
 

◆ sourcemeta::blaze::SchemaUnknownDialectError

class sourcemeta::blaze::SchemaUnknownDialectError

An error that represents that the dialect of the schema could not determined

Inheritance diagram for sourcemeta::blaze::SchemaUnknownDialectError:

Public Member Functions

auto what () const noexcept -> const char *override
 

◆ sourcemeta::blaze::SchemaUnknownBaseDialectError

class sourcemeta::blaze::SchemaUnknownBaseDialectError

An error that represents that the base dialect of the schema could not determined

Inheritance diagram for sourcemeta::blaze::SchemaUnknownBaseDialectError:

Public Member Functions

auto what () const noexcept -> const char *override
 

◆ sourcemeta::blaze::SchemaReferenceObjectResourceError

class sourcemeta::blaze::SchemaReferenceObjectResourceError

In JSON Schema Draft 7 and older, a schema that defines $ref is a reference object where every other keywords are ignored

Inheritance diagram for sourcemeta::blaze::SchemaReferenceObjectResourceError:

Public Member Functions

 SchemaReferenceObjectResourceError (const std::string_view identifier)
 
auto what () const noexcept -> const char *override
 
auto identifier () const noexcept -> std::string_view
 

◆ sourcemeta::blaze::SchemaBaseDialectError

class sourcemeta::blaze::SchemaBaseDialectError

An error that represents an unrecognized base dialect

Inheritance diagram for sourcemeta::blaze::SchemaBaseDialectError:

Public Member Functions

 SchemaBaseDialectError (const std::string_view base_dialect)
 
auto what () const noexcept -> const char *override
 
auto base_dialect () const noexcept -> std::string_view
 

◆ sourcemeta::blaze::SchemaKeywordError

class sourcemeta::blaze::SchemaKeywordError

An error that represents a schema keyword error

Inheritance diagram for sourcemeta::blaze::SchemaKeywordError:

Public Member Functions

 SchemaKeywordError (const std::string_view keyword, const std::string_view value, const char *message)
 
auto what () const noexcept -> const char *override
 
auto value () const noexcept -> std::string_view
 
auto keyword () const noexcept -> std::string_view
 

◆ sourcemeta::blaze::SchemaWalkerResult

struct sourcemeta::blaze::SchemaWalkerResult

A structure that encapsulates the result of walker over a specific keyword

Public Member Functions

 SchemaWalkerResult (const SchemaWalkerResult &)=delete
 
auto operator= (const SchemaWalkerResult &) -> SchemaWalkerResult &=delete
 
 SchemaWalkerResult (SchemaWalkerResult &&)=default
 
auto operator= (SchemaWalkerResult &&) -> SchemaWalkerResult &=default
 
 SchemaWalkerResult (SchemaKeywordType type_, std::optional< Vocabularies::URI > vocabulary_, std::unordered_set< std::string_view > dependencies_, std::unordered_set< std::string_view > order_dependencies_, sourcemeta::core::JSON::TypeSet instances_)
 

Public Attributes

SchemaKeywordType type
 The walker strategy to continue traversing across the schema.
 
std::optional< Vocabularies::URIvocabulary
 The vocabulary associated with the keyword, if any.
 
std::unordered_set< std::string_view > dependencies
 
std::unordered_set< std::string_view > order_dependencies
 
sourcemeta::core::JSON::TypeSet instances
 The JSON instance types that this keyword applies to (empty means all)
 

Member Data Documentation

◆ dependencies

std::unordered_set<std::string_view> sourcemeta::blaze::SchemaWalkerResult::dependencies

The keywords a given keyword depends on (if any) during the evaluation process

◆ order_dependencies

std::unordered_set<std::string_view> sourcemeta::blaze::SchemaWalkerResult::order_dependencies

The keywords a given keyword depends on for evaluation ordering purposes only (not semantic dependencies)

◆ sourcemeta::blaze::SchemaIteratorEntry

struct sourcemeta::blaze::SchemaIteratorEntry

An entry of a schema iterator.

Public Attributes

std::optional< sourcemeta::core::WeakPointer > parent
 
sourcemeta::core::WeakPointer pointer
 
std::string_view dialect
 
Vocabularies vocabularies
 
std::optional< SchemaBaseDialectbase_dialect
 
std::reference_wrapper< const sourcemeta::core::JSON > subschema
 
bool orphan
 
bool property_name
 

◆ sourcemeta::blaze::Vocabularies

struct sourcemeta::blaze::Vocabularies

Optimized vocabulary set using bitflags for known vocabularies and a fallback std::unordered_map for custom vocabularies.

Public Types

enum class  Known : std::uint8_t {
  JSON_Schema_Draft_0 = 0 , JSON_Schema_Draft_0_Hyper = 1 , JSON_Schema_Draft_1 = 2 , JSON_Schema_Draft_1_Hyper = 3 ,
  JSON_Schema_Draft_2 = 4 , JSON_Schema_Draft_2_Hyper = 5 , JSON_Schema_Draft_3 = 6 , JSON_Schema_Draft_3_Hyper = 7 ,
  JSON_Schema_Draft_4 = 8 , JSON_Schema_Draft_4_Hyper = 9 , JSON_Schema_Draft_6 = 10 , JSON_Schema_Draft_6_Hyper = 11 ,
  JSON_Schema_Draft_7 = 12 , JSON_Schema_Draft_7_Hyper = 13 , JSON_Schema_2019_09_Core = 14 , JSON_Schema_2019_09_Applicator = 15 ,
  JSON_Schema_2019_09_Validation = 16 , JSON_Schema_2019_09_Meta_Data = 17 , JSON_Schema_2019_09_Format = 18 , JSON_Schema_2019_09_Content = 19 ,
  JSON_Schema_2019_09_Hyper_Schema = 20 , JSON_Schema_2020_12_Core = 21 , JSON_Schema_2020_12_Applicator = 22 , JSON_Schema_2020_12_Unevaluated = 23 ,
  JSON_Schema_2020_12_Validation = 24 , JSON_Schema_2020_12_Meta_Data = 25 , JSON_Schema_2020_12_Format_Annotation = 26 , JSON_Schema_2020_12_Format_Assertion = 27 ,
  JSON_Schema_2020_12_Content = 28 , OpenAPI_3_1_Base = 29 , OpenAPI_3_2_Base = 30
}
 
using URI = std::variant< Known, sourcemeta::core::JSON::String >
 

Public Member Functions

 Vocabularies (const Vocabularies &)=default
 
 Vocabularies (Vocabularies &&) noexcept=default
 
auto operator= (const Vocabularies &) -> Vocabularies &=default
 
auto operator= (Vocabularies &&) noexcept -> Vocabularies &=default
 
 Vocabularies (std::initializer_list< std::pair< sourcemeta::core::JSON::String, bool > > init)
 Construct from initializer list.
 
 Vocabularies (std::initializer_list< std::pair< Known, bool > > init)
 Construct from initializer list using known vocabulary enums.
 
auto contains (const sourcemeta::core::JSON::String &uri) const noexcept -> bool
 Check if a vocabulary is enabled.
 
auto contains (Known vocabulary) const noexcept -> bool
 Check if a known vocabulary is enabled.
 
auto contains_any (std::initializer_list< Known > vocabularies) const noexcept -> bool
 Check if any of the given known vocabularies are enabled.
 
auto insert (const sourcemeta::core::JSON::String &uri, bool required) noexcept -> void
 Insert a vocabulary with its required/optional status.
 
auto insert (Known vocabulary, bool required) noexcept -> void
 Insert a known vocabulary with its required/optional status.
 
auto get (const sourcemeta::core::JSON::String &uri) const noexcept -> std::optional< bool >
 Get vocabulary status by URI.
 
auto get (Known vocabulary) const noexcept -> std::optional< bool >
 Get known vocabulary status.
 
auto size () const noexcept -> std::size_t
 Get the number of vocabularies (required + optional + custom)
 
auto empty () const noexcept -> bool
 Check if there are no vocabularies.
 
auto has_unknown () const noexcept -> bool
 Check if there are any unknown vocabularies.
 
auto throw_if_any_unsupported (const std::unordered_set< URI > &supported, const char *message) const -> void
 
auto throw_if_any_unknown_required (const char *message) const -> void
 Throw if any unknown vocabulary is required.
 

Static Public Attributes

static constexpr std::size_t KNOWN_VOCABULARY_COUNT = 31
 

Member Typedef Documentation

◆ URI

using sourcemeta::blaze::Vocabularies::URI = std::variant<Known, sourcemeta::core::JSON::String>

A vocabulary URI type that can be either a known vocabulary enum or a custom string URI

Member Function Documentation

◆ throw_if_any_unsupported()

auto sourcemeta::blaze::Vocabularies::throw_if_any_unsupported ( const std::unordered_set< URI > &  supported,
const char message 
) const -> void

Throw if the current vocabularies have required ones outside the given supported set

◆ sourcemeta::blaze::SchemaIterator

class sourcemeta::blaze::SchemaIterator

Return an iterator over the subschemas of a given JSON Schema definition according to the applicators understood by the provided walker function. This walker recursively traverses over every subschema of the JSON Schema definition, including the top-level schema, reporting back each subschema.

For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <iostream>
const sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": {
"type": "array",
"items": {
"type": "string"
}
}
}
})JSON");
for (const auto &entry :
sourcemeta::blaze::SchemaIterator{
document, sourcemeta::blaze::schema_walker,
sourcemeta::blaze::schema_resolver}) {
sourcemeta::core::prettify(
sourcemeta::core::get(document, entry.pointer), std::cout);
std::cout << "\n";
}
Definition foundation_walker.h:57
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto schema_walker(const std::string_view keyword, const Vocabularies &vocabularies) -> const SchemaWalkerResult &
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto schema_resolver(const std::string_view identifier) -> std::optional< sourcemeta::core::JSON >

Public Types

using const_iterator = typename internal::const_iterator
 

Public Member Functions

 SchemaIterator (const sourcemeta::core::JSON &input, const SchemaWalker &walker, const SchemaResolver &resolver, std::string_view default_dialect="")
 
auto begin () const -> const_iterator
 
auto end () const -> const_iterator
 
auto cbegin () const -> const_iterator
 
auto cend () const -> const_iterator
 

◆ sourcemeta::blaze::SchemaIteratorFlat

class sourcemeta::blaze::SchemaIteratorFlat

Return an iterator over the subschemas of a given JSON Schema definition according to the applicators understood by the provided walker function. This walker traverse over the first-level of subschemas of the JSON Schema definition, ignoring the top-level schema and reporting back each subschema.

Note that we don't promise any specific walking ordering.

For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <iostream>
const sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": {
"type": "array",
"items": {
"type": "string"
}
}
}
})JSON");
for (const auto &entry :
sourcemeta::blaze::SchemaIteratorFlat{
document, sourcemeta::blaze::schema_walker,
sourcemeta::blaze::schema_resolver}) {
sourcemeta::core::prettify(
sourcemeta::core::get(document, entry.pointer), std::cout);
std::cout << "\n";
}
Definition foundation_walker.h:123

Public Types

using const_iterator = typename internal::const_iterator
 

Public Member Functions

 SchemaIteratorFlat (const sourcemeta::core::JSON &input, const SchemaWalker &walker, const SchemaResolver &resolver, std::string_view default_dialect="")
 
auto begin () const -> const_iterator
 
auto end () const -> const_iterator
 
auto cbegin () const -> const_iterator
 
auto cend () const -> const_iterator
 

◆ sourcemeta::blaze::SchemaKeywordIterator

class sourcemeta::blaze::SchemaKeywordIterator

Return an iterator over the top-level keywords of a given JSON Schema definition in the order in which an implementation must evaluate them, given the vocabularies in use by the schema.

For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <iostream>
const sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {},
"additionalProperties": true,
"patternProperties": {}
})JSON");
for (const auto &entry :
sourcemeta::blaze::SchemaKeywordIterator{
document, sourcemeta::blaze::schema_walker, vocabularies}) {
sourcemeta::core::stringify(entry.pointer, std::cout);
std::cout << "\n";
}
Definition foundation_walker.h:182
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto vocabularies(const sourcemeta::core::JSON &schema, const SchemaResolver &resolver, std::string_view default_dialect="") -> Vocabularies

Public Types

using const_iterator = typename internal::const_iterator
 

Public Member Functions

 SchemaKeywordIterator (const sourcemeta::core::JSON &input, const SchemaWalker &walker, const Vocabularies &vocabularies)
 
auto begin () const -> const_iterator
 
auto end () const -> const_iterator
 
auto cbegin () const -> const_iterator
 
auto cend () const -> const_iterator
 

Typedef Documentation

◆ SchemaResolver

using sourcemeta::blaze::SchemaResolver = typedef std::function<std::optional<sourcemeta::core::JSON>(std::string_view)>

Some functions need to reference other schemas by their URIs. To accomplish this in a generic and flexible way, these functions take resolver functions as arguments, of the type sourcemeta::blaze::SchemaResolver.

For convenience, we provide the following default resolvers:

You can implement resolvers to read from a local storage, to send HTTP requests, or anything your application might require. Unless your resolver is trivial, it is recommended to create a callable object that implements the function interface.

◆ SchemaWalker

using sourcemeta::blaze::SchemaWalker = typedef std::function<const SchemaWalkerResult &( std::string_view, const Vocabularies &)>

For walking purposes, some functions need to understand which JSON Schema keywords declare other JSON Schema definitions. To accomplish this in a generic and flexible way that does not assume the use any vocabulary other than core, these functions take a walker function as argument.

Enumeration Type Documentation

◆ SchemaBaseDialect

enum class sourcemeta::blaze::SchemaBaseDialect : std::uint8_t
strong

All the known JSON Schema base dialects

◆ SchemaKeywordType

enum class sourcemeta::blaze::SchemaKeywordType : std::uint8_t
strong

Determines the type of a JSON Schema keyword

Enumerator
Unknown 

The JSON Schema keyword is unknown.

Assertion 

The JSON Schema keyword is a non-applicator assertion.

Annotation 

The JSON Schema keyword is a non-applicator annotation.

Reference 

The JSON Schema keyword is a reference.

Other 

The JSON Schema keyword is known but doesn't match any other type.

Comment 

The JSON Schema keyword is considered to be a comment without any additional meaning

LocationMembers 

The JSON Schema keyword is a reserved location that potentially takes an object as argument, whose values are potentially JSON Schema definitions

ApplicatorMembersTraversePropertyStatic 

The JSON Schema keyword is an applicator that potentially takes an object as argument, whose values are potentially JSON Schema definitions. The instance traverses based on the members as property names

ApplicatorMembersTraversePropertyRegex 

The JSON Schema keyword is an applicator that potentially takes an object as argument, whose values are potentially JSON Schema definitions. The instance traverses based on the members as property regular expressions

ApplicatorValueTraverseSomeProperty 

The JSON Schema keyword is an applicator that potentially takes a JSON Schema definition as an argument The instance traverses to some of the properties

ApplicatorValueTraverseAnyPropertyKey 

The JSON Schema keyword is an applicator that potentially takes a JSON Schema definition as an argument The instance traverses to any property key

ApplicatorValueTraverseAnyItem 

The JSON Schema keyword is an applicator that potentially takes a JSON Schema definition as an argument The instance traverses to any item

ApplicatorValueTraverseSomeItem 

The JSON Schema keyword is an applicator that potentially takes a JSON Schema definition as an argument The instance traverses to some of the items

ApplicatorValueTraverseParent 

The JSON Schema keyword is an applicator that potentially takes a JSON Schema definition as an argument The instance traverses back to the parent

ApplicatorElementsTraverseItem 

The JSON Schema keyword is an applicator that potentially takes an array of potentially JSON Schema definitions as an argument The instance traverses based on the element indexes

ApplicatorValueOrElementsTraverseAnyItemOrItem 

The JSON Schema keyword is an applicator that may take a JSON Schema definition or an array of potentially JSON Schema definitions as an argument The instance traverses to any item or based on the element indexes

ApplicatorValueOrElementsInPlace 

The JSON Schema keyword is an applicator that may take a JSON Schema definition or an array of potentially JSON Schema definitions as an argument without affecting the instance location. The instance does not traverse

ApplicatorMembersInPlaceSome 

The JSON Schema keyword is an applicator that potentially takes an object as argument, whose values are potentially JSON Schema definitions without affecting the instance location. The instance does not traverse

ApplicatorElementsInPlace 

The JSON Schema keyword is an applicator that potentially takes an array of potentially JSON Schema definitions as an argument without affecting the instance location. The instance does not traverse

ApplicatorElementsInPlaceSome 

The JSON Schema keyword is an applicator that potentially takes an array of potentially JSON Schema definitions as an argument without affecting the instance location The instance does not traverse, and only some of the elements apply.

ApplicatorElementsInPlaceSomeNegate 

The JSON Schema keyword is an applicator that potentially takes an array of potentially JSON Schema definitions as an argument without affecting the instance location The instance does not traverse, and only some of the elements apply in negated form.

ApplicatorValueInPlaceMaybe 

The JSON Schema keyword is an applicator that potentially takes a JSON Schema definition as an argument without affecting the instance location. The instance does not traverse, and only applies some of the times.

ApplicatorValueInPlaceOther 

The JSON Schema keyword is an applicator that potentially takes a JSON Schema definition as an argument but its evaluation follows special rules. The instance does not traverse

ApplicatorValueInPlaceNegate 

The JSON Schema keyword is an applicator that potentially takes a JSON Schema definition as an argument but the instance is expected to not validate against it. The instance does not traverse

◆ SchemaReferenceType

enum class sourcemeta::blaze::SchemaReferenceType : std::uint8_t
strong

The reference type

Function Documentation

◆ anonymize()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::anonymize ( sourcemeta::core::JSON &  schema,
const SchemaBaseDialect  base_dialect 
) -> void

This function removes the top-level URI identifier of the given schema, if any, given you know its base dialect. It is the caller responsibility to ensure the schema doesn't perform relative references that might have depended on such top-level identifier. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://sourcemeta.com/example-schema"
})JSON");
sourcemeta::blaze::SchemaBaseDialect::JSON_Schema_2020_12);
assert(id.empty());
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto identify(const sourcemeta::core::JSON &schema, const SchemaResolver &resolver, std::string_view default_dialect="", std::string_view default_id="", bool allow_dialect_override=true) -> std::string_view
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto anonymize(sourcemeta::core::JSON &schema, const SchemaBaseDialect base_dialect) -> void

◆ base_dialect()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::base_dialect ( const sourcemeta::core::JSON &  schema,
const SchemaResolver resolver,
std::string_view  default_dialect = "",
bool  allow_dialect_override = true 
) -> std::optional< SchemaBaseDialect >

Get the base dialect that applies to the given schema. If you set a default dialect URI, this will be used if the given schema does not declare the $schema keyword. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
const sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object"
})JSON");
const auto base_dialect{
assert(base_dialect.has_value());
assert(base_dialect.value() ==
sourcemeta::blaze::SchemaBaseDialect::JSON_Schema_2020_12);
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto base_dialect(const sourcemeta::core::JSON &schema, const SchemaResolver &resolver, std::string_view default_dialect="", bool allow_dialect_override=true) -> std::optional< SchemaBaseDialect >

◆ dialect()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::dialect ( const sourcemeta::core::JSON &  schema,
std::string_view  default_dialect = "",
bool  allow_dialect_override = true 
) -> std::string_view

Get the dialect URI that corresponds to a JSON Schema instance. The result is empty if the dialect cannot be determined. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
const sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object"
})JSON");
const auto dialect{sourcemeta::blaze::dialect(document)};
assert(!dialect.empty());
assert(dialect == "https://json-schema.org/draft/2020-12/schema");
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto dialect(const sourcemeta::core::JSON &schema, std::string_view default_dialect="", bool allow_dialect_override=true) -> std::string_view

◆ identify() [1/2]

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::identify ( const sourcemeta::core::JSON &  schema,
const SchemaBaseDialect  base_dialect,
std::string_view  default_id = "" 
) -> std::string_view

A shortcut to sourcemeta::blaze::identify if you know the base dialect of the schema.

◆ identify() [2/2]

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::identify ( const sourcemeta::core::JSON &  schema,
const SchemaResolver resolver,
std::string_view  default_dialect = "",
std::string_view  default_id = "",
bool  allow_dialect_override = true 
) -> std::string_view

This function returns the URI identifier of the given schema, or an empty string view if the schema has no identifier. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
const sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://sourcemeta.com/example-schema"
})JSON");
assert(!id.empty());
assert(id == "https://sourcemeta.com/example-schema");

◆ is_empty_schema()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::is_empty_schema ( const sourcemeta::core::JSON &  schema) -> bool

This function returns true if the given JSON instance is a schema semantically equivalent to the empty schema. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
const sourcemeta::core::JSON document{true};
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto is_empty_schema(const sourcemeta::core::JSON &schema) -> bool

◆ is_known_schema()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::is_known_schema ( const std::string_view  identifier) -> bool
noexcept

Check if a given identifier corresponds to a known built-in schema

◆ is_official_schema()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::is_official_schema ( const std::string_view  identifier) -> bool
noexcept

Check if a given URI corresponds to an official schema released by the JSON Schema organisation

◆ is_schema()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::is_schema ( const sourcemeta::core::JSON &  schema) -> bool

This function returns true if the given JSON instance is of a schema-compatible type: an object or a boolean. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
const sourcemeta::core::JSON document{true};
assert(sourcemeta::blaze::is_schema(document));
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto is_schema(const sourcemeta::core::JSON &schema) -> bool

◆ metaschema()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::metaschema ( const sourcemeta::core::JSON &  schema,
const SchemaResolver resolver,
std::string_view  default_dialect = "" 
) -> sourcemeta::core::JSON

Get the metaschema document that describes the given schema. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <iostream>
const sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object"
})JSON");
const sourcemeta::core::JSON metaschema{
sourcemeta::core::prettify(metaschema, std::cout);
std::cout << std::endl;
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto metaschema(const sourcemeta::core::JSON &schema, const SchemaResolver &resolver, std::string_view default_dialect="") -> sourcemeta::core::JSON

This function will throw if the metaschema cannot be determined or resolved.

◆ metaschema_try_embedded()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::metaschema_try_embedded ( const sourcemeta::core::JSON &  schema,
std::string_view  identifier,
const SchemaResolver resolver 
) -> const sourcemeta::core::JSON *

Try to locate the meta-schema that the given schema declares from within the schema itself, as self-contained schemas embed the meta-schemas they depend on. The result points into the given document and is null if no valid embedded meta-schema could be found. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
const sourcemeta::core::JSON schema =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://example.com/meta",
"$defs": {
"https://example.com/meta": {
"$id": "https://example.com/meta",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object"
}
}
})JSON");
schema, "https://example.com/meta",
assert(metaschema);
assert(metaschema == &schema.at("$defs").at("https://example.com/meta"));
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto metaschema_try_embedded(const sourcemeta::core::JSON &schema, std::string_view identifier, const SchemaResolver &resolver) -> const sourcemeta::core::JSON *

◆ parse_schema_type()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::parse_schema_type ( const sourcemeta::core::JSON &  type) -> sourcemeta::core::JSON::TypeSet

Parse the value of a JSON Schema type keyword (which can be a string or an array of strings) into a set of native JSON types. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
const auto type{sourcemeta::core::parse_json(R"JSON([ "string", "null"
])JSON")}; const auto types{sourcemeta::blaze::parse_schema_type(type)};
assert(types.test(
static_cast<std::size_t>(sourcemeta::core::JSON::Type::String)));
assert(types.test(
static_cast<std::size_t>(sourcemeta::core::JSON::Type::Null)));
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto parse_schema_type(const sourcemeta::core::JSON &type) -> sourcemeta::core::JSON::TypeSet

◆ parse_vocabularies() [1/2]

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::parse_vocabularies ( const sourcemeta::core::JSON &  schema,
const SchemaBaseDialect  base_dialect 
) -> std::optional< Vocabularies >

A shortcut to sourcemeta::blaze::parse_vocabularies when the base dialect is already known.

◆ parse_vocabularies() [2/2]

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::parse_vocabularies ( const sourcemeta::core::JSON &  schema,
const SchemaResolver resolver,
std::string_view  default_dialect = "" 
) -> std::optional< Vocabularies >

Parse the $vocabulary keyword from a given schema, if set. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
const sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/applicator": true
}
})JSON");
const auto result{
assert(result.has_value());
assert(result->size() == 2);
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto parse_vocabularies(const sourcemeta::core::JSON &schema, const SchemaResolver &resolver, std::string_view default_dialect="") -> std::optional< Vocabularies >

◆ reidentify() [1/2]

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::reidentify ( sourcemeta::core::JSON &  schema,
std::string_view  new_identifier,
const SchemaBaseDialect  base_dialect 
) -> void

A shortcut to sourcemeta::blaze::reidentify if you know the base dialect of the schema.

◆ reidentify() [2/2]

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::reidentify ( sourcemeta::core::JSON &  schema,
std::string_view  new_identifier,
const SchemaResolver resolver,
std::string_view  default_dialect = "" 
) -> void

This function sets the identifier of a schema, replacing the existing one, if any. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://sourcemeta.com/example-schema"
})JSON");
"https://example.com/my-new-id",
assert(!id.empty());
assert(id == "https://example.com/my-new-id");
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto reidentify(sourcemeta::core::JSON &schema, std::string_view new_identifier, const SchemaResolver &resolver, std::string_view default_dialect="") -> void

◆ schema_keyword_priority()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::schema_keyword_priority ( const std::string_view  keyword,
const Vocabularies vocabularies,
const SchemaWalker walker 
) -> std::uint64_t

Calculate the priority of a keyword that determines the ordering in which a JSON Schema implementation should evaluate keyword on a subschema. It does so based on the keyword dependencies expressed in the schema walker. The higher the priority, the more the evaluation of such keyword must be delayed.

For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
const sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [ true, true ],
"items": false
})JSON");
const auto vocabularies{
"prefixItems", vocabularies,
// The "items" keyword must be evaluated after the "prefixItems" keyword
"items", vocabularies,
SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto schema_keyword_priority(const std::string_view keyword, const Vocabularies &vocabularies, const SchemaWalker &walker) -> std::uint64_t

◆ schema_resolver()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::schema_resolver ( const std::string_view  identifier) -> std::optional< sourcemeta::core::JSON >

A default resolver that relies on built-in official schemas.

◆ schema_walker()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::schema_walker ( const std::string_view  keyword,
const Vocabularies vocabularies 
) -> const SchemaWalkerResult &

A default schema walker with support for a wide range of drafts

◆ to_base_dialect()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::to_base_dialect ( const std::string_view  base_dialect) -> std::optional< SchemaBaseDialect >

Parse a base dialect URI to its enum representation

◆ to_string()

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::to_string ( const SchemaBaseDialect  base_dialect) -> std::string_view

Stringify a base dialect to its URI

◆ vocabularies() [1/2]

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::vocabularies ( const SchemaResolver resolver,
const SchemaBaseDialect  base_dialect,
std::string_view  dialect 
) -> Vocabularies

A shortcut to sourcemeta::blaze::vocabularies based on the base dialect and dialect URI.

◆ vocabularies() [2/2]

SOURCEMETA_BLAZE_FOUNDATION_EXPORT auto sourcemeta::blaze::vocabularies ( const sourcemeta::core::JSON &  schema,
const SchemaResolver resolver,
std::string_view  default_dialect = "" 
) -> Vocabularies

List the vocabularies that a specific schema makes use of. If you set a default dialect URI, this will be used if the given schema does not declare the $schema keyword. The resulting map values are set to true or false depending on whether the corresponding vocabulary is required or optional, respectively. For example:

#include <sourcemeta/core/json.h>
#include <sourcemeta/blaze/foundation.h>
#include <cassert>
const sourcemeta::core::JSON document =
sourcemeta::core::parse_json(R"JSON({
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object"
})JSON");
const auto vocabularies{
assert(vocabularies.at("https://json-schema.org/draft/2020-12/vocab/core"));
assert(vocabularies.at("https://json-schema.org/draft/2020-12/vocab/applicator"));
assert(vocabularies.at("https://json-schema.org/draft/2020-12/vocab/unevaluated"));
assert(vocabularies.at("https://json-schema.org/draft/2020-12/vocab/validation"));
assert(vocabularies.at("https://json-schema.org/draft/2020-12/vocab/meta-data"));
assert(vocabularies.at("https://json-schema.org/draft/2020-12/vocab/format-annotation"));
assert(vocabularies.at("https://json-schema.org/draft/2020-12/vocab/content"));