From a3a4cd2d566c60cdba99a18f30b0b00ea23ace27 Mon Sep 17 00:00:00 2001 From: Patrick Boettcher Date: Tue, 4 Jul 2017 17:39:50 +0200 Subject: [PATCH] schema-test: simplify filename resolution of test-suite --- app/json-schema-test.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/json-schema-test.cpp b/app/json-schema-test.cpp index ddd8e03..3c76dec 100644 --- a/app/json-schema-test.cpp +++ b/app/json-schema-test.cpp @@ -60,19 +60,15 @@ static void format_check(const std::string &format, const std::string &value) static void loader(const json_uri &uri, json &schema) { - std::map external_schemas = - { - {"http://localhost:1234/integer.json", JSON_SCHEMA_TEST_SUITE_PATH "/remotes/integer.json"}, - {"http://localhost:1234/subSchemas.json", JSON_SCHEMA_TEST_SUITE_PATH "/remotes/subSchemas.json"}, - {"http://localhost:1234/folder/folderInteger.json", JSON_SCHEMA_TEST_SUITE_PATH "/remotes/folder/folderInteger.json"}, - }; - if (uri.to_string() == "http://json-schema.org/draft-04/schema#") { schema = nlohmann::json_schema_draft4::draft4_schema_builtin; return; } - std::string fn = external_schemas[uri.url()]; + std::string fn = JSON_SCHEMA_TEST_SUITE_PATH; + fn += "/remotes"; + fn += uri.path(); + std::cerr << fn << "\n"; std::fstream s(fn.c_str()); if (!s.good())