Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tools/src/main/js/bundler/test/fixtures/main.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"title": "Main",
"description": "Root document of the bundler test fixtures.",
"type": "object",
"required": [
"whole"
],
"examples": [
{"whole": {}}
],
"$comment": "FIXTURE: root schema; entry point of the bundle. This $comment is the only one that survives minification. The root title/description must survive in both outputs. The root `required`/`examples` are data arrays inside the (reached) root schema and must survive the tree-shaker untouched.",
"properties": {
"$comment": {
"$comment": "the comment property is expected to stay - but this comment might be removed.",
Expand All @@ -17,6 +24,12 @@
"description": "A module referenced in its entirety.",
"$ref": "modules/used-whole.schema.json"
},
"wholeData": {
"$comment": "External ref without fragment to a module whose reached schemas carry data arrays/maps/literals and boolean subschemas -> all of that must survive the sweep.",
"title": "Whole data",
"description": "A data-heavy module referenced in its entirety.",
"$ref": "modules/used-whole-data.schema.json"
},
"sub": {
"$comment": "External ref into a sub-def -> only that sub-def (and what it reaches) is kept.",
"title": "Sub",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://example.com/test/modules/used-whole-data.schema.json",
"$comment": "FIXTURE: a module referenced as a whole whose REACHED schemas carry non-schema data (arrays, maps, literals) and boolean subschemas. The tree-shaker must leave every one of these byte-for-byte intact: a reached schema may only lose unreferenced `$defs`. Any `null` item, emptied map, or dropped key below is a sweep bug.",
"title": "Used whole data",
"description": "A module referenced in its entirety that carries data-bearing keywords inside reached schemas.",
"type": "object",
"required": [
"status",
"level"
],
"examples": [
{
"status": "on",
"level": 1
},
{
"status": "off",
"level": 2
}
],
"default": {
"status": "on",
"level": 1
},
"properties": {
"status": {
"$comment": "`enum` is a data array inside a reached schema -> items must stay literals, never become `null`. `meta:enum` is a non-schema map -> entries must not be emptied.",
"title": "Status",
"description": "A status value.",
"type": "string",
"enum": [
"on",
"off"
],
"meta:enum": {
"on": "It is on.",
"off": "It is off."
}
},
"level": {
"$comment": "`const`, `examples` and `default` are literal data in a reached schema -> must stay as is.",
"title": "Level",
"description": "A fixed level.",
"type": "integer",
"const": 1,
"examples": [
1
],
"default": 1
},
"flags": {
"$comment": "`properties` map that contains BOOLEAN subschemas. Booleans are not schema objects, so `subschemas()` never yields them; the sweep must nevertheless keep the keys `anything`/`nothing` with their boolean values.",
"title": "Flags",
"description": "An object with boolean-schema properties.",
"type": "object",
"required": [
"anything"
],
"properties": {
"anything": true,
"nothing": false
},
"additionalProperties": false
},
"tags": {
"$comment": "`items` is a schema; `uniqueItems`/`minItems` are scalars in a reached schema -> kept.",
"title": "Tags",
"description": "A list of tags.",
"type": "array",
"uniqueItems": true,
"minItems": 0,
"items": {
"title": "Tag",
"description": "A single tag.",
"type": "string"
}
}
},
"$defs": {
"unusedDef": {
"$comment": "The ONLY thing the tree-shaker is allowed to drop from this module.",
"title": "Unused def",
"description": "A definition nothing reachable refers to.",
"type": "null"
}
}
}
Loading
Loading