Skip to content

Commit 584229a

Browse files
authored
Upgrade JSON Toolkit to 2e2d2042fe3cb7e7066d29847859d889b2ccab6a (#326)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent f3243ba commit 584229a

File tree

15 files changed

+324
-260
lines changed

15 files changed

+324
-260
lines changed

DEPENDENCIES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
vendorpull https://github.com/sourcemeta/vendorpull dea311b5bfb53b6926a4140267959ae334d3ecf4
22
noa https://github.com/sourcemeta/noa 99f8b42d5f1a8b0f9b3c024f5957dc399bc0262f
3-
jsontoolkit https://github.com/sourcemeta/jsontoolkit 2fc390f4a4e568691aea62cd85bae94c5d81494d
3+
jsontoolkit https://github.com/sourcemeta/jsontoolkit 2e2d2042fe3cb7e7066d29847859d889b2ccab6a
44
googletest https://github.com/google/googletest a7f443b80b105f940225332ed3c31f2790092f47
55
googlebenchmark https://github.com/google/benchmark 378fe693a1ef51500db21b11ff05a8018c5f0e55
66
jsonschema-test-suite https://github.com/json-schema-org/JSON-Schema-Test-Suite c2badb1298a8698f86dadf1aea7b44b3a894e5ac

src/compiler/compile.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ auto precompile(
6363
const sourcemeta::blaze::Context &context,
6464
sourcemeta::blaze::SchemaContext &schema_context,
6565
const sourcemeta::blaze::DynamicContext &dynamic_context,
66-
const sourcemeta::jsontoolkit::ReferenceFrame::value_type &entry)
66+
const sourcemeta::jsontoolkit::FrameLocations::value_type &entry)
6767
-> sourcemeta::blaze::Instructions {
6868
const sourcemeta::jsontoolkit::URI anchor_uri{entry.first.second};
6969
const auto label{sourcemeta::blaze::Evaluator{}.hash(
@@ -115,8 +115,8 @@ auto compile(const sourcemeta::jsontoolkit::JSON &schema,
115115
default_dialect)};
116116

117117
// Perform framing to resolve references later on
118-
sourcemeta::jsontoolkit::ReferenceFrame frame;
119-
sourcemeta::jsontoolkit::ReferenceMap references;
118+
sourcemeta::jsontoolkit::FrameLocations frame;
119+
sourcemeta::jsontoolkit::FrameReferences references;
120120
sourcemeta::jsontoolkit::frame(result, frame, references, walker, resolver,
121121
default_dialect);
122122

@@ -232,7 +232,7 @@ auto compile(const sourcemeta::jsontoolkit::JSON &schema,
232232
std::vector<std::string> resources;
233233
for (const auto &entry : frame) {
234234
if (entry.second.type ==
235-
sourcemeta::jsontoolkit::ReferenceEntryType::Resource) {
235+
sourcemeta::jsontoolkit::FrameLocationType::Resource) {
236236
resources.push_back(entry.first.second);
237237
}
238238
}
@@ -246,6 +246,7 @@ auto compile(const sourcemeta::jsontoolkit::JSON &schema,
246246
std::set<std::string>(resources.cbegin(), resources.cend()).size());
247247

248248
// Calculate the top static reference destinations for precompilation purposes
249+
// TODO: Replace this logic with `.frame()` `destination_of` information
249250
std::map<std::string, std::size_t> static_references_count;
250251
for (const auto &reference : references) {
251252
if (reference.first.first !=
@@ -316,7 +317,7 @@ auto compile(const sourcemeta::jsontoolkit::JSON &schema,
316317
for (const auto &entry : frame) {
317318
// We are only trying to find dynamic anchors
318319
if (entry.second.type !=
319-
sourcemeta::jsontoolkit::ReferenceEntryType::Anchor ||
320+
sourcemeta::jsontoolkit::FrameLocationType::Anchor ||
320321
entry.first.first !=
321322
sourcemeta::jsontoolkit::ReferenceType::Dynamic) {
322323
continue;

src/compiler/compile_helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ unsigned_integer_property(const sourcemeta::jsontoolkit::JSON &document,
113113

114114
inline auto static_frame_entry(const Context &context,
115115
const SchemaContext &schema_context)
116-
-> const sourcemeta::jsontoolkit::ReferenceFrameEntry & {
116+
-> const sourcemeta::jsontoolkit::FrameLocationsEntry & {
117117
const auto type{sourcemeta::jsontoolkit::ReferenceType::Static};
118118
const auto current{
119119
to_uri(schema_context.relative_pointer, schema_context.base).recompose()};

src/compiler/default_compiler_draft4.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ auto compiler_draft4_core_ref(const Context &context,
184184
auto new_schema_context{schema_context};
185185
new_schema_context.references.insert(reference.destination);
186186

187+
// TODO: Replace this logic with `.frame()` `destination_of` information
187188
std::size_t direct_children_references{0};
188189
if (context.frame.contains({type, reference.destination})) {
189190
for (const auto &reference_entry : context.references) {
@@ -197,6 +198,9 @@ auto compiler_draft4_core_ref(const Context &context,
197198
// If the reference is not a recursive one, we can avoid the extra
198199
// overhead of marking the location for future jumps, and pretty much
199200
// just expand the reference destination in place.
201+
// TODO: Elevate the calculation required to detect recursive references
202+
// to JSON Toolkit's `.frame()`
203+
// See: https://github.com/sourcemeta/jsontoolkit/issues/1394
200204
const bool is_recursive{
201205
// This means the reference is directly recursive, by jumping to
202206
// a parent of the reference itself.

src/compiler/include/sourcemeta/blaze/compiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ struct Context {
8888
/// The root schema resource
8989
const sourcemeta::jsontoolkit::JSON &root;
9090
/// The reference frame of the entire schema
91-
const sourcemeta::jsontoolkit::ReferenceFrame &frame;
91+
const sourcemeta::jsontoolkit::FrameLocations &frame;
9292
/// The references of the entire schema
93-
const sourcemeta::jsontoolkit::ReferenceMap &references;
93+
const sourcemeta::jsontoolkit::FrameReferences &references;
9494
/// The set of all schema resources in the schema without duplicates
9595
const std::vector<std::string> resources;
9696
/// The schema walker in use

vendor/jsontoolkit/src/jsonschema/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/jsontoolkit/src/jsonschema/bundle.cc

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)