Skip to content

Commit

Permalink
Make use of JSON Schema validation from the new Blaze project
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti committed Oct 16, 2024
1 parent 57559ab commit 0a54167
Show file tree
Hide file tree
Showing 403 changed files with 22,645 additions and 15,628 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ option(JSONSCHEMA_CONTINUOUS "Perform a continuous JSON Schema CLI release" ON)

find_package(JSONToolkit REQUIRED)
find_package(AlterSchema REQUIRED)
find_package(Blaze REQUIRED)
find_package(JSONBinPack REQUIRED)
find_package(Hydra REQUIRED)
add_subdirectory(src)
Expand Down
11 changes: 6 additions & 5 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
vendorpull https://github.com/sourcemeta/vendorpull dea311b5bfb53b6926a4140267959ae334d3ecf4
noa https://github.com/sourcemeta/noa 517e88aef5981b88ac6bb8caff15d17dffcb4320
jsontoolkit https://github.com/sourcemeta/jsontoolkit 9abbaee71e9e00e95632858d29c7ebe5c2a723b0
hydra https://github.com/sourcemeta/hydra 3c53d3fdef79e9ba603d48470a508cc45472a0dc
alterschema https://github.com/sourcemeta/alterschema 358df64771979da64e043a416cf340d83a5382ca
jsonbinpack https://github.com/sourcemeta/jsonbinpack b25d54363f5a88cd23c1af41e4c6025b9c94d0d6
noa https://github.com/sourcemeta/noa 837e1ff981f8df45d9e2977a50f5da61d8affed4
jsontoolkit https://github.com/sourcemeta/jsontoolkit 9685d29e2e633d71319c64b1ab2fbceab865dbf3
hydra https://github.com/sourcemeta/hydra c0d2f53dc52d8febd3092ce873847729b9f447fb
alterschema https://github.com/sourcemeta/alterschema 36dc1933bbbdbf1f2574c309e41f510f58874838
jsonbinpack https://github.com/sourcemeta/jsonbinpack b09b7948f90a9e9c30a2c38441f44d1c4b93b45a
blaze https://github.com/sourcemeta/blaze 43cac42dc486be24addbc2cd0aa646d18e2000f5
5 changes: 5 additions & 0 deletions cmake/FindBlaze.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if(NOT Blaze_FOUND)
set(BLAZE_INSTALL OFF CACHE BOOL "disable installation")
add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/blaze")
set(Blaze_FOUND ON)
endif()
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ target_link_libraries(jsonschema_cli PRIVATE sourcemeta::alterschema::linter)
target_link_libraries(jsonschema_cli PRIVATE sourcemeta::hydra::httpclient)
target_link_libraries(jsonschema_cli PRIVATE sourcemeta::jsonbinpack::compiler)
target_link_libraries(jsonschema_cli PRIVATE sourcemeta::jsonbinpack::runtime)
target_link_libraries(jsonschema_cli PRIVATE sourcemeta::blaze::compiler)
target_link_libraries(jsonschema_cli PRIVATE sourcemeta::blaze::evaluator)

configure_file(configure.h.in configure.h @ONLY)
target_include_directories(jsonschema_cli PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
Expand Down
3 changes: 1 addition & 2 deletions src/command_frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ auto sourcemeta::jsonschema::cli::frame(
sourcemeta::jsontoolkit::ReferenceMap references;
sourcemeta::jsontoolkit::frame(schema, frame, references,
sourcemeta::jsontoolkit::default_schema_walker,
resolver(options))
.wait();
resolver(options));

const auto output_json = options.contains("json") || options.contains("j");
if (output_json) {
Expand Down
5 changes: 2 additions & 3 deletions src/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ auto parse_options(const std::span<const std::string> &arguments,
return options;
}

auto print(
const sourcemeta::jsontoolkit::SchemaCompilerErrorTraceOutput &output,
std::ostream &stream) -> void {
auto print(const sourcemeta::blaze::ErrorTraceOutput &output,
std::ostream &stream) -> void {
stream << "error: Schema validation failure\n";
for (const auto &entry : output) {
stream << " " << entry.message << "\n";
Expand Down
7 changes: 4 additions & 3 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <sourcemeta/jsontoolkit/jsonpointer.h>
#include <sourcemeta/jsontoolkit/jsonschema.h>

#include <sourcemeta/blaze/compiler.h>

#include <filesystem> // std::filesystem
#include <map> // std::map
#include <ostream> // std::ostream
Expand All @@ -27,9 +29,8 @@ auto for_each_json(const std::vector<std::string> &arguments,
-> std::vector<
std::pair<std::filesystem::path, sourcemeta::jsontoolkit::JSON>>;

auto print(
const sourcemeta::jsontoolkit::SchemaCompilerErrorTraceOutput &output,
std::ostream &stream) -> void;
auto print(const sourcemeta::blaze::ErrorTraceOutput &output,
std::ostream &stream) -> void;

auto resolver(const std::map<std::string, std::vector<std::string>> &options,
const bool remote = false)
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.

98 changes: 98 additions & 0 deletions vendor/blaze/CMakeLists.txt

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

Loading

0 comments on commit 0a54167

Please sign in to comment.