@@ -291,7 +291,9 @@ static auto fallback_resolver(
291
291
}
292
292
293
293
auto resolver (const std::map<std::string, std::vector<std::string>> &options,
294
- const bool remote) -> sourcemeta::core::SchemaResolver {
294
+ const bool remote,
295
+ const std::optional<std::string> &default_dialect)
296
+ -> sourcemeta::core::SchemaResolver {
295
297
sourcemeta::core::SchemaMapResolver dynamic_resolver{
296
298
[remote, &options](std::string_view identifier) {
297
299
if (remote) {
@@ -307,7 +309,7 @@ auto resolver(const std::map<std::string, std::vector<std::string>> &options,
307
309
parse_extensions (options))) {
308
310
log_verbose (options) << " Importing schema into the resolution context: "
309
311
<< entry.first .string () << " \n " ;
310
- dynamic_resolver.add (entry.second );
312
+ dynamic_resolver.add (entry.second , default_dialect );
311
313
}
312
314
}
313
315
@@ -317,7 +319,7 @@ auto resolver(const std::map<std::string, std::vector<std::string>> &options,
317
319
parse_extensions (options))) {
318
320
log_verbose (options) << " Importing schema into the resolution context: "
319
321
<< entry.first .string () << " \n " ;
320
- dynamic_resolver.add (entry.second );
322
+ dynamic_resolver.add (entry.second , default_dialect );
321
323
}
322
324
}
323
325
@@ -393,4 +395,19 @@ auto safe_weakly_canonical(const std::filesystem::path &input)
393
395
: std::filesystem::weakly_canonical (input);
394
396
}
395
397
398
+ auto default_dialect (
399
+ const std::map<std::string, std::vector<std::string>> &options)
400
+ -> std::optional<std::string> {
401
+
402
+ if (options.contains (" default-dialect" )) {
403
+ return options.at (" default-dialect" ).front ();
404
+ }
405
+
406
+ if (options.contains (" d" )) {
407
+ return options.at (" d" ).front ();
408
+ }
409
+
410
+ return std::nullopt;
411
+ }
412
+
396
413
} // namespace sourcemeta::jsonschema::cli
0 commit comments