From 82d920244178995d4d71b7b7e12bb9177ae8a7fe Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Fri, 16 Jan 2026 14:36:44 -0400 Subject: [PATCH] Fix broken default dialect behavior Signed-off-by: Juan Cruz Viotti --- src/ir/ir.cc | 8 ++++---- test/ir/ir_2020_12_test.cc | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/ir/ir.cc b/src/ir/ir.cc index 9510c31..86ffee3 100644 --- a/src/ir/ir.cc +++ b/src/ir/ir.cc @@ -28,10 +28,10 @@ auto compile(const sourcemeta::core::JSON &input, sourcemeta::core::SchemaTransformer canonicalizer; sourcemeta::core::add(canonicalizer, sourcemeta::core::AlterSchemaMode::Canonicalizer); - [[maybe_unused]] const auto canonicalized{ - canonicalizer.apply(schema, walker, resolver, - [](const auto &, const auto, const auto, - const auto &) { assert(false); })}; + [[maybe_unused]] const auto canonicalized{canonicalizer.apply( + schema, walker, resolver, + [](const auto &, const auto, const auto, const auto &) { assert(false); }, + default_dialect, default_id)}; assert(canonicalized.first); // -------------------------------------------------------------------------- diff --git a/test/ir/ir_2020_12_test.cc b/test/ir/ir_2020_12_test.cc index 6454aaf..81c1b75 100644 --- a/test/ir/ir_2020_12_test.cc +++ b/test/ir/ir_2020_12_test.cc @@ -23,6 +23,24 @@ TEST(IR_2020_12, test_1) { EXPECT_SYMBOL(std::get(result.at(0)).symbol); } +TEST(IR_2020_12, default_dialect_parameter) { + const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({ + "type": "string" + })JSON")}; + + const auto result{sourcemeta::codegen::compile( + schema, sourcemeta::core::schema_walker, + sourcemeta::core::schema_resolver, sourcemeta::codegen::default_compiler, + "https://json-schema.org/draft/2020-12/schema")}; + + using namespace sourcemeta::codegen; + + EXPECT_EQ(result.size(), 1); + + EXPECT_IR_SCALAR(result, 0, String, ""); + EXPECT_SYMBOL(std::get(result.at(0)).symbol); +} + TEST(IR_2020_12, test_2) { const sourcemeta::core::JSON schema{sourcemeta::core::parse_json(R"JSON({ "$schema": "https://json-schema.org/draft/2020-12/schema",