@@ -389,6 +389,28 @@ auto properties_as_loop(const Context &context,
389389 }));
390390}
391391
392+ auto draft3_any_type_instructions (const Context &context,
393+ const SchemaContext &schema_context,
394+ const DynamicContext &dynamic_context)
395+ -> Instructions {
396+ if (context.mode != Mode::Exhaustive) {
397+ return {};
398+ }
399+
400+ using sourcemeta::core::JSON;
401+ ValueTypes types{};
402+ types.set (std::to_underlying (JSON::Type::Null));
403+ types.set (std::to_underlying (JSON::Type::Boolean));
404+ types.set (std::to_underlying (JSON::Type::Object));
405+ types.set (std::to_underlying (JSON::Type::Array));
406+ types.set (std::to_underlying (JSON::Type::Integer));
407+ types.set (std::to_underlying (JSON::Type::Real));
408+ types.set (std::to_underlying (JSON::Type::Decimal));
409+ types.set (std::to_underlying (JSON::Type::String));
410+ return {make (sourcemeta::blaze::InstructionIndex::AssertionTypeStrictAny,
411+ context, schema_context, dynamic_context, types)};
412+ }
413+
392414auto draft3_set_type_bits (const std::string &name, ValueTypes &types) -> bool {
393415 using sourcemeta::core::JSON;
394416 if (name == " null" ) {
@@ -1857,21 +1879,29 @@ auto compiler_draft3_validation_type(const Context &context,
18571879
18581880 if (is_draft3) {
18591881 if (value.is_string () && value.to_string () == " any" ) {
1860- return {};
1882+ return draft3_any_type_instructions (context, schema_context,
1883+ dynamic_context);
18611884 }
18621885
18631886 if (value.is_array ()) {
18641887 bool has_object{false };
18651888 for (const auto &element : value.as_array ()) {
18661889 if (element.is_string () && element.to_string () == " any" ) {
1867- return {};
1890+ return draft3_any_type_instructions (context, schema_context,
1891+ dynamic_context);
18681892 }
18691893 if (element.is_object ()) {
18701894 has_object = true ;
18711895 }
18721896 }
18731897
18741898 if (has_object) {
1899+ if (context.mode == Mode::FastValidation && value.size () == 1 ) {
1900+ return compile (
1901+ context, schema_context, dynamic_context,
1902+ {static_cast <sourcemeta::core::Pointer::Token::Index>(0 )});
1903+ }
1904+
18751905 Instructions disjunctors;
18761906 for (std::uint64_t index = 0 ; index < value.size (); index++) {
18771907 const auto &element{value.at (index)};
@@ -2167,7 +2197,11 @@ auto compiler_draft3_validation_type(const Context &context,
21672197 }
21682198 }
21692199
2170- assert (types.any ());
2200+ if (!types.any ()) {
2201+ return {make (sourcemeta::blaze::InstructionIndex::AssertionFail, context,
2202+ schema_context, dynamic_context, ValueNone{})};
2203+ }
2204+
21712205 return {make (sourcemeta::blaze::InstructionIndex::AssertionTypeStrictAny,
21722206 context, schema_context, dynamic_context, types)};
21732207 }
0 commit comments