1#ifndef SOURCEMETA_CORE_JSONSCHEMA_TYPES_H_
2#define SOURCEMETA_CORE_JSONSCHEMA_TYPES_H_
4#include <sourcemeta/core/json.h>
5#include <sourcemeta/core/jsonpointer.h>
6#include <sourcemeta/core/jsonschema_vocabularies.h>
7#include <sourcemeta/core/memory.h>
19namespace sourcemeta::core {
89SOURCEMETA_CORE_JSONSCHEMA_EXPORT
94#pragma GCC diagnostic push
98#pragma GCC diagnostic ignored "-Wshadow"
206#pragma GCC diagnostic pop
211struct SchemaWalkerResult {
227 SchemaWalkerResult(
const SchemaWalkerResult &) =
delete;
228 auto operator=(
const SchemaWalkerResult &) -> SchemaWalkerResult & =
delete;
231 auto operator=(SchemaWalkerResult &&) -> SchemaWalkerResult & =
default;
232 ~SchemaWalkerResult() =
default;
238 std::optional<SchemaVocabularies::URIView> keyword_vocabulary,
239 std::span<const std::string_view> keyword_dependencies,
240 std::span<const std::string_view> keyword_order_dependencies,
261 constexpr auto parse(std::format_parse_context &context)
262 ->
decltype(context.begin()) {
263 return context.begin();
267 std::format_context &context)
const ->
decltype(context.out()) {
268 std::ostringstream stream;
270 return std::format_to(context.out(),
"{}", stream.str());
std::bitset< 8 > TypeSet
A set of types.
Definition json_value.h:89
std::optional< SchemaVocabularies::URIView > vocabulary
The vocabulary associated with the keyword, if any.
Definition jsonschema_types.h:215
sourcemeta::core::JSON::TypeSet instances
The JSON instance types that this keyword applies to (empty means all).
Definition jsonschema_types.h:223
SchemaKeywordType type
The walker strategy to continue traversing across the schema.
Definition jsonschema_types.h:213
constexpr SchemaWalkerResult(SchemaKeywordType keyword_type, std::optional< SchemaVocabularies::URIView > keyword_vocabulary, std::span< const std::string_view > keyword_dependencies, std::span< const std::string_view > keyword_order_dependencies, sourcemeta::core::JSON::TypeSet keyword_instances)
Definition jsonschema_types.h:236
std::span< const std::string_view > dependencies
Definition jsonschema_types.h:218
SchemaWalkerResult(SchemaWalkerResult &&)=default
Move a walker result.
std::span< const std::string_view > order_dependencies
Definition jsonschema_types.h:221
SchemaReferenceType
Definition jsonschema_types.h:45
SchemaKeywordType
Definition jsonschema_types.h:102
sourcemeta::core::OwnedOrReference< sourcemeta::core::JSON > SchemaResolverResult
Definition jsonschema_types.h:24
std::function< SchemaResolverResult(std::string_view)> SchemaResolver
Definition jsonschema_types.h:41
std::function< const SchemaWalkerResult &( std::string_view, const SchemaVocabularies &)> SchemaWalker
Definition jsonschema_types.h:254
SchemaBaseDialect
Definition jsonschema_types.h:54
@ Static
A reference that resolves at framing time.
Definition jsonschema_types.h:47
@ Dynamic
A reference that resolves at evaluation time.
Definition jsonschema_types.h:49
@ Comment
Definition jsonschema_types.h:115
@ ApplicatorValueTraverseAnyPropertyKey
Definition jsonschema_types.h:139
@ ApplicatorMembersTraversePropertyRegex
Definition jsonschema_types.h:131
@ ApplicatorMembersInPlaceSome
Definition jsonschema_types.h:171
@ ApplicatorValueInPlaceMaybe
Definition jsonschema_types.h:193
@ Assertion
The JSON Schema keyword is a non-applicator assertion.
Definition jsonschema_types.h:106
@ ApplicatorValueTraverseSomeProperty
Definition jsonschema_types.h:135
@ ApplicatorElementsInPlaceSomeNegate
Definition jsonschema_types.h:188
@ Annotation
The JSON Schema keyword is a non-applicator annotation.
Definition jsonschema_types.h:108
@ Other
The JSON Schema keyword is known but doesn't match any other type.
Definition jsonschema_types.h:112
@ Reference
The JSON Schema keyword is a reference.
Definition jsonschema_types.h:110
@ ApplicatorElementsTraverseItem
Definition jsonschema_types.h:156
@ ApplicatorValueTraverseParent
Definition jsonschema_types.h:151
@ ApplicatorElementsInPlace
Definition jsonschema_types.h:176
@ ApplicatorValueOrElementsTraverseAnyItemOrItem
Definition jsonschema_types.h:161
@ Unknown
The JSON Schema keyword is unknown.
Definition jsonschema_types.h:104
@ LocationMembers
Definition jsonschema_types.h:119
@ ApplicatorValueInPlaceOther
Definition jsonschema_types.h:198
@ ApplicatorValueInPlaceNegate
Definition jsonschema_types.h:203
@ ApplicatorValueTraverseSomeItem
Definition jsonschema_types.h:147
@ ApplicatorValueTraverseAnyItem
Definition jsonschema_types.h:143
@ ApplicatorElementsInPlaceSome
Definition jsonschema_types.h:182
@ ApplicatorMembersTraversePropertyStatic
Definition jsonschema_types.h:125
@ ApplicatorValueOrElementsInPlace
Definition jsonschema_types.h:166
@ JSON_SCHEMA_DRAFT_4
The Draft 4 validation base dialect.
Definition jsonschema_types.h:72
@ JSON_SCHEMA_DRAFT_3
The Draft 3 validation base dialect.
Definition jsonschema_types.h:76
@ JSON_SCHEMA_DRAFT_7
The Draft 7 validation base dialect.
Definition jsonschema_types.h:64
@ JSON_SCHEMA_2019_09_HYPER
The 2019-09 hyper-schema base dialect.
Definition jsonschema_types.h:62
@ JSON_SCHEMA_2019_09
The 2019-09 validation base dialect.
Definition jsonschema_types.h:60
@ JSON_SCHEMA_DRAFT_6
The Draft 6 validation base dialect.
Definition jsonschema_types.h:68
@ JSON_SCHEMA_DRAFT_0_HYPER
The Draft 0 hyper-schema base dialect.
Definition jsonschema_types.h:84
@ JSON_SCHEMA_DRAFT_4_HYPER
The Draft 4 hyper-schema base dialect.
Definition jsonschema_types.h:74
@ JSON_SCHEMA_DRAFT_3_HYPER
The Draft 3 hyper-schema base dialect.
Definition jsonschema_types.h:78
@ JSON_SCHEMA_DRAFT_7_HYPER
The Draft 7 hyper-schema base dialect.
Definition jsonschema_types.h:66
@ JSON_SCHEMA_DRAFT_2_HYPER
The Draft 2 hyper-schema base dialect.
Definition jsonschema_types.h:80
@ JSON_SCHEMA_DRAFT_6_HYPER
The Draft 6 hyper-schema base dialect.
Definition jsonschema_types.h:70
@ JSON_SCHEMA_DRAFT_1_HYPER
The Draft 1 hyper-schema base dialect.
Definition jsonschema_types.h:82
@ JSON_SCHEMA_2020_12_HYPER
The 2020-12 hyper-schema base dialect.
Definition jsonschema_types.h:58
@ JSON_SCHEMA_2020_12
The 2020-12 validation base dialect.
Definition jsonschema_types.h:56