-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathpass_default_dialect_config_relative.sh
More file actions
executable file
·111 lines (95 loc) · 3.38 KB
/
pass_default_dialect_config_relative.sh
File metadata and controls
executable file
·111 lines (95 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh
set -o errexit
set -o nounset
TMP="$(mktemp -d)"
clean() { rm -rf "$TMP"; }
trap clean EXIT
cat << 'EOF' > "$TMP/schema.json"
{
"$id": "https://example.com",
"$ref": "#/$defs/string",
"$defs": {
"string": { "type": "string" }
}
}
EOF
cat << 'EOF' > "$TMP/jsonschema.json"
{
"defaultDialect": "https://json-schema.org/draft/2020-12/schema"
}
EOF
cd "$TMP"
"$1" inspect schema.json --verbose > "$TMP/result.txt" 2> "$TMP/output.txt"
cat << 'EOF' > "$TMP/expected.txt"
(RESOURCE) URI: https://example.com
Type : Static
Root : https://example.com
Pointer :
File Position : 1:1
Base : https://example.com
Relative Pointer :
Dialect : https://json-schema.org/draft/2020-12/schema
Base Dialect : https://json-schema.org/draft/2020-12/schema
Parent : <NONE>
(POINTER) URI: https://example.com#/$defs
Type : Static
Root : https://example.com
Pointer : /$defs
File Position : 4:3
Base : https://example.com
Relative Pointer : /$defs
Dialect : https://json-schema.org/draft/2020-12/schema
Base Dialect : https://json-schema.org/draft/2020-12/schema
Parent :
(SUBSCHEMA) URI: https://example.com#/$defs/string
Type : Static
Root : https://example.com
Pointer : /$defs/string
File Position : 5:5
Base : https://example.com
Relative Pointer : /$defs/string
Dialect : https://json-schema.org/draft/2020-12/schema
Base Dialect : https://json-schema.org/draft/2020-12/schema
Parent :
(POINTER) URI: https://example.com#/$defs/string/type
Type : Static
Root : https://example.com
Pointer : /$defs/string/type
File Position : 5:17
Base : https://example.com
Relative Pointer : /$defs/string/type
Dialect : https://json-schema.org/draft/2020-12/schema
Base Dialect : https://json-schema.org/draft/2020-12/schema
Parent : /$defs/string
(POINTER) URI: https://example.com#/$id
Type : Static
Root : https://example.com
Pointer : /$id
File Position : 2:3
Base : https://example.com
Relative Pointer : /$id
Dialect : https://json-schema.org/draft/2020-12/schema
Base Dialect : https://json-schema.org/draft/2020-12/schema
Parent :
(POINTER) URI: https://example.com#/$ref
Type : Static
Root : https://example.com
Pointer : /$ref
File Position : 3:3
Base : https://example.com
Relative Pointer : /$ref
Dialect : https://json-schema.org/draft/2020-12/schema
Base Dialect : https://json-schema.org/draft/2020-12/schema
Parent :
(REFERENCE) ORIGIN: /$ref
Type : Static
File Position : 3:3
Destination : https://example.com#/$defs/string
- (w/o fragment) : https://example.com
- (fragment) : /$defs/string
EOF
diff "$TMP/result.txt" "$TMP/expected.txt"
cat << EOF > "$TMP/expected_log.txt"
Using configuration file: $(realpath "$TMP")/jsonschema.json
EOF
diff "$TMP/output.txt" "$TMP/expected_log.txt"