Release Schema Tools 0.2.0
Verify / verify (push) Canceled after 0s

This commit is contained in:
2026-09-02 08:04:49 +02:00
parent 754608e52b
commit 0c47ec5105
30 changed files with 587 additions and 94 deletions
+3 -3
View File
@@ -2,12 +2,12 @@
Schema Tools is a static React/Vite application inside the shared Toolbox shell. `src/schema/model.ts` is the bounded trust boundary: it normalizes workspace names, parses JSON/YAML/XML, inventories language structures and references, performs eligible JSON instance validation, generates samples, and produces conservative comparison signals. React renders only text and native controls; no schema content is inserted as HTML.
JSON and YAML values are converted into an acyclic, prototype-safe JSON model with limits on source length, node count, depth, and collection width. JSON Schema instance validation is a CSP-safe interpreter selected for Draft 6, Draft 7, 2019-09, or 2020-12 behavior; it never generates or evaluates code. The focused subset covers boolean schemas, local `$ref` with JSON Pointer fragments, `type`, `enum`, `const`, numeric bounds and `multipleOf`, string lengths, object properties/required/additional properties/property names/dependencies, array items/tuples/contains/uniqueness and size, combiners, negation, and draft-appropriate conditionals. Validation has a 250,000-step and 1,000-diagnostic ceiling.
JSON and YAML values are converted into an acyclic, prototype-safe JSON model with limits on source length, node count, depth, and collection width. JSON Schema instance validation is a CSP-safe interpreter selected for Draft 6, Draft 7, 2019-09, or 2020-12 behavior; it never generates or evaluates code. The focused subset covers boolean schemas, local `$ref` with JSON Pointer fragments, `type`, `enum`, `const`, numeric bounds and `multipleOf`, string lengths and patterns, object properties/required/additional properties/property names/pattern properties/dependencies, array items/tuples/contains/uniqueness and size, combiners, negation, and draft-appropriate conditionals. Validation has a 250,000-step and 1,000-diagnostic ceiling.
Every reference is classified before validation. Only fragments and relative filenames supplied in the current workspace are eligible. Root `$id`/legacy `id` values are deliberately ignored so relative references remain anchored to workspace filenames; nested identifier scopes, named anchors, dynamic/recursive references, and unevaluated keywords are outside the subset and cause a visible refusal. All participating JSON Schema files must use one declared draft. Formats and unknown extension keywords are annotations. Schemas containing `pattern` or `patternProperties` are refused because JavaScript regular-expression execution cannot be reliably time-bounded; they remain inspectable. Decimal arithmetic uses JavaScript numbers, so `multipleOf` applies a small floating-point tolerance.
Every reference is classified before validation. Only fragments and relative filenames supplied in the current workspace are eligible. Root `$id`/legacy `id` values are deliberately ignored so relative references remain anchored to workspace filenames; nested identifier scopes, named anchors, dynamic/recursive references, and unevaluated keywords are outside the subset and cause a visible refusal. All participating JSON Schema files must use one declared draft. Formats and unknown extension keywords are annotations. `pattern` and `patternProperties` expressions and candidate strings are deduplicated and sent as one bounded batch to a fresh module worker; the caller terminates that worker after one second, including while one pathological `RegExp.test` is stalled. No partial result is accepted. Decimal arithmetic uses JavaScript numbers, so `multipleOf` applies a small floating-point tolerance.
OpenAPI JSON/YAML receives focused document, operation, response, reference, sample, and comparison logic. It does not run requests and does not claim full OpenAPI conformance. XML uses the browser's inert `DOMParser` only after rejecting DTD and entity declarations. Element counting and depth inspection use a linear sibling-pointer walk, avoiding repeated conversion of live DOM child collections. XSD, Relax NG XML syntax, and Schematron are checked for well-formedness and structurally inventoried. Schematron XPath and extensions are retained as text and never executed. XSD and Relax NG sample generation deliberately follows a bounded first branch and is labelled heuristic. XSD named-type shapes are inspected once and cached within one generation; Relax NG grammars and direct-root `element` patterns use the same renderer, and pattern-only wrappers do not consume generated nesting depth.
All sample paths share one budget implementation. It admits at most 50,000 monotonic generator work steps and 2,000 generated JSON values or XML elements across exactly 20 generated levels (the root is level one), accounts for at most 512 KiB of aggregate derived keys, names, attribute values, and content, caps each copied literal at 1,024 UTF-16 code units without splitting a surrogate pair, and rejects serialized output above 2 MiB. References and schema/pattern combiners do not consume generated depth, but every build, copy, reference, alternative, XML type inspection, and XML pattern visit consumes work before expansion. Per-generation caches ensure repeated JSON references, wide property collections, XML child collections, inline types, text, and name normalization are not rescanned without bound. The work counter is deliberately not restored when a failed heuristic alternative rolls back its node/text checkpoint, and generation is refused rather than returning an ambiguously partial result when a 50,001st work step is attempted. Node, depth, and text ceilings can instead omit bounded material with a visible notice. Repeated references consume node and text counters for every emitted occurrence. Duplicate or fallback-colliding derived XML attribute names are omitted with a notice to preserve well-formed output. A `false` JSON Schema reached through a selected local reference or mandatory `allOf` branch aborts generation; `anyOf` and `oneOf` skip definitely impossible boolean branches and use the first viable heuristic branch only while the complete attempt remains within budget.
The PWA uses only relative URLs, so the same build works standalone or below a nested portal route. Its service worker caches same-origin files from its own scope. No worker, storage database, server API, telemetry path, or remote schema resolver exists in v0.1.2.
The PWA uses only relative URLs, so the same build works standalone or below a nested portal route. Its service worker caches same-origin files from its own scope. The regex worker receives only the already-local expressions and candidate strings for one validation request and is then terminated. No storage database, server API, telemetry path, or remote schema resolver is used.
+2 -2
View File
@@ -4,6 +4,6 @@ Schema sources, instances, diagnostics, comparisons, and generated samples stay
Each source is limited to 2 MiB of text; a workspace is limited to 20 documents and 8 MiB. JSON/YAML trees are capped at 25,000 values, 48 levels, and 2,000 entries in one collection. XML is capped at 25,000 elements and 48 levels. References, instances, and diagnostics have separate caps. A shared sample budget is limited to 50,000 monotonic work steps, exactly 2,000 generated JSON values or XML elements, exactly 20 generated nesting levels, 512 KiB of aggregate derived text, 1,024 UTF-16 code units per copied literal without splitting surrogate pairs, and 2 MiB of serialized output. Reusing a local definition consumes the same aggregate counters on every attempt and generated occurrence; failed heuristic alternatives never refund work. Reaching the work ceiling refuses the generation operation, so exhaustion cannot be mistaken for a viable choice or skip a later mandatory constraint. File byte gates are deliberately conservative before `File.text()` decoding.
Prototype-sensitive JSON keys, cyclic YAML aliases, NUL input, DTD/entity declarations, absolute/remote/escaping references, and executable schema extensions are rejected. Schematron expressions and imported XML are never executed. JSON Schema formats are annotations, and regex-bearing schema keywords are not executed. The focused validator interprets eligible schemas without dynamic code generation, remote loading, custom code, or `unsafe-eval`; work and diagnostic counts are capped.
Prototype-sensitive JSON keys, cyclic YAML aliases, NUL input, DTD/entity declarations, absolute/remote/escaping references, and executable schema extensions are rejected. Schematron expressions and imported XML are never executed. JSON Schema formats are annotations. Regex-bearing keywords are evaluated in a fresh worker that is terminated on completion or after one second; expression count and length, candidate count, and total pair evaluations are capped before dispatch. The focused validator interprets eligible schemas without dynamic code generation, remote loading, custom code, or `unsafe-eval`; work and diagnostic counts are capped.
Sample generation and compatibility results are review aids. A generated document is not guaranteed to satisfy every constraint, and an absence of reported changes does not prove compatibility. Generation refuses a definitely impossible selected `false` JSON Schema branch but does not prove broader satisfiability. JSON validation requires a single declared draft and uses local workspace filenames rather than identifier URIs. Named anchors, nested identifier scopes, dynamic/recursive references, unevaluated keywords, regular expressions, and full meta-schema validation are outside v0.1.2. XSD, Relax NG, and Schematron instance validation is also outside v0.1.2; OpenAPI inspection is not a full conformance certification.
Sample generation and compatibility results are review aids. A generated document is not guaranteed to satisfy every constraint, and an absence of reported changes does not prove compatibility. Generation refuses a definitely impossible selected `false` JSON Schema branch but does not prove broader satisfiability. JSON validation requires a single declared draft and uses local workspace filenames rather than identifier URIs. Named anchors, nested identifier scopes, dynamic/recursive references, unevaluated keywords, and full meta-schema validation remain outside the focused subset. XSD, Relax NG, and Schematron instance validation is also outside the current scope; OpenAPI inspection is not a full conformance certification.