Skip to content

Commit a65f226

Browse files
authored
Emit line/column information for YAML schemas and instances (#529)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 68dc0ed commit a65f226

File tree

12 files changed

+300
-121
lines changed

12 files changed

+300
-121
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 c07e94a997289a701be02b489792fd51e76f8f89
2+
core https://github.com/sourcemeta/core e00d491e5140054956403fed5e8d892cd066ad9d
33
jsonbinpack https://github.com/sourcemeta/jsonbinpack 56dd83ba8483391a694c017ceceafa46cf743259
4-
blaze https://github.com/sourcemeta/blaze 2ab8ee34ee4fe3bc64f1592fbf10edb4645add12
4+
blaze https://github.com/sourcemeta/blaze bd450a8ec5c3e7ca4c32620a9dc4fb8ae05d1606
55
hydra https://github.com/sourcemeta/hydra 38206da873311f0d1fc5f851a9c38838459e89b9

test/inspect/pass_yaml.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cat << 'EOF' > "$TMP/expected.txt"
2222
Type : Static
2323
Root : https://example.com
2424
Pointer :
25-
File Position : <unknown>:<unknown>
25+
File Position : 1:1
2626
Base : https://example.com
2727
Relative Pointer :
2828
Dialect : https://json-schema.org/draft/2020-12/schema
@@ -34,7 +34,7 @@ cat << 'EOF' > "$TMP/expected.txt"
3434
Type : Static
3535
Root : https://example.com
3636
Pointer : /$defs
37-
File Position : <unknown>:<unknown>
37+
File Position : 4:1
3838
Base : https://example.com
3939
Relative Pointer : /$defs
4040
Dialect : https://json-schema.org/draft/2020-12/schema
@@ -45,7 +45,7 @@ cat << 'EOF' > "$TMP/expected.txt"
4545
Type : Static
4646
Root : https://example.com
4747
Pointer : /$defs/string
48-
File Position : <unknown>:<unknown>
48+
File Position : 5:3
4949
Base : https://example.com
5050
Relative Pointer : /$defs/string
5151
Dialect : https://json-schema.org/draft/2020-12/schema
@@ -57,7 +57,7 @@ cat << 'EOF' > "$TMP/expected.txt"
5757
Type : Static
5858
Root : https://example.com
5959
Pointer : /$defs/string/type
60-
File Position : <unknown>:<unknown>
60+
File Position : 5:13
6161
Base : https://example.com
6262
Relative Pointer : /$defs/string/type
6363
Dialect : https://json-schema.org/draft/2020-12/schema
@@ -68,7 +68,7 @@ cat << 'EOF' > "$TMP/expected.txt"
6868
Type : Static
6969
Root : https://example.com
7070
Pointer : /$id
71-
File Position : <unknown>:<unknown>
71+
File Position : 2:1
7272
Base : https://example.com
7373
Relative Pointer : /$id
7474
Dialect : https://json-schema.org/draft/2020-12/schema
@@ -79,7 +79,7 @@ cat << 'EOF' > "$TMP/expected.txt"
7979
Type : Static
8080
Root : https://example.com
8181
Pointer : /$ref
82-
File Position : <unknown>:<unknown>
82+
File Position : 3:1
8383
Base : https://example.com
8484
Relative Pointer : /$ref
8585
Dialect : https://json-schema.org/draft/2020-12/schema
@@ -90,7 +90,7 @@ cat << 'EOF' > "$TMP/expected.txt"
9090
Type : Static
9191
Root : https://example.com
9292
Pointer : /$schema
93-
File Position : <unknown>:<unknown>
93+
File Position : 1:1
9494
Base : https://example.com
9595
Relative Pointer : /$schema
9696
Dialect : https://json-schema.org/draft/2020-12/schema
@@ -99,14 +99,14 @@ cat << 'EOF' > "$TMP/expected.txt"
9999
100100
(REFERENCE) ORIGIN: /$ref
101101
Type : Static
102-
File Position : <unknown>:<unknown>
102+
File Position : 3:1
103103
Destination : https://example.com#/$defs/string
104104
- (w/o fragment) : https://example.com
105105
- (fragment) : /$defs/string
106106
107107
(REFERENCE) ORIGIN: /$schema
108108
Type : Static
109-
File Position : <unknown>:<unknown>
109+
File Position : 1:1
110110
Destination : https://json-schema.org/draft/2020-12/schema
111111
- (w/o fragment) : https://json-schema.org/draft/2020-12/schema
112112
- (fragment) : <NONE>

test/lint/fail_lint_yaml.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cd "$TMP"
1818
test "$CODE" = "1" || exit 1
1919

2020
cat << EOF > "$TMP/expected.txt"
21-
schema.yaml:<unknown>:<unknown>:
21+
schema.yaml:3:1:
2222
Setting \`type\` alongside \`enum\` is considered an anti-pattern, as the enumeration choices already imply their respective types (enum_with_type)
2323
at location "/enum"
2424
EOF

test/metaschema/fail_yaml.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ cat << EOF > "$TMP/expected.txt"
1919
fail: $(realpath "$TMP")/schema.yaml
2020
error: Schema validation failure
2121
The integer value was expected to validate against at least one of the 2 given subschemas
22-
at instance location "/type"
22+
at instance location "/type" (line 2, column 1)
2323
at evaluate path "/properties/type/anyOf"
2424
The object value was expected to validate against the 33 defined properties subschemas
25-
at instance location ""
25+
at instance location "" (line 1, column 1)
2626
at evaluate path "/properties"
2727
EOF
2828

test/validate/fail_yaml.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ cat << EOF > "$TMP/expected.txt"
2727
fail: $(realpath "$TMP")/instance.yaml
2828
error: Schema validation failure
2929
The value was expected to be of type string but it was of type integer
30-
at instance location "/foo"
30+
at instance location "/foo" (line 1, column 1)
3131
at evaluate path "/properties/foo/type"
3232
The object value was expected to validate against the single defined property subschema
33-
at instance location ""
33+
at instance location "" (line 1, column 1)
3434
at evaluate path "/properties"
3535
EOF
3636

vendor/blaze/src/compiler/compile.cc

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

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

Lines changed: 11 additions & 6 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.h

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/jsonschema.cc

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

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

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

0 commit comments

Comments
 (0)