-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Juan Cruz Viotti <[email protected]>
- Loading branch information
Showing
13 changed files
with
298 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
vendorpull https://github.com/sourcemeta/vendorpull dea311b5bfb53b6926a4140267959ae334d3ecf4 | ||
noa https://github.com/sourcemeta/noa 7e26abce7a4e31e86a16ef2851702a56773ca527 | ||
jsontoolkit https://github.com/sourcemeta/jsontoolkit 6c78f131029c647be79cc5da5874fa8d50415cde | ||
jsontoolkit https://github.com/sourcemeta/jsontoolkit a0aafd3f62c03514db9b71b1c89f2ed69669b130 | ||
googletest https://github.com/google/googletest a7f443b80b105f940225332ed3c31f2790092f47 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class DuplicateAllOfBranches final : public Rule { | ||
public: | ||
DuplicateAllOfBranches() | ||
: Rule{"duplicate_allof_branches", | ||
"Setting duplicate subschemas in `allOf` is redundant, as it " | ||
"produces " | ||
"unnecessary additional validation that is guaranteed to not " | ||
"affect the validation result"} {}; | ||
|
||
[[nodiscard]] auto | ||
condition(const sourcemeta::jsontoolkit::JSON &schema, const std::string &, | ||
const std::set<std::string> &vocabularies, | ||
const sourcemeta::jsontoolkit::Pointer &) const -> bool override { | ||
return contains_any( | ||
vocabularies, | ||
{"https://json-schema.org/draft/2020-12/vocab/applicator", | ||
"https://json-schema.org/draft/2019-09/vocab/applicator", | ||
"http://json-schema.org/draft-07/schema#", | ||
"http://json-schema.org/draft-06/schema#", | ||
"http://json-schema.org/draft-04/schema#"}) && | ||
schema.is_object() && schema.defines("allOf") && | ||
schema.at("allOf").is_array() && !schema.at("allOf").unique(); | ||
} | ||
|
||
auto transform(Transformer &transformer) const -> void override { | ||
auto collection = transformer.schema().at("allOf"); | ||
std::sort(collection.as_array().begin(), collection.as_array().end()); | ||
auto last = | ||
std::unique(collection.as_array().begin(), collection.as_array().end()); | ||
collection.erase(last, collection.as_array().end()); | ||
transformer.replace({"allOf"}, std::move(collection)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class DuplicateAnyOfBranches final : public Rule { | ||
public: | ||
DuplicateAnyOfBranches() | ||
: Rule{"duplicate_anyof_branches", | ||
"Setting duplicate subschemas in `anyOf` is redundant, as it " | ||
"produces " | ||
"unnecessary additional validation that is guaranteed to not " | ||
"affect the validation result"} {}; | ||
|
||
[[nodiscard]] auto | ||
condition(const sourcemeta::jsontoolkit::JSON &schema, const std::string &, | ||
const std::set<std::string> &vocabularies, | ||
const sourcemeta::jsontoolkit::Pointer &) const -> bool override { | ||
return contains_any( | ||
vocabularies, | ||
{"https://json-schema.org/draft/2020-12/vocab/applicator", | ||
"https://json-schema.org/draft/2019-09/vocab/applicator", | ||
"http://json-schema.org/draft-07/schema#", | ||
"http://json-schema.org/draft-06/schema#", | ||
"http://json-schema.org/draft-04/schema#"}) && | ||
schema.is_object() && schema.defines("anyOf") && | ||
schema.at("anyOf").is_array() && !schema.at("anyOf").unique(); | ||
} | ||
|
||
auto transform(Transformer &transformer) const -> void override { | ||
auto collection = transformer.schema().at("anyOf"); | ||
std::sort(collection.as_array().begin(), collection.as_array().end()); | ||
auto last = | ||
std::unique(collection.as_array().begin(), collection.as_array().end()); | ||
collection.erase(last, collection.as_array().end()); | ||
transformer.replace({"anyOf"}, std::move(collection)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 19 additions & 1 deletion
20
vendor/jsontoolkit/src/json/include/sourcemeta/jsontoolkit/json_object.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
vendor/jsontoolkit/src/jsonschema/include/sourcemeta/jsontoolkit/jsonschema_error.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.