teptris 0.3.19.1-aarch64-linux → 0.3.21.0-aarch64-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40b9a74116b7114e1ec8560fae1cef88c122a5409faaa12ce7eea6fd0368db9d
4
- data.tar.gz: 0af6ab4e5b042a4564f7c3d1b36f5051183e793220eeea35bfe130e3d2b54eff
3
+ metadata.gz: 315fa4d9a0cd848451725d8a7d7fc017a4058b7a56f4bc2c3403fcfe72db5eb7
4
+ data.tar.gz: ff199a7ab7b9330a2ae606f696b3a54dc49b7346efb64246ea74b68c06c65e92
5
5
  SHA512:
6
- metadata.gz: cd68404edd531d3615d5de0f298ec968bec0b49de411857b7dbf8faca798f64a543f63539fa625c36753fdafde7fa8c18f2146cfd5c277968067477b5575ae89
7
- data.tar.gz: 58c3d5b735520d2a426a22b08a395be18d2b2516ea16b57bb191870d88155b0c1b701c867531edaa737388cbfa2eb922a0f116d8a779da839dc4ca2749b3cd9f
6
+ metadata.gz: 2d1b720e8860ce4e469c36a657f11b95d8b2eb57b2e091688fa80da93f4de678fa07cc5dba23d308b3e23f208010b70b01798965278f8d8c2f673c3719e38a22
7
+ data.tar.gz: f04933e7719d607be5ac569800988dcbf829f85372873e3c6ca7ca29af4c75a4732d9572fcdeb9476456c4c2765ba26460495744f97961c03eced4d726d08145
data/Steepfile CHANGED
@@ -1,6 +1,7 @@
1
1
  target :lib do
2
2
  signature "sig"
3
3
  library "date"
4
+ library "json"
4
5
 
5
6
  check "lib"
6
7
 
@@ -1,4 +1,4 @@
1
- # libteptris 0.3.19 — vendored source
1
+ # libteptris 0.3.21 — vendored source
2
2
 
3
3
  This directory carries the COMPLETE C source of the engine this
4
4
  gem's extension was built from (the packaging doctrine: compiled
@@ -0,0 +1,107 @@
1
+ #ifndef TEPTRIS_SCHEMA_H
2
+ #define TEPTRIS_SCHEMA_H
3
+
4
+ /* JSON Schema validation for TOML documents (draft 2020-12, practical
5
+ * subset). Compile a schema once, validate many documents. One
6
+ * implementation, every runtime.
7
+ *
8
+ * ------------------------------------------------------------- policies --
9
+ * TOML and JSON differ in exactly four places; each difference has a
10
+ * documented policy:
11
+ *
12
+ * 1. null. TOML has no null. A schema branch requiring null (a bare
13
+ * `"type": "null"`, or an enum/const entry of null) matches no TOML
14
+ * value. Optionality stays with `required` + absence, so the common
15
+ * JSON idiom `"type": ["string", "null"]` behaves as an optional
16
+ * string: absent passes, a present string passes, any other present
17
+ * value fails. No special-casing: null-typed branches simply never
18
+ * match.
19
+ *
20
+ * 2. integer. TOML's integer is a DISTINCT type from float (`1` and
21
+ * `1.0` differ). `"type": "integer"` matches only TOML integers - a
22
+ * float never validates as integer, even with zero fractional part.
23
+ * `"type": "number"` matches both.
24
+ *
25
+ * 3. datetimes. TOML's four datetime shapes validate as `type:
26
+ * "string"` (their JSON view), and the `format` keywords
27
+ * "date-time", "date" and "time" check the datetime SHAPE: a TOML
28
+ * datetime value of the matching shape passes, and so does a string
29
+ * whose content parses as that shape. Other formats are annotations
30
+ * (checked by the host, if at all) - draft 2020-12 makes format
31
+ * annotation-only by default.
32
+ *
33
+ * 4. non-finite floats. `nan`, `inf`, `-inf` are TOML floats: they
34
+ * match `type: "number"`. nan compares false against everything,
35
+ * so it fails every range/multipleOf constraint; inf violates any
36
+ * `maximum`. No special-casing.
37
+ *
38
+ * ---------------------------------------------------------- semantics --
39
+ * - `$ref` resolves local JSON Pointers ("#/...", "#", plain-name
40
+ * "#anchor" via `$anchor`), including recursive definitions. Remote
41
+ * references (absolute URIs) are REJECTED at compile: a parser
42
+ * library never touches the network.
43
+ * - Keywords that would silently change validation results when
44
+ * ignored (`unevaluatedProperties`, `unevaluatedItems`,
45
+ * `$dynamicRef`, `$dynamicAnchor`, `$recursiveRef`, `$recursiveAnchor`,
46
+ * backreferences / lookahead / lookbehind in patterns) are REJECTED
47
+ * at compile with a diagnostic. Unknown keywords are ignored (they
48
+ * are extensions per the spec).
49
+ * - Patterns run on a linear-time NFA (Thompson construction): immune
50
+ * to ReDoS by construction. Practical ECMA subset: literals, '.',
51
+ * classes, groups, alternation, greedy quantifiers, anchors, \b,
52
+ * \d \w \s (and negations), \xNN, \uNNNN. Lazy quantifiers are
53
+ * accepted (boolean match semantics are identical).
54
+ * - Validation collects every error it finds, up to 256, and reports
55
+ * them as a JSON array of {"path", "schemaPath", "message"}; an
56
+ * empty array means the document is valid. Paths are dotted TOML
57
+ * paths with array indices ("items.0.name"); keys containing a dot
58
+ * are quoted ("\"my.key\"").
59
+ *
60
+ * Memory: every buffer handed out (*buf, *diag_buf) is malloc'd; the
61
+ * caller frees it with free(). */
62
+ #include <stddef.h>
63
+
64
+ #include "teptris/teptris.h"
65
+
66
+ #ifdef __cplusplus
67
+ extern "C" {
68
+ #endif
69
+
70
+ typedef struct teptris_schema teptris_schema;
71
+
72
+ /* Compile a schema from JSON text. On failure *out stays unset and
73
+ * *diag_buf (if non-NULL) receives a malloc'd JSON diagnostic
74
+ * {"error": "...", "path": "..."} locating the problem; free it with
75
+ * teptris_diag_free. Either out or diag_buf may be NULL if the caller
76
+ * does not want it. */
77
+ TEPTRIS_API teptris_status teptris_schema_compile(const char *json, size_t len,
78
+ teptris_schema **out,
79
+ char **diag_buf,
80
+ size_t *diag_len);
81
+
82
+ /* Free a compile diagnostic. */
83
+ TEPTRIS_API void teptris_diag_free(char *buf);
84
+
85
+ /* Validate a parsed document against the schema. *buf receives a
86
+ * malloc'd JSON array of error objects (empty array = valid); free it
87
+ * with free(). At most 256 errors are collected. */
88
+ TEPTRIS_API teptris_status teptris_schema_validate_doc(
89
+ const teptris_schema *sch, const teptris_document *doc, char **buf,
90
+ size_t *out_len);
91
+
92
+ /* Parse TOML text and validate it. A malformed document returns
93
+ * TEPTRIS_ERR_SYNTAX (with *out unchanged - parse it separately with
94
+ * teptris_parse to read the position). */
95
+ TEPTRIS_API teptris_status teptris_schema_validate(const teptris_schema *sch,
96
+ const char *toml, size_t len,
97
+ char **buf, size_t *out_len);
98
+
99
+ /* Free a compiled schema. Compiled schemas are independent of any
100
+ * document; reuse across documents is the intended pattern. */
101
+ TEPTRIS_API void teptris_schema_free(teptris_schema *sch);
102
+
103
+ #ifdef __cplusplus
104
+ }
105
+ #endif
106
+
107
+ #endif /* TEPTRIS_SCHEMA_H */
@@ -3,7 +3,7 @@
3
3
 
4
4
  #define TEPTRIS_VERSION_MAJOR 0
5
5
  #define TEPTRIS_VERSION_MINOR 3
6
- #define TEPTRIS_VERSION_PATCH 0
7
- #define TEPTRIS_VERSION_STRING "0.3.19"
6
+ #define TEPTRIS_VERSION_PATCH 21
7
+ #define TEPTRIS_VERSION_STRING "0.3.21"
8
8
 
9
9
  #endif /* TEPTRIS_VERSION_H */