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

Format JSON Schemas by reordering keywords into a canonical order. More...

Functions

SOURCEMETA_BLAZE_FORMAT_EXPORT auto sourcemeta::blaze::format (sourcemeta::core::JSON &schema, const SchemaWalker &walker, const SchemaResolver &resolver, std::string_view default_dialect="") -> void
 

Detailed Description

Format JSON Schemas by reordering keywords into a canonical order.

This functionality is included as follows:

#include <sourcemeta/blaze/format.h>

Function Documentation

◆ format()

SOURCEMETA_BLAZE_FORMAT_EXPORT auto sourcemeta::blaze::format ( sourcemeta::core::JSON &  schema,
const SchemaWalker walker,
const SchemaResolver resolver,
std::string_view  default_dialect = "" 
) -> void

Format a JSON Schema document by reordering all object properties throughout the entire document according to an opinionated JSON Schema aware ordering. This function modifies the schema in-place. For example:

#include <sourcemeta/blaze/format.h>
#include <sourcemeta/blaze/foundation.h>
#include <sourcemeta/core/json.h>
#include <iostream>
#include <sstream>
sourcemeta::core::JSON schema =
sourcemeta::core::parse_json(
"{ \"type\": \"string\", \"minLength\": 3 }");
std::ostringstream stream;
sourcemeta::core::prettify(schema, stream);
std::cout << stream.str() << std::endl;
SOURCEMETA_BLAZE_FORMAT_EXPORT auto format(sourcemeta::core::JSON &schema, const SchemaWalker &walker, const SchemaResolver &resolver, std::string_view default_dialect="") -> void
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 >