1#ifndef SOURCEMETA_CORE_JSONSCHEMA_ERROR_H
2#define SOURCEMETA_CORE_JSONSCHEMA_ERROR_H
4#ifndef SOURCEMETA_CORE_JSONSCHEMA_EXPORT
5#include <sourcemeta/core/jsonschema_export.h>
8#include <sourcemeta/core/error.h>
9#include <sourcemeta/core/jsonpointer.h>
15namespace sourcemeta::core {
17SOURCEMETA_CORE_ERROR_WARNINGS_PUSH
39 [[nodiscard]]
auto identifier() const noexcept -> std::string_view {
40 return this->identifier_;
44 std::string identifier_;
57 "according to the JSON Schema specification",
70 [[nodiscard]]
auto uri() const noexcept -> std::string_view {
87 schema_location_{std::move(schema_location)} {}
90 [[nodiscard]]
auto identifier() const noexcept -> std::string_view {
91 return this->identifier_;
97 -> const sourcemeta::core::
Pointer & {
98 return this->schema_location_;
102 std::string identifier_;
108class SOURCEMETA_CORE_JSONSCHEMA_EXPORT SchemaUnknownDialectError
111 SchemaUnknownDialectError() noexcept
112 :
Error{
"Could not determine the dialect of the schema"} {}
118class SOURCEMETA_CORE_JSONSCHEMA_EXPORT SchemaUnknownBaseDialectError
121 SchemaUnknownBaseDialectError() noexcept
122 :
Error{
"Could not determine the base dialect of the schema"} {}
133 :
Error{
"A schema with a top-level `$ref` in JSON Schema Draft 7 and "
134 "older dialects ignores every sibling keywords (like "
135 "identifiers and meta-schema declarations) and therefore many "
136 "operations, like bundling, are not possible without undefined "
141 [[nodiscard]]
auto identifier() const noexcept -> std::string_view {
142 return this->identifier_;
146 std::string identifier_;
160 const std::string_view
dialect,
162 :
Error{
"The dialect that this schema declares does not define the "
163 "keyword that declares it"},
165 schema_location_{std::move(schema_location)} {}
168 [[nodiscard]]
auto keyword() const noexcept -> std::string_view {
169 return this->keyword_;
173 [[nodiscard]]
auto dialect() const noexcept -> std::string_view {
174 return this->dialect_;
180 -> const sourcemeta::core::
Pointer & {
181 return this->schema_location_;
185 std::string keyword_;
186 std::string dialect_;
196 const std::string_view
value)
200 [[nodiscard]]
auto value() const noexcept -> std::string_view {
205 [[nodiscard]]
auto keyword() const noexcept -> std::string_view {
206 return this->keyword_;
210 std::string keyword_;
227 -> const sourcemeta::core::
Pointer & {
228 return this->location_;
245 [[nodiscard]]
auto identifier() const noexcept -> std::string_view {
246 return this->identifier_;
250 std::string identifier_;
260 :
Error{
"The schema exceeds the maximum number of frame locations"},
264 [[nodiscard]]
auto limit() const noexcept -> std::uint64_t {
269 std::uint64_t limit_;
285 [[nodiscard]]
auto identifier() const noexcept -> std::string_view {
286 return this->identifier_;
292 -> const sourcemeta::core::
Pointer & {
293 return this->location_;
297 [[nodiscard]]
auto other() const noexcept
298 -> const sourcemeta::core::
Pointer & {
303 std::string identifier_;
308SOURCEMETA_CORE_ERROR_WARNINGS_POP
auto message() const noexcept -> StaticString
Definition error_base.h:78
Error(const StaticString message) noexcept
Construct the error given its message.
Definition error_base.h:84
GenericPointer< JSON::String, PropertyHashJSON< JSON::String > > Pointer
Definition jsonpointer.h:41
auto uri() const noexcept -> std::string_view
The vocabulary that caused the error.
Definition jsonschema_error.h:70
SchemaKeywordError(const StaticString message, const std::string_view keyword, const std::string_view value)
Create a keyword error.
Definition jsonschema_error.h:195
auto limit() const noexcept -> std::uint64_t
The maximum number of locations that framing was allowed to register.
Definition jsonschema_error.h:264
SchemaResolutionError(const StaticString message, const std::string_view identifier)
Create a schema resolution error.
Definition jsonschema_error.h:34
SchemaFrameLimitError(const std::uint64_t limit) noexcept
Create a framing limit error.
Definition jsonschema_error.h:259
auto identifier() const noexcept -> std::string_view
The anchor that collided.
Definition jsonschema_error.h:285
SchemaRelativeMetaschemaResolutionError(const std::string_view identifier)
Create a relative meta-schema resolution error.
Definition jsonschema_error.h:55
SchemaVocabularyError(const StaticString message, const std::string_view uri)
Create a vocabulary error.
Definition jsonschema_error.h:66
auto keyword() const noexcept -> std::string_view
The keyword that caused the error.
Definition jsonschema_error.h:205
auto value() const noexcept -> std::string_view
The value that caused the error.
Definition jsonschema_error.h:200
SchemaError(const StaticString message) noexcept
Create a general schema error.
Definition jsonschema_error.h:24
SchemaReferenceError(const StaticString message, const std::string_view identifier, sourcemeta::core::Pointer schema_location)
Create a reference error.
Definition jsonschema_error.h:83
SchemaReferenceObjectResourceError(const std::string_view identifier)
Create a reference object resource error.
Definition jsonschema_error.h:132
auto keyword() const noexcept -> std::string_view
The keyword that names the dialect.
Definition jsonschema_error.h:168
auto identifier() const noexcept -> std::string_view
The reference that caused the error.
Definition jsonschema_error.h:141
auto location() const noexcept -> const sourcemeta::core::Pointer &
Definition jsonschema_error.h:291
auto identifier() const noexcept -> std::string_view
The identifier of the schema that caused the error.
Definition jsonschema_error.h:245
auto location() const noexcept -> const sourcemeta::core::Pointer &
Definition jsonschema_error.h:96
auto location() const noexcept -> const sourcemeta::core::Pointer &
Definition jsonschema_error.h:226
auto dialect() const noexcept -> std::string_view
The dialect that the schema names.
Definition jsonschema_error.h:173
auto location() const noexcept -> const sourcemeta::core::Pointer &
Definition jsonschema_error.h:179
auto other() const noexcept -> const sourcemeta::core::Pointer &
The other place that declares the same anchor.
Definition jsonschema_error.h:297
SchemaFrameError(const StaticString message, const std::string_view identifier)
Create a framing error.
Definition jsonschema_error.h:240
auto identifier() const noexcept -> std::string_view
The identifier that could not be resolved.
Definition jsonschema_error.h:39
SchemaDialectImpossibleError(const std::string_view keyword, const std::string_view dialect, sourcemeta::core::Pointer schema_location)
Create a dialect impossibility error.
Definition jsonschema_error.h:159
SchemaContainerError(const StaticString message, sourcemeta::core::Pointer location)
Create a container error.
Definition jsonschema_error.h:220
auto identifier() const noexcept -> std::string_view
The reference that caused the error.
Definition jsonschema_error.h:90
SchemaAnchorCollisionError(const std::string_view identifier, sourcemeta::core::Pointer location, sourcemeta::core::Pointer other)
Create an anchor collision error.
Definition jsonschema_error.h:278
Definition text_static_string.h:20