Skip to content

Commit 84f6e36

Browse files
authored
Lint property names that are not code-generation friendly (#588)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent c6bef13 commit 84f6e36

File tree

16 files changed

+251
-114
lines changed

16 files changed

+251
-114
lines changed

DEPENDENCIES

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
vendorpull https://github.com/sourcemeta/vendorpull 1dcbac42809cf87cb5b045106b863e17ad84ba02
2-
core https://github.com/sourcemeta/core 44adbe95771afdd1d4188d35e6b3bd9c323d8dca
3-
jsonbinpack https://github.com/sourcemeta/jsonbinpack 6cef045cf3ef69b779477d60950e5dd8d8796e62
2+
core https://github.com/sourcemeta/core e4d7ae9358710fc138d2afd3179db6d850e4190f
3+
jsonbinpack https://github.com/sourcemeta/jsonbinpack 8fae212dc7ec02af4bb0cd4e7fccd42a2471f1c1
44
blaze https://github.com/sourcemeta/blaze cd5ebdb49d7d5fac151f7ed89810908d22198e42
55
hydra https://github.com/sourcemeta/hydra af9f2c54709d620872ead0c3f8f683c15a0fa702

src/command_canonicalize.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ auto sourcemeta::jsonschema::canonicalize(
4444
sourcemeta::core::SchemaTransformer canonicalizer;
4545
sourcemeta::core::add(canonicalizer,
4646
sourcemeta::core::AlterSchemaMode::Canonicalizer);
47-
canonicalizer.apply(schema, sourcemeta::core::schema_walker,
48-
custom_resolver, transformer_callback_noop, dialect);
47+
[[maybe_unused]] const auto result = canonicalizer.apply(
48+
schema, sourcemeta::core::schema_walker, custom_resolver,
49+
transformer_callback_noop, dialect);
50+
assert(result.first);
4951

5052
sourcemeta::core::format(schema, sourcemeta::core::schema_walker,
5153
custom_resolver, dialect);

test/lint/pass_lint_list_exclude.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ property_names_type_default
157157
required_properties_in_properties
158158
Every property listed in the `required` keyword must be explicitly defined using the `properties` keyword
159159
160+
simple_properties_identifiers
161+
Set `properties` to identifier names that can be easily mapped to programming languages (matching [A-Za-z_][A-Za-z0-9_]*)
162+
160163
single_type_array
161164
Setting `type` to an array of a single type is the same as directly declaring such type
162165
@@ -211,7 +214,7 @@ unsatisfiable_max_contains
211214
unsatisfiable_min_properties
212215
Setting `minProperties` to a number less than `required` does not add any further constraint
213216
214-
Number of rules: 67
217+
Number of rules: 68
215218
EOF
216219

217220
diff "$TMP/output.txt" "$TMP/expected.txt"

test/lint/pass_lint_list_long.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ property_names_type_default
163163
required_properties_in_properties
164164
Every property listed in the `required` keyword must be explicitly defined using the `properties` keyword
165165
166+
simple_properties_identifiers
167+
Set `properties` to identifier names that can be easily mapped to programming languages (matching [A-Za-z_][A-Za-z0-9_]*)
168+
166169
single_type_array
167170
Setting `type` to an array of a single type is the same as directly declaring such type
168171
@@ -217,7 +220,7 @@ unsatisfiable_max_contains
217220
unsatisfiable_min_properties
218221
Setting `minProperties` to a number less than `required` does not add any further constraint
219222
220-
Number of rules: 69
223+
Number of rules: 70
221224
EOF
222225

223226
diff "$TMP/output.txt" "$TMP/expected.txt"

test/lint/pass_lint_list_short.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ property_names_type_default
163163
required_properties_in_properties
164164
Every property listed in the `required` keyword must be explicitly defined using the `properties` keyword
165165
166+
simple_properties_identifiers
167+
Set `properties` to identifier names that can be easily mapped to programming languages (matching [A-Za-z_][A-Za-z0-9_]*)
168+
166169
single_type_array
167170
Setting `type` to an array of a single type is the same as directly declaring such type
168171
@@ -217,7 +220,7 @@ unsatisfiable_max_contains
217220
unsatisfiable_min_properties
218221
Setting `minProperties` to a number less than `required` does not add any further constraint
219222
220-
Number of rules: 69
223+
Number of rules: 70
221224
EOF
222225

223226
diff "$TMP/output.txt" "$TMP/expected.txt"

vendor/core/config.cmake.in

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

vendor/core/src/core/jsonschema/include/sourcemeta/core/jsonschema_transform.h

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

vendor/core/src/core/jsonschema/include/sourcemeta/core/jsonschema_types.h

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

vendor/core/src/core/jsonschema/jsonschema.cc

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

vendor/core/src/core/jsonschema/known_walker.cc

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

0 commit comments

Comments
 (0)