teptris 0.3.21.0-powerpc64le-linux → 0.3.23.0-powerpc64le-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/teptris_ext/engine/README.md +1 -1
- data/ext/teptris_ext/engine/src/include/teptris/schema.h +7 -0
- data/ext/teptris_ext/engine/src/include/teptris/version.h +2 -2
- data/ext/teptris_ext/engine/src/teptris/schema/formats.c +34 -0
- data/ext/teptris_ext/engine/src/teptris/schema/json_read.c +5 -2
- data/ext/teptris_ext/engine/src/teptris/schema/metaschemas.c +243 -0
- data/ext/teptris_ext/engine/src/teptris/schema/metaschemas.h +15 -0
- data/ext/teptris_ext/engine/src/teptris/schema/refs.c +243 -0
- data/ext/teptris_ext/engine/src/teptris/schema/refs.h +24 -0
- data/ext/teptris_ext/engine/src/teptris/schema/schema.c +903 -55
- data/ext/teptris_ext/engine/src/teptris/schema/schema_internal.h +92 -3
- data/ext/teptris_ext/engine/src/teptris/schema/validate.c +463 -48
- data/lib/teptris/3.3/teptris_ext.so +0 -0
- data/lib/teptris/3.4/teptris_ext.so +0 -0
- data/lib/teptris/4.0/teptris_ext.so +0 -0
- data/lib/teptris/version.rb +1 -1
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32fdcd4af59d32f2e0b6b90e1f4d8df16d2e5b86ab92dc3998e6888dc2c059dd
|
|
4
|
+
data.tar.gz: 864d2c81f622a34f0e42eeca7f772c4f532212cd637df81bc2a092232cdd2d54
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b0a817984901eede4fd7df994cd7697837a1439811b4e3e3048d6bbab89575999cc117b705886b18a53abdf9e7abaf4fd1e21550e96b3337ee9888ce3aa1b209
|
|
7
|
+
data.tar.gz: adee07dc2ffd5bad5d61377b92f33bd7a153d973a4b1e94bb5ac9cb359e94b4ffe739de325d2ab6b130bf3bdba6555ccf1768d697282ac14f08c9647174e7d70
|
|
@@ -74,6 +74,13 @@ typedef struct teptris_schema teptris_schema;
|
|
|
74
74
|
* {"error": "...", "path": "..."} locating the problem; free it with
|
|
75
75
|
* teptris_diag_free. Either out or diag_buf may be NULL if the caller
|
|
76
76
|
* does not want it. */
|
|
77
|
+
/* compile with a base directory: relative $refs and $ids in the
|
|
78
|
+
* schema resolve against files under it (local files only - the
|
|
79
|
+
* library never touches the network). compile() is compile_ex(NULL). */
|
|
80
|
+
TEPTRIS_API teptris_status teptris_schema_compile_ex(
|
|
81
|
+
const char *json, size_t len, const char *base_dir, size_t base_len,
|
|
82
|
+
struct teptris_schema **out, char **diag_buf, size_t *diag_len);
|
|
83
|
+
|
|
77
84
|
TEPTRIS_API teptris_status teptris_schema_compile(const char *json, size_t len,
|
|
78
85
|
teptris_schema **out,
|
|
79
86
|
char **diag_buf,
|
|
@@ -611,6 +611,24 @@ bool sch_format_string_check(int format, const char *s, size_t len,
|
|
|
611
611
|
switch (format) {
|
|
612
612
|
case FMT_DATE: return check_date(s, len);
|
|
613
613
|
case FMT_DATETIME: return check_datetime(s, len);
|
|
614
|
+
case FMT_DATETIME_LOCAL: {
|
|
615
|
+
/* the local shape: full-date T HH:MM:SS[.frac], no offset */
|
|
616
|
+
if (len < 19 || !check_date(s, 10)) return false;
|
|
617
|
+
if (s[10] != 'T' && s[10] != 't') return false;
|
|
618
|
+
size_t used = check_hms(s + 11, len - 11);
|
|
619
|
+
if (used == 0) return false;
|
|
620
|
+
size_t pos = 11 + used;
|
|
621
|
+
if (pos < len && s[pos] == '.') {
|
|
622
|
+
size_t frac = 0;
|
|
623
|
+
pos++;
|
|
624
|
+
while (pos < len && is_digit(s[pos])) {
|
|
625
|
+
pos++;
|
|
626
|
+
frac++;
|
|
627
|
+
}
|
|
628
|
+
if (frac == 0) return false;
|
|
629
|
+
}
|
|
630
|
+
return pos == len;
|
|
631
|
+
}
|
|
614
632
|
case FMT_TIME: {
|
|
615
633
|
size_t used = check_hms(s, len);
|
|
616
634
|
if (used == 0) return false;
|
|
@@ -626,6 +644,22 @@ bool sch_format_string_check(int format, const char *s, size_t len,
|
|
|
626
644
|
}
|
|
627
645
|
return len > pos && check_offset(s + pos, len - pos) == len - pos;
|
|
628
646
|
}
|
|
647
|
+
case FMT_TIME_LOCAL: {
|
|
648
|
+
/* HH:MM:SS[.frac] with no offset (TOML's local time) */
|
|
649
|
+
size_t used = check_hms(s, len);
|
|
650
|
+
if (used == 0) return false;
|
|
651
|
+
size_t pos = used;
|
|
652
|
+
if (pos < len && s[pos] == '.') {
|
|
653
|
+
size_t frac = 0;
|
|
654
|
+
pos++;
|
|
655
|
+
while (pos < len && is_digit(s[pos])) {
|
|
656
|
+
pos++;
|
|
657
|
+
frac++;
|
|
658
|
+
}
|
|
659
|
+
if (frac == 0) return false;
|
|
660
|
+
}
|
|
661
|
+
return pos == len;
|
|
662
|
+
}
|
|
629
663
|
case FMT_EMAIL:
|
|
630
664
|
case FMT_IDN_EMAIL: return check_email(s, len);
|
|
631
665
|
case FMT_HOSTNAME:
|
|
@@ -185,10 +185,13 @@ static const char *jstring(jctx *c, size_t *out_len) {
|
|
|
185
185
|
c->pos++; /* closing quote */
|
|
186
186
|
return s;
|
|
187
187
|
}
|
|
188
|
-
/* escaped string: rebuild into arena memory
|
|
188
|
+
/* escaped string: rebuild into arena memory, carrying the plain
|
|
189
|
+
* prefix the fast scan already stepped over */
|
|
190
|
+
size_t plain_len = c->pos - start;
|
|
189
191
|
size_t cap = (c->pos - start) * 4 + 16;
|
|
190
192
|
char *out = teptris_arena_alloc(c->a, cap);
|
|
191
|
-
size_t n =
|
|
193
|
+
size_t n = plain_len;
|
|
194
|
+
memcpy(out, c->src + start, plain_len);
|
|
192
195
|
for (;;) {
|
|
193
196
|
if (c->pos >= c->len) {
|
|
194
197
|
jfail(c, "unterminated string");
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/* The official JSON Schema metaschemas, vendored as built-in
|
|
2
|
+
* resources: a parser library never touches the network, but the
|
|
3
|
+
* metaschemas are part of the dialect itself. Provenance: the
|
|
4
|
+
* published drafts (draft-07, 2019-09, 2020-12) as shipped by the
|
|
5
|
+
* jsonschema crate v0.60.2 vendored copy; regenerated by
|
|
6
|
+
* scripts/gen_metaschemas.py - edit the script, not this file. */
|
|
7
|
+
#include "metaschemas.h"
|
|
8
|
+
|
|
9
|
+
const struct teptris_builtin_resource teptris_builtin_resources[] = {
|
|
10
|
+
{"http://json-schema.org/draft-07/schema",
|
|
11
|
+
"{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"$id\":\"http://json-schema.org/draft-07/schema#\",\"title\":"
|
|
12
|
+
"\"Core schema meta-schema\",\"definitions\":{\"schemaArray\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#"
|
|
13
|
+
"\"}},\"nonNegativeInteger\":{\"type\":\"integer\",\"minimum\":0},\"nonNegativeIntegerDefault0\":{\"allOf\":[{\"$ref\":\""
|
|
14
|
+
"#/definitions/nonNegativeInteger\"},{\"default\":0}]},\"simpleTypes\":{\"enum\":[\"array\",\"boolean\",\"integer\",\"nul"
|
|
15
|
+
"l\",\"number\",\"object\",\"string\"]},\"stringArray\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems"
|
|
16
|
+
"\":true,\"default\":[]}},\"type\":[\"object\",\"boolean\"],\"properties\":{\"$id\":{\"type\":\"string\",\"format\":\"uri"
|
|
17
|
+
"-reference\"},\"$schema\":{\"type\":\"string\",\"format\":\"uri\"},\"$ref\":{\"type\":\"string\",\"format\":\"uri-refere"
|
|
18
|
+
"nce\"},\"$comment\":{\"type\":\"string\"},\"title\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"defaul"
|
|
19
|
+
"t\":true,\"readOnly\":{\"type\":\"boolean\",\"default\":false},\"writeOnly\":{\"type\":\"boolean\",\"default\":false},\""
|
|
20
|
+
"examples\":{\"type\":\"array\",\"items\":true},\"multipleOf\":{\"type\":\"number\",\"exclusiveMinimum\":0},\"maximum\":{"
|
|
21
|
+
"\"type\":\"number\"},\"exclusiveMaximum\":{\"type\":\"number\"},\"minimum\":{\"type\":\"number\"},\"exclusiveMinimum\":{"
|
|
22
|
+
"\"type\":\"number\"},\"maxLength\":{\"$ref\":\"#/definitions/nonNegativeInteger\"},\"minLength\":{\"$ref\":\"#/definitio"
|
|
23
|
+
"ns/nonNegativeIntegerDefault0\"},\"pattern\":{\"type\":\"string\",\"format\":\"regex\"},\"additionalItems\":{\"$ref\":\""
|
|
24
|
+
"#\"},\"items\":{\"anyOf\":[{\"$ref\":\"#\"},{\"$ref\":\"#/definitions/schemaArray\"}],\"default\":true},\"maxItems\":{\""
|
|
25
|
+
"$ref\":\"#/definitions/nonNegativeInteger\"},\"minItems\":{\"$ref\":\"#/definitions/nonNegativeIntegerDefault0\"},\"uniq"
|
|
26
|
+
"ueItems\":{\"type\":\"boolean\",\"default\":false},\"contains\":{\"$ref\":\"#\"},\"maxProperties\":{\"$ref\":\"#/definit"
|
|
27
|
+
"ions/nonNegativeInteger\"},\"minProperties\":{\"$ref\":\"#/definitions/nonNegativeIntegerDefault0\"},\"required\":{\"$re"
|
|
28
|
+
"f\":\"#/definitions/stringArray\"},\"additionalProperties\":{\"$ref\":\"#\"},\"definitions\":{\"type\":\"object\",\"addi"
|
|
29
|
+
"tionalProperties\":{\"$ref\":\"#\"},\"default\":{}},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref"
|
|
30
|
+
"\":\"#\"},\"default\":{}},\"patternProperties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#\"},\"propert"
|
|
31
|
+
"yNames\":{\"format\":\"regex\"},\"default\":{}},\"dependencies\":{\"type\":\"object\",\"additionalProperties\":{\"anyOf"
|
|
32
|
+
"\":[{\"$ref\":\"#\"},{\"$ref\":\"#/definitions/stringArray\"}]}},\"propertyNames\":{\"$ref\":\"#\"},\"const\":true,\"enu"
|
|
33
|
+
"m\":{\"type\":\"array\",\"items\":true},\"type\":{\"anyOf\":[{\"$ref\":\"#/definitions/simpleTypes\"},{\"type\":\"array"
|
|
34
|
+
"\",\"items\":{\"$ref\":\"#/definitions/simpleTypes\"},\"minItems\":1,\"uniqueItems\":true}]},\"format\":{\"type\":\"stri"
|
|
35
|
+
"ng\"},\"contentMediaType\":{\"type\":\"string\"},\"contentEncoding\":{\"type\":\"string\"},\"if\":{\"$ref\":\"#\"},\"the"
|
|
36
|
+
"n\":{\"$ref\":\"#\"},\"else\":{\"$ref\":\"#\"},\"allOf\":{\"$ref\":\"#/definitions/schemaArray\"},\"anyOf\":{\"$ref\":\""
|
|
37
|
+
"#/definitions/schemaArray\"},\"oneOf\":{\"$ref\":\"#/definitions/schemaArray\"},\"not\":{\"$ref\":\"#\"}},\"default\":tr"
|
|
38
|
+
"ue}"
|
|
39
|
+
},
|
|
40
|
+
{"https://json-schema.org/draft-07/schema",
|
|
41
|
+
"{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"$id\":\"http://json-schema.org/draft-07/schema#\",\"title\":"
|
|
42
|
+
"\"Core schema meta-schema\",\"definitions\":{\"schemaArray\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#"
|
|
43
|
+
"\"}},\"nonNegativeInteger\":{\"type\":\"integer\",\"minimum\":0},\"nonNegativeIntegerDefault0\":{\"allOf\":[{\"$ref\":\""
|
|
44
|
+
"#/definitions/nonNegativeInteger\"},{\"default\":0}]},\"simpleTypes\":{\"enum\":[\"array\",\"boolean\",\"integer\",\"nul"
|
|
45
|
+
"l\",\"number\",\"object\",\"string\"]},\"stringArray\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems"
|
|
46
|
+
"\":true,\"default\":[]}},\"type\":[\"object\",\"boolean\"],\"properties\":{\"$id\":{\"type\":\"string\",\"format\":\"uri"
|
|
47
|
+
"-reference\"},\"$schema\":{\"type\":\"string\",\"format\":\"uri\"},\"$ref\":{\"type\":\"string\",\"format\":\"uri-refere"
|
|
48
|
+
"nce\"},\"$comment\":{\"type\":\"string\"},\"title\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"defaul"
|
|
49
|
+
"t\":true,\"readOnly\":{\"type\":\"boolean\",\"default\":false},\"writeOnly\":{\"type\":\"boolean\",\"default\":false},\""
|
|
50
|
+
"examples\":{\"type\":\"array\",\"items\":true},\"multipleOf\":{\"type\":\"number\",\"exclusiveMinimum\":0},\"maximum\":{"
|
|
51
|
+
"\"type\":\"number\"},\"exclusiveMaximum\":{\"type\":\"number\"},\"minimum\":{\"type\":\"number\"},\"exclusiveMinimum\":{"
|
|
52
|
+
"\"type\":\"number\"},\"maxLength\":{\"$ref\":\"#/definitions/nonNegativeInteger\"},\"minLength\":{\"$ref\":\"#/definitio"
|
|
53
|
+
"ns/nonNegativeIntegerDefault0\"},\"pattern\":{\"type\":\"string\",\"format\":\"regex\"},\"additionalItems\":{\"$ref\":\""
|
|
54
|
+
"#\"},\"items\":{\"anyOf\":[{\"$ref\":\"#\"},{\"$ref\":\"#/definitions/schemaArray\"}],\"default\":true},\"maxItems\":{\""
|
|
55
|
+
"$ref\":\"#/definitions/nonNegativeInteger\"},\"minItems\":{\"$ref\":\"#/definitions/nonNegativeIntegerDefault0\"},\"uniq"
|
|
56
|
+
"ueItems\":{\"type\":\"boolean\",\"default\":false},\"contains\":{\"$ref\":\"#\"},\"maxProperties\":{\"$ref\":\"#/definit"
|
|
57
|
+
"ions/nonNegativeInteger\"},\"minProperties\":{\"$ref\":\"#/definitions/nonNegativeIntegerDefault0\"},\"required\":{\"$re"
|
|
58
|
+
"f\":\"#/definitions/stringArray\"},\"additionalProperties\":{\"$ref\":\"#\"},\"definitions\":{\"type\":\"object\",\"addi"
|
|
59
|
+
"tionalProperties\":{\"$ref\":\"#\"},\"default\":{}},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref"
|
|
60
|
+
"\":\"#\"},\"default\":{}},\"patternProperties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#\"},\"propert"
|
|
61
|
+
"yNames\":{\"format\":\"regex\"},\"default\":{}},\"dependencies\":{\"type\":\"object\",\"additionalProperties\":{\"anyOf"
|
|
62
|
+
"\":[{\"$ref\":\"#\"},{\"$ref\":\"#/definitions/stringArray\"}]}},\"propertyNames\":{\"$ref\":\"#\"},\"const\":true,\"enu"
|
|
63
|
+
"m\":{\"type\":\"array\",\"items\":true},\"type\":{\"anyOf\":[{\"$ref\":\"#/definitions/simpleTypes\"},{\"type\":\"array"
|
|
64
|
+
"\",\"items\":{\"$ref\":\"#/definitions/simpleTypes\"},\"minItems\":1,\"uniqueItems\":true}]},\"format\":{\"type\":\"stri"
|
|
65
|
+
"ng\"},\"contentMediaType\":{\"type\":\"string\"},\"contentEncoding\":{\"type\":\"string\"},\"if\":{\"$ref\":\"#\"},\"the"
|
|
66
|
+
"n\":{\"$ref\":\"#\"},\"else\":{\"$ref\":\"#\"},\"allOf\":{\"$ref\":\"#/definitions/schemaArray\"},\"anyOf\":{\"$ref\":\""
|
|
67
|
+
"#/definitions/schemaArray\"},\"oneOf\":{\"$ref\":\"#/definitions/schemaArray\"},\"not\":{\"$ref\":\"#\"}},\"default\":tr"
|
|
68
|
+
"ue}"
|
|
69
|
+
},
|
|
70
|
+
{"https://json-schema.org/draft/2019-09/schema",
|
|
71
|
+
"{\"$schema\":\"https://json-schema.org/draft/2019-09/schema\",\"$id\":\"https://json-schema.org/draft/2019-09/schema\","
|
|
72
|
+
"\"$vocabulary\":{\"https://json-schema.org/draft/2019-09/vocab/core\":true,\"https://json-schema.org/draft/2019-09/vocab"
|
|
73
|
+
"/applicator\":true,\"https://json-schema.org/draft/2019-09/vocab/validation\":true,\"https://json-schema.org/draft/2019-"
|
|
74
|
+
"09/vocab/meta-data\":true,\"https://json-schema.org/draft/2019-09/vocab/format\":false,\"https://json-schema.org/draft/2"
|
|
75
|
+
"019-09/vocab/content\":true},\"$recursiveAnchor\":true,\"title\":\"Core and Validation specifications meta-schema\",\"al"
|
|
76
|
+
"lOf\":[{\"$ref\":\"meta/core\"},{\"$ref\":\"meta/applicator\"},{\"$ref\":\"meta/validation\"},{\"$ref\":\"meta/meta-data"
|
|
77
|
+
"\"},{\"$ref\":\"meta/format\"},{\"$ref\":\"meta/content\"}],\"type\":[\"object\",\"boolean\"],\"properties\":{\"definiti"
|
|
78
|
+
"ons\":{\"$comment\":\"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the me"
|
|
79
|
+
"ta-schema to prevent incompatible extensions as it remains in common use.\",\"type\":\"object\",\"additionalProperties\""
|
|
80
|
+
":{\"$recursiveRef\":\"#\"},\"default\":{}},\"dependencies\":{\"$comment\":\"\\\"dependencies\\\" is no longer a keyword,"
|
|
81
|
+
" but schema authors should avoid redefining it to facilitate a smooth transition to \\\"dependentSchemas\\\" and \\\"dep"
|
|
82
|
+
"endentRequired\\\"\",\"type\":\"object\",\"additionalProperties\":{\"anyOf\":[{\"$recursiveRef\":\"#\"},{\"$ref\":\"meta"
|
|
83
|
+
"/validation#/$defs/stringArray\"}]}}}}"
|
|
84
|
+
},
|
|
85
|
+
{"https://json-schema.org/draft/2019-09/meta/core",
|
|
86
|
+
"{\"$schema\":\"https://json-schema.org/draft/2019-09/schema\",\"$id\":\"https://json-schema.org/draft/2019-09/meta/core"
|
|
87
|
+
"\",\"$vocabulary\":{\"https://json-schema.org/draft/2019-09/vocab/core\":true},\"$recursiveAnchor\":true,\"title\":\"Cor"
|
|
88
|
+
"e vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"$id\":{\"type\":\"string\",\"format\":\"u"
|
|
89
|
+
"ri-reference\",\"$comment\":\"Non-empty fragments not allowed.\",\"pattern\":\"^[^#]*#?$\"},\"$schema\":{\"type\":\"stri"
|
|
90
|
+
"ng\",\"format\":\"uri\"},\"$anchor\":{\"type\":\"string\",\"pattern\":\"^[A-Za-z][-A-Za-z0-9.:_]*$\"},\"$ref\":{\"type\""
|
|
91
|
+
":\"string\",\"format\":\"uri-reference\"},\"$recursiveRef\":{\"type\":\"string\",\"format\":\"uri-reference\"},\"$recurs"
|
|
92
|
+
"iveAnchor\":{\"type\":\"boolean\",\"default\":false},\"$vocabulary\":{\"type\":\"object\",\"propertyNames\":{\"type\":\""
|
|
93
|
+
"string\",\"format\":\"uri\"},\"additionalProperties\":{\"type\":\"boolean\"}},\"$comment\":{\"type\":\"string\"},\"$defs"
|
|
94
|
+
"\":{\"type\":\"object\",\"additionalProperties\":{\"$recursiveRef\":\"#\"},\"default\":{}}}}"
|
|
95
|
+
},
|
|
96
|
+
{"https://json-schema.org/draft/2019-09/meta/applicator",
|
|
97
|
+
"{\"$schema\":\"https://json-schema.org/draft/2019-09/schema\",\"$id\":\"https://json-schema.org/draft/2019-09/meta/appli"
|
|
98
|
+
"cator\",\"$vocabulary\":{\"https://json-schema.org/draft/2019-09/vocab/applicator\":true},\"$recursiveAnchor\":true,\"ti"
|
|
99
|
+
"tle\":\"Applicator vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"additionalItems\":{\"$re"
|
|
100
|
+
"cursiveRef\":\"#\"},\"unevaluatedItems\":{\"$recursiveRef\":\"#\"},\"items\":{\"anyOf\":[{\"$recursiveRef\":\"#\"},{\"$r"
|
|
101
|
+
"ef\":\"#/$defs/schemaArray\"}]},\"contains\":{\"$recursiveRef\":\"#\"},\"additionalProperties\":{\"$recursiveRef\":\"#\""
|
|
102
|
+
"},\"unevaluatedProperties\":{\"$recursiveRef\":\"#\"},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$r"
|
|
103
|
+
"ecursiveRef\":\"#\"},\"default\":{}},\"patternProperties\":{\"type\":\"object\",\"additionalProperties\":{\"$recursiveRe"
|
|
104
|
+
"f\":\"#\"},\"propertyNames\":{\"format\":\"regex\"},\"default\":{}},\"dependentSchemas\":{\"type\":\"object\",\"addition"
|
|
105
|
+
"alProperties\":{\"$recursiveRef\":\"#\"}},\"propertyNames\":{\"$recursiveRef\":\"#\"},\"if\":{\"$recursiveRef\":\"#\"},"
|
|
106
|
+
"\"then\":{\"$recursiveRef\":\"#\"},\"else\":{\"$recursiveRef\":\"#\"},\"allOf\":{\"$ref\":\"#/$defs/schemaArray\"},\"any"
|
|
107
|
+
"Of\":{\"$ref\":\"#/$defs/schemaArray\"},\"oneOf\":{\"$ref\":\"#/$defs/schemaArray\"},\"not\":{\"$recursiveRef\":\"#\"}},"
|
|
108
|
+
"\"$defs\":{\"schemaArray\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$recursiveRef\":\"#\"}}}}"
|
|
109
|
+
},
|
|
110
|
+
{"https://json-schema.org/draft/2019-09/meta/validation",
|
|
111
|
+
"{\"$schema\":\"https://json-schema.org/draft/2019-09/schema\",\"$id\":\"https://json-schema.org/draft/2019-09/meta/valid"
|
|
112
|
+
"ation\",\"$vocabulary\":{\"https://json-schema.org/draft/2019-09/vocab/validation\":true},\"$recursiveAnchor\":true,\"ti"
|
|
113
|
+
"tle\":\"Validation vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"multipleOf\":{\"type\":"
|
|
114
|
+
"\"number\",\"exclusiveMinimum\":0},\"maximum\":{\"type\":\"number\"},\"exclusiveMaximum\":{\"type\":\"number\"},\"minimu"
|
|
115
|
+
"m\":{\"type\":\"number\"},\"exclusiveMinimum\":{\"type\":\"number\"},\"maxLength\":{\"$ref\":\"#/$defs/nonNegativeIntege"
|
|
116
|
+
"r\"},\"minLength\":{\"$ref\":\"#/$defs/nonNegativeIntegerDefault0\"},\"pattern\":{\"type\":\"string\",\"format\":\"regex"
|
|
117
|
+
"\"},\"maxItems\":{\"$ref\":\"#/$defs/nonNegativeInteger\"},\"minItems\":{\"$ref\":\"#/$defs/nonNegativeIntegerDefault0\""
|
|
118
|
+
"},\"uniqueItems\":{\"type\":\"boolean\",\"default\":false},\"maxContains\":{\"$ref\":\"#/$defs/nonNegativeInteger\"},\"m"
|
|
119
|
+
"inContains\":{\"$ref\":\"#/$defs/nonNegativeInteger\",\"default\":1},\"maxProperties\":{\"$ref\":\"#/$defs/nonNegativeIn"
|
|
120
|
+
"teger\"},\"minProperties\":{\"$ref\":\"#/$defs/nonNegativeIntegerDefault0\"},\"required\":{\"$ref\":\"#/$defs/stringArra"
|
|
121
|
+
"y\"},\"dependentRequired\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/$defs/stringArray\"}},\"const\":t"
|
|
122
|
+
"rue,\"enum\":{\"type\":\"array\",\"items\":true},\"type\":{\"anyOf\":[{\"$ref\":\"#/$defs/simpleTypes\"},{\"type\":\"arr"
|
|
123
|
+
"ay\",\"items\":{\"$ref\":\"#/$defs/simpleTypes\"},\"minItems\":1,\"uniqueItems\":true}]}},\"$defs\":{\"nonNegativeIntege"
|
|
124
|
+
"r\":{\"type\":\"integer\",\"minimum\":0},\"nonNegativeIntegerDefault0\":{\"$ref\":\"#/$defs/nonNegativeInteger\",\"defau"
|
|
125
|
+
"lt\":0},\"simpleTypes\":{\"enum\":[\"array\",\"boolean\",\"integer\",\"null\",\"number\",\"object\",\"string\"]},\"strin"
|
|
126
|
+
"gArray\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true,\"default\":[]}}}"
|
|
127
|
+
},
|
|
128
|
+
{"https://json-schema.org/draft/2019-09/meta/meta-data",
|
|
129
|
+
"{\"$schema\":\"https://json-schema.org/draft/2019-09/schema\",\"$id\":\"https://json-schema.org/draft/2019-09/meta/meta-"
|
|
130
|
+
"data\",\"$vocabulary\":{\"https://json-schema.org/draft/2019-09/vocab/meta-data\":true},\"$recursiveAnchor\":true,\"titl"
|
|
131
|
+
"e\":\"Meta-data vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"title\":{\"type\":\"string"
|
|
132
|
+
"\"},\"description\":{\"type\":\"string\"},\"default\":true,\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"rea"
|
|
133
|
+
"dOnly\":{\"type\":\"boolean\",\"default\":false},\"writeOnly\":{\"type\":\"boolean\",\"default\":false},\"examples\":{\""
|
|
134
|
+
"type\":\"array\",\"items\":true}}}"
|
|
135
|
+
},
|
|
136
|
+
{"https://json-schema.org/draft/2019-09/meta/content",
|
|
137
|
+
"{\"$schema\":\"https://json-schema.org/draft/2019-09/schema\",\"$id\":\"https://json-schema.org/draft/2019-09/meta/conte"
|
|
138
|
+
"nt\",\"$vocabulary\":{\"https://json-schema.org/draft/2019-09/vocab/content\":true},\"$recursiveAnchor\":true,\"title\":"
|
|
139
|
+
"\"Content vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"contentMediaType\":{\"type\":\"st"
|
|
140
|
+
"ring\"},\"contentEncoding\":{\"type\":\"string\"},\"contentSchema\":{\"$recursiveRef\":\"#\"}}}"
|
|
141
|
+
},
|
|
142
|
+
{"https://json-schema.org/draft/2019-09/meta/format",
|
|
143
|
+
"{\"$schema\":\"https://json-schema.org/draft/2019-09/schema\",\"$id\":\"https://json-schema.org/draft/2019-09/meta/forma"
|
|
144
|
+
"t\",\"$vocabulary\":{\"https://json-schema.org/draft/2019-09/vocab/format\":true},\"$recursiveAnchor\":true,\"title\":\""
|
|
145
|
+
"Format vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"format\":{\"type\":\"string\"}}}"
|
|
146
|
+
},
|
|
147
|
+
{"https://json-schema.org/draft/2020-12/schema",
|
|
148
|
+
"{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://json-schema.org/draft/2020-12/schema\","
|
|
149
|
+
"\"$vocabulary\":{\"https://json-schema.org/draft/2020-12/vocab/core\":true,\"https://json-schema.org/draft/2020-12/vocab"
|
|
150
|
+
"/applicator\":true,\"https://json-schema.org/draft/2020-12/vocab/unevaluated\":true,\"https://json-schema.org/draft/2020"
|
|
151
|
+
"-12/vocab/validation\":true,\"https://json-schema.org/draft/2020-12/vocab/meta-data\":true,\"https://json-schema.org/dra"
|
|
152
|
+
"ft/2020-12/vocab/format-annotation\":true,\"https://json-schema.org/draft/2020-12/vocab/content\":true},\"$dynamicAnchor"
|
|
153
|
+
"\":\"meta\",\"title\":\"Core and Validation specifications meta-schema\",\"allOf\":[{\"$ref\":\"meta/core\"},{\"$ref\":"
|
|
154
|
+
"\"meta/applicator\"},{\"$ref\":\"meta/unevaluated\"},{\"$ref\":\"meta/validation\"},{\"$ref\":\"meta/meta-data\"},{\"$re"
|
|
155
|
+
"f\":\"meta/format-annotation\"},{\"$ref\":\"meta/content\"}],\"type\":[\"object\",\"boolean\"],\"$comment\":\"This meta-"
|
|
156
|
+
"schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they r"
|
|
157
|
+
"emain in common use.\",\"properties\":{\"definitions\":{\"$comment\":\"\\\"definitions\\\" has been replaced by \\\"$def"
|
|
158
|
+
"s\\\".\",\"type\":\"object\",\"additionalProperties\":{\"$dynamicRef\":\"#meta\"},\"deprecated\":true,\"default\":{}},\""
|
|
159
|
+
"dependencies\":{\"$comment\":\"\\\"dependencies\\\" has been split and replaced by \\\"dependentSchemas\\\" and \\\"depe"
|
|
160
|
+
"ndentRequired\\\" in order to serve their differing semantics.\",\"type\":\"object\",\"additionalProperties\":{\"anyOf\""
|
|
161
|
+
":[{\"$dynamicRef\":\"#meta\"},{\"$ref\":\"meta/validation#/$defs/stringArray\"}]},\"deprecated\":true,\"default\":{}},\""
|
|
162
|
+
"$recursiveAnchor\":{\"$comment\":\"\\\"$recursiveAnchor\\\" has been replaced by \\\"$dynamicAnchor\\\".\",\"$ref\":\"me"
|
|
163
|
+
"ta/core#/$defs/anchorString\",\"deprecated\":true},\"$recursiveRef\":{\"$comment\":\"\\\"$recursiveRef\\\" has been repl"
|
|
164
|
+
"aced by \\\"$dynamicRef\\\".\",\"$ref\":\"meta/core#/$defs/uriReferenceString\",\"deprecated\":true}}}"
|
|
165
|
+
},
|
|
166
|
+
{"https://json-schema.org/draft/2020-12/meta/core",
|
|
167
|
+
"{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://json-schema.org/draft/2020-12/meta/core"
|
|
168
|
+
"\",\"$vocabulary\":{\"https://json-schema.org/draft/2020-12/vocab/core\":true},\"$dynamicAnchor\":\"meta\",\"title\":\"C"
|
|
169
|
+
"ore vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"$id\":{\"$ref\":\"#/$defs/uriReferenceS"
|
|
170
|
+
"tring\",\"$comment\":\"Non-empty fragments not allowed.\",\"pattern\":\"^[^#]*#?$\"},\"$schema\":{\"$ref\":\"#/$defs/uri"
|
|
171
|
+
"String\"},\"$ref\":{\"$ref\":\"#/$defs/uriReferenceString\"},\"$anchor\":{\"$ref\":\"#/$defs/anchorString\"},\"$dynamicR"
|
|
172
|
+
"ef\":{\"$ref\":\"#/$defs/uriReferenceString\"},\"$dynamicAnchor\":{\"$ref\":\"#/$defs/anchorString\"},\"$vocabulary\":{"
|
|
173
|
+
"\"type\":\"object\",\"propertyNames\":{\"$ref\":\"#/$defs/uriString\"},\"additionalProperties\":{\"type\":\"boolean\"}},"
|
|
174
|
+
"\"$comment\":{\"type\":\"string\"},\"$defs\":{\"type\":\"object\",\"additionalProperties\":{\"$dynamicRef\":\"#meta\"}}}"
|
|
175
|
+
",\"$defs\":{\"anchorString\":{\"type\":\"string\",\"pattern\":\"^[A-Za-z_][-A-Za-z0-9._]*$\"},\"uriString\":{\"type\":\""
|
|
176
|
+
"string\",\"format\":\"uri\"},\"uriReferenceString\":{\"type\":\"string\",\"format\":\"uri-reference\"}}}"
|
|
177
|
+
},
|
|
178
|
+
{"https://json-schema.org/draft/2020-12/meta/applicator",
|
|
179
|
+
"{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://json-schema.org/draft/2020-12/meta/appli"
|
|
180
|
+
"cator\",\"$vocabulary\":{\"https://json-schema.org/draft/2020-12/vocab/applicator\":true},\"$dynamicAnchor\":\"meta\",\""
|
|
181
|
+
"title\":\"Applicator vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"prefixItems\":{\"$ref"
|
|
182
|
+
"\":\"#/$defs/schemaArray\"},\"items\":{\"$dynamicRef\":\"#meta\"},\"contains\":{\"$dynamicRef\":\"#meta\"},\"additionalP"
|
|
183
|
+
"roperties\":{\"$dynamicRef\":\"#meta\"},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$dynamicRef\":\""
|
|
184
|
+
"#meta\"},\"default\":{}},\"patternProperties\":{\"type\":\"object\",\"additionalProperties\":{\"$dynamicRef\":\"#meta\"}"
|
|
185
|
+
",\"propertyNames\":{\"format\":\"regex\"},\"default\":{}},\"dependentSchemas\":{\"type\":\"object\",\"additionalProperti"
|
|
186
|
+
"es\":{\"$dynamicRef\":\"#meta\"},\"default\":{}},\"propertyNames\":{\"$dynamicRef\":\"#meta\"},\"if\":{\"$dynamicRef\":"
|
|
187
|
+
"\"#meta\"},\"then\":{\"$dynamicRef\":\"#meta\"},\"else\":{\"$dynamicRef\":\"#meta\"},\"allOf\":{\"$ref\":\"#/$defs/schem"
|
|
188
|
+
"aArray\"},\"anyOf\":{\"$ref\":\"#/$defs/schemaArray\"},\"oneOf\":{\"$ref\":\"#/$defs/schemaArray\"},\"not\":{\"$dynamicR"
|
|
189
|
+
"ef\":\"#meta\"}},\"$defs\":{\"schemaArray\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$dynamicRef\":\"#meta\"}}}}"
|
|
190
|
+
},
|
|
191
|
+
{"https://json-schema.org/draft/2020-12/meta/validation",
|
|
192
|
+
"{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://json-schema.org/draft/2020-12/meta/valid"
|
|
193
|
+
"ation\",\"$vocabulary\":{\"https://json-schema.org/draft/2020-12/vocab/validation\":true},\"$dynamicAnchor\":\"meta\",\""
|
|
194
|
+
"title\":\"Validation vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"type\":{\"anyOf\":[{\""
|
|
195
|
+
"$ref\":\"#/$defs/simpleTypes\"},{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/simpleTypes\"},\"minItems\":1,\"unique"
|
|
196
|
+
"Items\":true}]},\"const\":true,\"enum\":{\"type\":\"array\",\"items\":true},\"multipleOf\":{\"type\":\"number\",\"exclus"
|
|
197
|
+
"iveMinimum\":0},\"maximum\":{\"type\":\"number\"},\"exclusiveMaximum\":{\"type\":\"number\"},\"minimum\":{\"type\":\"num"
|
|
198
|
+
"ber\"},\"exclusiveMinimum\":{\"type\":\"number\"},\"maxLength\":{\"$ref\":\"#/$defs/nonNegativeInteger\"},\"minLength\":"
|
|
199
|
+
"{\"$ref\":\"#/$defs/nonNegativeIntegerDefault0\"},\"pattern\":{\"type\":\"string\",\"format\":\"regex\"},\"maxItems\":{"
|
|
200
|
+
"\"$ref\":\"#/$defs/nonNegativeInteger\"},\"minItems\":{\"$ref\":\"#/$defs/nonNegativeIntegerDefault0\"},\"uniqueItems\":"
|
|
201
|
+
"{\"type\":\"boolean\",\"default\":false},\"maxContains\":{\"$ref\":\"#/$defs/nonNegativeInteger\"},\"minContains\":{\"$r"
|
|
202
|
+
"ef\":\"#/$defs/nonNegativeInteger\",\"default\":1},\"maxProperties\":{\"$ref\":\"#/$defs/nonNegativeInteger\"},\"minProp"
|
|
203
|
+
"erties\":{\"$ref\":\"#/$defs/nonNegativeIntegerDefault0\"},\"required\":{\"$ref\":\"#/$defs/stringArray\"},\"dependentRe"
|
|
204
|
+
"quired\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/$defs/stringArray\"}}},\"$defs\":{\"nonNegativeInte"
|
|
205
|
+
"ger\":{\"type\":\"integer\",\"minimum\":0},\"nonNegativeIntegerDefault0\":{\"$ref\":\"#/$defs/nonNegativeInteger\",\"def"
|
|
206
|
+
"ault\":0},\"simpleTypes\":{\"enum\":[\"array\",\"boolean\",\"integer\",\"null\",\"number\",\"object\",\"string\"]},\"str"
|
|
207
|
+
"ingArray\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true,\"default\":[]}}}"
|
|
208
|
+
},
|
|
209
|
+
{"https://json-schema.org/draft/2020-12/meta/meta-data",
|
|
210
|
+
"{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://json-schema.org/draft/2020-12/meta/meta-"
|
|
211
|
+
"data\",\"$vocabulary\":{\"https://json-schema.org/draft/2020-12/vocab/meta-data\":true},\"$dynamicAnchor\":\"meta\",\"ti"
|
|
212
|
+
"tle\":\"Meta-data vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"title\":{\"type\":\"strin"
|
|
213
|
+
"g\"},\"description\":{\"type\":\"string\"},\"default\":true,\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"re"
|
|
214
|
+
"adOnly\":{\"type\":\"boolean\",\"default\":false},\"writeOnly\":{\"type\":\"boolean\",\"default\":false},\"examples\":{"
|
|
215
|
+
"\"type\":\"array\",\"items\":true}}}"
|
|
216
|
+
},
|
|
217
|
+
{"https://json-schema.org/draft/2020-12/meta/content",
|
|
218
|
+
"{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://json-schema.org/draft/2020-12/meta/conte"
|
|
219
|
+
"nt\",\"$vocabulary\":{\"https://json-schema.org/draft/2020-12/vocab/content\":true},\"$dynamicAnchor\":\"meta\",\"title"
|
|
220
|
+
"\":\"Content vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"contentEncoding\":{\"type\":\""
|
|
221
|
+
"string\"},\"contentMediaType\":{\"type\":\"string\"},\"contentSchema\":{\"$dynamicRef\":\"#meta\"}}}"
|
|
222
|
+
},
|
|
223
|
+
{"https://json-schema.org/draft/2020-12/meta/unevaluated",
|
|
224
|
+
"{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://json-schema.org/draft/2020-12/meta/uneva"
|
|
225
|
+
"luated\",\"$vocabulary\":{\"https://json-schema.org/draft/2020-12/vocab/unevaluated\":true},\"$dynamicAnchor\":\"meta\","
|
|
226
|
+
"\"title\":\"Unevaluated applicator vocabulary meta-schema\",\"type\":[\"object\",\"boolean\"],\"properties\":{\"unevalua"
|
|
227
|
+
"tedItems\":{\"$dynamicRef\":\"#meta\"},\"unevaluatedProperties\":{\"$dynamicRef\":\"#meta\"}}}"
|
|
228
|
+
},
|
|
229
|
+
{"https://json-schema.org/draft/2020-12/meta/format-annotation",
|
|
230
|
+
"{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://json-schema.org/draft/2020-12/meta/forma"
|
|
231
|
+
"t-annotation\",\"$vocabulary\":{\"https://json-schema.org/draft/2020-12/vocab/format-annotation\":true},\"$dynamicAnchor"
|
|
232
|
+
"\":\"meta\",\"title\":\"Format vocabulary meta-schema for annotation results\",\"type\":[\"object\",\"boolean\"],\"prope"
|
|
233
|
+
"rties\":{\"format\":{\"type\":\"string\"}}}"
|
|
234
|
+
},
|
|
235
|
+
{"https://json-schema.org/draft/2020-12/meta/format-assertion",
|
|
236
|
+
"{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"https://json-schema.org/draft/2020-12/meta/forma"
|
|
237
|
+
"t-assertion\",\"$dynamicAnchor\":\"meta\",\"title\":\"Format vocabulary meta-schema for assertion results\",\"type\":[\""
|
|
238
|
+
"object\",\"boolean\"],\"properties\":{\"format\":{\"type\":\"string\"}}}"
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const size_t teptris_n_builtin_resources =
|
|
243
|
+
sizeof(teptris_builtin_resources) / sizeof(teptris_builtin_resources[0]);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* The official JSON Schema metaschemas as built-in resources. */
|
|
2
|
+
#ifndef TEPTRIS_SCHEMA_METASCHEMAS_H
|
|
3
|
+
#define TEPTRIS_SCHEMA_METASCHEMAS_H
|
|
4
|
+
|
|
5
|
+
#include <stddef.h>
|
|
6
|
+
|
|
7
|
+
struct teptris_builtin_resource {
|
|
8
|
+
const char *uri;
|
|
9
|
+
const char *json;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
extern const struct teptris_builtin_resource teptris_builtin_resources[];
|
|
13
|
+
extern const size_t teptris_n_builtin_resources;
|
|
14
|
+
|
|
15
|
+
#endif
|