Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade JSON Toolkit and AlterSchema #861

Merged
merged 1 commit into from
Oct 15, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
CXX: ${{ matrix.platform.cxx }}
steps:
- name: Install ClangFormat
run: pip install clang-format==19.1.0
run: pipx install clang-format==19.1.0

- uses: actions/checkout@v3
- name: Install dependencies (macOS)
Expand Down
6 changes: 3 additions & 3 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vendorpull https://github.com/sourcemeta/vendorpull 70342aaf458e6cb80baeb5b718901075fc42ede6
jsontoolkit https://github.com/sourcemeta/jsontoolkit 9abbaee71e9e00e95632858d29c7ebe5c2a723b0
alterschema https://github.com/sourcemeta/alterschema 358df64771979da64e043a416cf340d83a5382ca
jsontoolkit https://github.com/sourcemeta/jsontoolkit 9685d29e2e633d71319c64b1ab2fbceab865dbf3
alterschema https://github.com/sourcemeta/alterschema 36dc1933bbbdbf1f2574c309e41f510f58874838
googletest https://github.com/google/googletest 987e225614755fec7253aa95bf959c09e0d380d7
bootstrap https://github.com/twbs/bootstrap 1a6fdfae6be09b09eaced8f0e442ca6f7680a61e
noa https://github.com/sourcemeta/noa 517e88aef5981b88ac6bb8caff15d17dffcb4320
noa https://github.com/sourcemeta/noa 837e1ff981f8df45d9e2977a50f5da61d8affed4
13 changes: 4 additions & 9 deletions src/compiler/encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,26 @@
#include <sourcemeta/jsontoolkit/json.h>
#include <sourcemeta/jsontoolkit/jsonschema.h>

#include <future> // std::future

namespace sourcemeta::jsonbinpack {

constexpr auto ENCODING_V1{"tag:sourcemeta.com,2024:jsonbinpack/encoding/v1"};

inline auto
make_resolver(const sourcemeta::jsontoolkit::SchemaResolver &fallback) -> auto {
return [&fallback](std::string_view identifier)
-> std::future<std::optional<sourcemeta::jsontoolkit::JSON>> {
std::promise<std::optional<sourcemeta::jsontoolkit::JSON>> promise;
-> std::optional<sourcemeta::jsontoolkit::JSON> {
if (identifier == ENCODING_V1) {
promise.set_value(sourcemeta::jsontoolkit::parse(R"JSON({
return sourcemeta::jsontoolkit::parse(R"JSON({
"$id": "tag:sourcemeta.com,2024:jsonbinpack/encoding/v1",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/core": true,
"tag:sourcemeta.com,2024:jsonbinpack/encoding/v1": true
}
})JSON"));
})JSON");
} else {
promise.set_value(fallback(identifier).get());
return fallback(identifier);
}

return promise.get_future();
};
}

Expand Down
13 changes: 4 additions & 9 deletions test/compiler/canonicalizer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,19 @@
#include <sourcemeta/jsontoolkit/json.h>
#include <sourcemeta/jsontoolkit/jsonschema.h>

#include <future> // std::promise, std::future
#include <optional> // std::optional
#include <string> // std::string

static auto test_resolver(std::string_view identifier)
-> std::future<std::optional<sourcemeta::jsontoolkit::JSON>> {
std::promise<std::optional<sourcemeta::jsontoolkit::JSON>> promise;
-> std::optional<sourcemeta::jsontoolkit::JSON> {
if (identifier == "https://jsonbinpack.sourcemeta.com/draft/unknown") {
promise.set_value(sourcemeta::jsontoolkit::parse(R"JSON({
return sourcemeta::jsontoolkit::parse(R"JSON({
"$schema": "https://jsonbinpack.sourcemeta.com/draft/unknown",
"$id": "https://jsonbinpack.sourcemeta.com/draft/unknown"
})JSON"));
})JSON");
} else {
promise.set_value(
sourcemeta::jsontoolkit::official_resolver(identifier).get());
return sourcemeta::jsontoolkit::official_resolver(identifier);
}

return promise.get_future();
}

TEST(JSONBinPack_Canonicalizer, unsupported_draft) {
Expand Down
12 changes: 6 additions & 6 deletions vendor/alterschema/src/engine/rule.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 23 additions & 1 deletion vendor/alterschema/vendor/noa/cmake/noa/compiler/options.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 30 additions & 6 deletions vendor/alterschema/vendor/noa/cmake/noa/library.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 5 additions & 17 deletions vendor/jsontoolkit/CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/jsontoolkit/cmake/FindGoogleBenchmark.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 62 additions & 6 deletions vendor/jsontoolkit/cmake/FindUriParser.cmake

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading