Skip to content

Commit 86515ba

Browse files
committed
Merge branch 'main' into modularise-clang-tidy-config
2 parents 4a6e0b2 + d7199d5 commit 86515ba

File tree

126 files changed

+599
-4052
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+599
-4052
lines changed

src/core/json/include/sourcemeta/core/json_auto.h

Lines changed: 268 additions & 39 deletions
Large diffs are not rendered by default.

src/core/json/include/sourcemeta/core/json_object.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ template <typename Key, typename Value, typename Hash> class FlatMap {
4242
FlatMap(std::initializer_list<value_type> entries) {
4343
this->data.reserve(entries.size());
4444
for (auto &&entry : entries) {
45-
this->assign(std::move(entry.first), std::move(entry.second));
45+
this->emplace(std::move(entry.first), std::move(entry.second));
4646
}
4747
}
4848

@@ -55,7 +55,7 @@ template <typename Key, typename Value, typename Hash> class FlatMap {
5555
return this->hasher(key);
5656
}
5757

58-
auto assign(key_type &&key, mapped_type &&value) -> hash_type {
58+
auto emplace(key_type &&key, mapped_type &&value) -> hash_type {
5959
const auto key_hash{this->hash(key)};
6060

6161
if (this->hasher.is_perfect(key_hash)) {
@@ -78,7 +78,7 @@ template <typename Key, typename Value, typename Hash> class FlatMap {
7878
return key_hash;
7979
}
8080

81-
auto assign(const key_type &key, const mapped_type &value) -> hash_type {
81+
auto emplace(const key_type &key, const mapped_type &value) -> hash_type {
8282
const auto key_hash{this->hash(key)};
8383

8484
if (this->hasher.is_perfect(key_hash)) {

src/core/json/json_value.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,12 +801,12 @@ auto JSON::push_back_if_unique(JSON &&value)
801801

802802
auto JSON::assign(const JSON::String &key, const JSON &value) -> void {
803803
assert(this->is_object());
804-
this->data_object.data.assign(key, value);
804+
this->data_object.data.emplace(key, value);
805805
}
806806

807807
auto JSON::assign(const JSON::String &key, JSON &&value) -> void {
808808
assert(this->is_object());
809-
this->data_object.data.assign(key, std::move(value));
809+
this->data_object.data.emplace(key, std::move(value));
810810
}
811811

812812
auto JSON::assign_if_missing(const JSON::String &key, const JSON &value)

src/core/jsonpointer/include/sourcemeta/core/jsonpointer.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <sourcemeta/core/jsonpointer_walker.h>
1818
// NOLINTEND(misc-include-cleaner)
1919

20+
#include <cassert> // assert
2021
#include <functional> // std::reference_wrapper
2122
#include <memory> // std::allocator
2223
#include <ostream> // std::basic_ostream
@@ -582,6 +583,15 @@ auto to_json(const T &value) -> JSON {
582583
return JSON{to_string(value)};
583584
}
584585

586+
/// @ingroup jsonpointer
587+
/// Deserialise a Pointer from JSON
588+
template <typename T>
589+
requires std::is_same_v<T, Pointer>
590+
auto from_json(const JSON &value) -> T {
591+
assert(value.is_string());
592+
return to_pointer(value.to_string());
593+
}
594+
585595
} // namespace sourcemeta::core
586596

587597
#endif

src/core/jsonschema/bundle.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,13 @@ auto bundle(sourcemeta::core::JSON &schema, const SchemaWalker &walker,
183183
vocabularies.contains("http://json-schema.org/draft-03/schema#") ||
184184
vocabularies.contains(
185185
"http://json-schema.org/draft-02/hyper-schema#") ||
186+
vocabularies.contains("http://json-schema.org/draft-02/schema#") ||
186187
vocabularies.contains(
187188
"http://json-schema.org/draft-01/hyper-schema#") ||
189+
vocabularies.contains("http://json-schema.org/draft-01/schema#") ||
188190
vocabularies.contains(
189-
"http://json-schema.org/draft-00/hyper-schema#")) {
191+
"http://json-schema.org/draft-00/hyper-schema#") ||
192+
vocabularies.contains("http://json-schema.org/draft-00/schema#")) {
190193
frame.analyse(schema, walker, resolver, default_dialect);
191194
if (frame.standalone()) {
192195
return;

src/core/jsonschema/jsonschema.cc

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,24 @@ auto sourcemeta::core::vocabularies(const SchemaResolver &resolver,
383383
}
384384

385385
/*
386-
* (1) If the base dialect is pre-vocabularies, then the
386+
* (1) If the dialect is pre-vocabularies, then the
387+
* dialect itself is conceptually the only vocabulary
388+
*/
389+
390+
// This is an exhaustive list of all official dialects in the pre-vocabulary
391+
// world
392+
if (dialect == "http://json-schema.org/draft-07/schema#" ||
393+
dialect == "http://json-schema.org/draft-06/schema#" ||
394+
dialect == "http://json-schema.org/draft-04/schema#" ||
395+
dialect == "http://json-schema.org/draft-03/schema#" ||
396+
dialect == "http://json-schema.org/draft-02/schema#" ||
397+
dialect == "http://json-schema.org/draft-01/schema#" ||
398+
dialect == "http://json-schema.org/draft-00/schema#") {
399+
return {{dialect, true}};
400+
}
401+
402+
/*
403+
* (2) If the base dialect is pre-vocabularies, then the
387404
* base dialect itself is conceptually the only vocabulary
388405
*/
389406

@@ -403,7 +420,7 @@ auto sourcemeta::core::vocabularies(const SchemaResolver &resolver,
403420
}
404421

405422
/*
406-
* (2) If the dialect is vocabulary aware, then fetch such dialect
423+
* (3) If the dialect is vocabulary aware, then fetch such dialect
407424
*/
408425

409426
const std::optional<sourcemeta::core::JSON> maybe_schema_dialect{
@@ -421,7 +438,7 @@ auto sourcemeta::core::vocabularies(const SchemaResolver &resolver,
421438
schema_dialect.at("$id").to_string() == dialect);
422439

423440
/*
424-
* (3) Retrieve the vocabularies explicitly or implicitly declared by the
441+
* (4) Retrieve the vocabularies explicitly or implicitly declared by the
425442
* dialect
426443
*/
427444

src/extension/alterschema/CMakeLists.txt

Lines changed: 1 addition & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -46,98 +46,7 @@ sourcemeta_library(NAMESPACE sourcemeta PROJECT core NAME alterschema
4646
linter/unsatisfiable_min_properties.h
4747
linter/content_media_type_without_encoding.h
4848
linter/content_schema_without_media_type.h
49-
linter/drop_non_array_keywords_applicator_2019_09.h
50-
linter/drop_non_array_keywords_applicator_2020_12.h
51-
linter/drop_non_array_keywords_content_2019_09.h
52-
linter/drop_non_array_keywords_content_2020_12.h
53-
linter/drop_non_array_keywords_draft0.h
54-
linter/drop_non_array_keywords_draft1.h
55-
linter/drop_non_array_keywords_draft2.h
56-
linter/drop_non_array_keywords_draft3.h
57-
linter/drop_non_array_keywords_draft4.h
58-
linter/drop_non_array_keywords_draft6.h
59-
linter/drop_non_array_keywords_draft7.h
60-
linter/drop_non_array_keywords_format_2019_09.h
61-
linter/drop_non_array_keywords_format_2020_12.h
62-
linter/drop_non_array_keywords_unevaluated_2020_12.h
63-
linter/drop_non_array_keywords_validation_2019_09.h
64-
linter/drop_non_array_keywords_validation_2020_12.h
65-
linter/drop_non_boolean_keywords_applicator_2019_09.h
66-
linter/drop_non_boolean_keywords_applicator_2020_12.h
67-
linter/drop_non_boolean_keywords_content_2019_09.h
68-
linter/drop_non_boolean_keywords_content_2020_12.h
69-
linter/drop_non_boolean_keywords_draft0.h
70-
linter/drop_non_boolean_keywords_draft1.h
71-
linter/drop_non_boolean_keywords_draft2.h
72-
linter/drop_non_boolean_keywords_draft3.h
73-
linter/drop_non_boolean_keywords_draft4.h
74-
linter/drop_non_boolean_keywords_draft6.h
75-
linter/drop_non_boolean_keywords_draft7.h
76-
linter/drop_non_boolean_keywords_format_2019_09.h
77-
linter/drop_non_boolean_keywords_format_2020_12.h
78-
linter/drop_non_boolean_keywords_unevaluated_2020_12.h
79-
linter/drop_non_boolean_keywords_validation_2019_09.h
80-
linter/drop_non_boolean_keywords_validation_2020_12.h
81-
linter/drop_non_null_keywords_applicator_2019_09.h
82-
linter/drop_non_null_keywords_applicator_2020_12.h
83-
linter/drop_non_null_keywords_content_2019_09.h
84-
linter/drop_non_null_keywords_content_2020_12.h
85-
linter/drop_non_null_keywords_draft0.h
86-
linter/drop_non_null_keywords_draft1.h
87-
linter/drop_non_null_keywords_draft2.h
88-
linter/drop_non_null_keywords_draft3.h
89-
linter/drop_non_null_keywords_draft4.h
90-
linter/drop_non_null_keywords_draft6.h
91-
linter/drop_non_null_keywords_draft7.h
92-
linter/drop_non_null_keywords_format_2019_09.h
93-
linter/drop_non_null_keywords_format_2020_12.h
94-
linter/drop_non_null_keywords_unevaluated_2020_12.h
95-
linter/drop_non_null_keywords_validation_2019_09.h
96-
linter/drop_non_null_keywords_validation_2020_12.h
97-
linter/drop_non_numeric_keywords_applicator_2019_09.h
98-
linter/drop_non_numeric_keywords_applicator_2020_12.h
99-
linter/drop_non_numeric_keywords_content_2019_09.h
100-
linter/drop_non_numeric_keywords_content_2020_12.h
101-
linter/drop_non_numeric_keywords_draft0.h
102-
linter/drop_non_numeric_keywords_draft1.h
103-
linter/drop_non_numeric_keywords_draft2.h
104-
linter/drop_non_numeric_keywords_draft3.h
105-
linter/drop_non_numeric_keywords_draft4.h
106-
linter/drop_non_numeric_keywords_draft6.h
107-
linter/drop_non_numeric_keywords_draft7.h
108-
linter/drop_non_numeric_keywords_format_2019_09.h
109-
linter/drop_non_numeric_keywords_format_2020_12.h
110-
linter/drop_non_numeric_keywords_unevaluated_2020_12.h
111-
linter/drop_non_numeric_keywords_validation_2019_09.h
112-
linter/drop_non_numeric_keywords_validation_2020_12.h
113-
linter/drop_non_object_keywords_applicator_2019_09.h
114-
linter/drop_non_object_keywords_applicator_2020_12.h
115-
linter/drop_non_object_keywords_content_2019_09.h
116-
linter/drop_non_object_keywords_content_2020_12.h
117-
linter/drop_non_object_keywords_draft0.h
118-
linter/drop_non_object_keywords_draft1.h
119-
linter/drop_non_object_keywords_draft2.h
120-
linter/drop_non_object_keywords_draft3.h
121-
linter/drop_non_object_keywords_draft4.h
122-
linter/drop_non_object_keywords_draft6.h
123-
linter/drop_non_object_keywords_draft7.h
124-
linter/drop_non_object_keywords_format_2019_09.h
125-
linter/drop_non_object_keywords_format_2020_12.h
126-
linter/drop_non_object_keywords_unevaluated_2020_12.h
127-
linter/drop_non_object_keywords_validation_2019_09.h
128-
linter/drop_non_object_keywords_validation_2020_12.h
129-
linter/drop_non_string_keywords_applicator_2019_09.h
130-
linter/drop_non_string_keywords_applicator_2020_12.h
131-
linter/drop_non_string_keywords_draft0.h
132-
linter/drop_non_string_keywords_draft1.h
133-
linter/drop_non_string_keywords_draft2.h
134-
linter/drop_non_string_keywords_draft3.h
135-
linter/drop_non_string_keywords_draft4.h
136-
linter/drop_non_string_keywords_draft6.h
137-
linter/drop_non_string_keywords_draft7.h
138-
linter/drop_non_string_keywords_unevaluated_2020_12.h
139-
linter/drop_non_string_keywords_validation_2019_09.h
140-
linter/drop_non_string_keywords_validation_2020_12.h
49+
linter/non_applicable_type_specific_keywords.h
14150
linter/unnecessary_allof_ref_wrapper.h
14251
linter/duplicate_allof_branches.h
14352
linter/duplicate_anyof_branches.h

0 commit comments

Comments
 (0)