Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/compiler/default_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ auto sourcemeta::blaze::default_schema_compiler(
Known::JSON_Schema_2020_12_Validation,
Known::JSON_Schema_2020_12_Meta_Data,
Known::JSON_Schema_2020_12_Format_Annotation,
Known::JSON_Schema_2020_12_Format_Assertion,
Known::JSON_Schema_2020_12_Content,
Known::JSON_Schema_2019_09_Core,
Known::JSON_Schema_2019_09_Applicator,
Expand Down Expand Up @@ -113,6 +114,8 @@ auto sourcemeta::blaze::default_schema_compiler(
compiler_2019_09_content_contentschema);
COMPILE(Known::JSON_Schema_2020_12_Format_Annotation, "format",
compiler_draft3_validation_format);
COMPILE(Known::JSON_Schema_2020_12_Format_Assertion, "format",
compiler_draft3_validation_format);

// Same as Draft 7

Expand Down
12 changes: 5 additions & 7 deletions src/compiler/default_compiler_draft3.h
Original file line number Diff line number Diff line change
Expand Up @@ -2451,8 +2451,12 @@ auto compiler_draft3_validation_format(const Context &context,
schema_context.vocabularies.contains(Known::JSON_Schema_2019_09_Format)};
const auto is_2020_12_format_annotation{schema_context.vocabularies.contains(
Known::JSON_Schema_2020_12_Format_Annotation)};
const auto is_2020_12_format_assertion{schema_context.vocabularies.contains(
Known::JSON_Schema_2020_12_Format_Assertion)};

if (is_2019_09_format && context.tweaks.format_assertion) {
if ((is_2019_09_format && context.tweaks.format_assertion) ||
is_2020_12_format_assertion ||
(is_2020_12_format_annotation && context.tweaks.format_assertion)) {
Comment thread
jviotti marked this conversation as resolved.
const auto &format{schema_context.schema.at(dynamic_context.keyword)};
if (!format.is_string()) {
return {};
Expand Down Expand Up @@ -2522,12 +2526,6 @@ auto compiler_draft3_validation_format(const Context &context,
}

if (is_2019_09_format || is_2020_12_format_annotation) {
if (context.tweaks.format_assertion) {
throw sourcemeta::blaze::CompilerError(
schema_context.base, to_pointer(schema_context.relative_pointer),
unsupported_dialect_message);
}

if (context.mode == Mode::FastValidation) {
return {};
}
Expand Down
2 changes: 1 addition & 1 deletion test/alterschema/alterschema_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static auto alterschema_test_resolver(std::string_view identifier)
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/validation": true,
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
"https://json-schema.org/draft/2020-12/vocab/format-assertion": true
"https://example.com/vocab/unsupported-fictional": true
}
})JSON");
} else {
Expand Down
Loading
Loading