@aestheticfunction/dspack-emit 0.4.0 → 0.5.0

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.
Files changed (74) hide show
  1. package/README.md +16 -6
  2. package/dist/cli.js +56 -0
  3. package/dist/index.d.ts +4 -1
  4. package/dist/index.js +3 -1
  5. package/dist/targets/a2ui/diagnostics.d.ts +110 -0
  6. package/dist/targets/a2ui/diagnostics.js +94 -0
  7. package/dist/targets/a2ui/surface.d.ts +28 -9
  8. package/dist/targets/a2ui/surface.js +566 -224
  9. package/dist/transform/desugar.d.ts +32 -0
  10. package/dist/transform/desugar.js +156 -0
  11. package/dist/transform/emit.js +59 -0
  12. package/dist/transform/index.js +4 -0
  13. package/dist/transform/mapping.d.ts +0 -6
  14. package/dist/transform/mapping.js +50 -0
  15. package/dist/transform/model.d.ts +275 -0
  16. package/dist/transform/model.js +148 -0
  17. package/dist/transform/parse-v2.d.ts +78 -0
  18. package/dist/transform/parse-v2.js +305 -0
  19. package/dist/transform/profile-load.d.ts +8 -7
  20. package/dist/transform/profile-load.js +101 -24
  21. package/dist/transform/profile-schema-v2.d.ts +9 -0
  22. package/dist/transform/profile-schema-v2.js +430 -0
  23. package/dist/transform/profile-schema.d.ts +8 -0
  24. package/dist/transform/profile-schema.js +382 -0
  25. package/dist/transform/profiles.d.ts +31 -1
  26. package/dist/transform/scaffold.d.ts +29 -12
  27. package/dist/transform/scaffold.js +91 -31
  28. package/dist/transform/shadcn-v2-respelling.d.ts +12 -0
  29. package/dist/transform/shadcn-v2-respelling.js +49 -0
  30. package/dist/transform/validate-v2.d.ts +36 -0
  31. package/dist/transform/validate-v2.js +100 -0
  32. package/dist/types.d.ts +19 -0
  33. package/dist/validate/ajv.js +98 -29
  34. package/dist/validate/meta/catalog-meta.d.ts +10 -0
  35. package/dist/validate/meta/catalog-meta.js +157 -0
  36. package/package.json +3 -3
  37. package/src/__snapshots__/byte-neutral.test.ts.snap +66 -0
  38. package/src/browser-boundary.test.ts +47 -0
  39. package/src/byte-neutral.test.ts +246 -0
  40. package/src/cli.ts +60 -0
  41. package/src/dangling-ref.test.ts +118 -0
  42. package/src/desugar.test.ts +162 -0
  43. package/src/engine-boundary.test.ts +248 -0
  44. package/src/eval-fixture.test.ts +89 -0
  45. package/src/functions.test.ts +182 -0
  46. package/src/index.ts +4 -1
  47. package/src/profile-load.test.ts +99 -1
  48. package/src/profile-v2.test.ts +363 -0
  49. package/src/review-findings.test.ts +292 -0
  50. package/src/schema-mirrors.test.ts +35 -0
  51. package/src/surface-fidelity.test.ts +213 -0
  52. package/src/targets/a2ui/diagnostics.ts +136 -0
  53. package/src/targets/a2ui/surface.ts +920 -242
  54. package/src/transform/desugar.ts +194 -0
  55. package/src/transform/emit.ts +65 -0
  56. package/src/transform/index.ts +5 -0
  57. package/src/transform/mapping.ts +42 -0
  58. package/src/transform/model.ts +325 -0
  59. package/src/transform/parse-v2.ts +397 -0
  60. package/src/transform/profile-load.ts +107 -28
  61. package/src/transform/profile-schema-v2.ts +430 -0
  62. package/src/transform/profile-schema.ts +382 -0
  63. package/src/transform/profile.v2.schema.json +422 -0
  64. package/src/transform/profiles.ts +32 -1
  65. package/src/transform/scaffold.ts +124 -47
  66. package/src/transform/shadcn-v2-respelling.ts +61 -0
  67. package/src/transform/validate-v2.ts +138 -0
  68. package/src/types.ts +20 -0
  69. package/src/validate/ajv.ts +91 -32
  70. package/src/validate/meta/catalog-meta.ts +167 -0
  71. package/src/validate-v2.test.ts +173 -0
  72. package/dist/transform/profile.v1.schema.json +0 -153
  73. package/dist/validate/meta/a2ui-catalog.meta.0_9_1.json +0 -39
  74. package/dist/validate/meta/a2ui-catalog.meta.1_0.json +0 -34
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Runtime mirrors of the catalog-shape meta-schemas. The .json files beside
3
+ * this module stay the reviewable documents (README points reviewers at
4
+ * src/validate/meta/); these constants exist because validateCatalog must run
5
+ * in a browser bundle (dspack-studio composer), where readFileSync is not
6
+ * available. src/schema-mirrors.test.ts asserts mirror and JSON stay
7
+ * identical — edit both together.
8
+ */
9
+ import type { A2uiVersion, Json } from "../../types.js";
10
+
11
+ export const catalogMetaSchemas: Record<A2uiVersion, Json> = {
12
+ "0.9.1": {
13
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
14
+ "$id": "https://rdombrowski.dev/meta/a2ui-catalog.v0_9_1.json",
15
+ "title": "A2UI catalog shape (v0.9.1)",
16
+ "description": "Structural invariants an A2UI v0.9.1 catalog must satisfy, derived from the checked-in basic catalog fixture. The version-distinguishing requirement is $defs.theme (with primaryColor).",
17
+ "type": "object",
18
+ "required": [
19
+ "$schema",
20
+ "$id",
21
+ "catalogId",
22
+ "title",
23
+ "description",
24
+ "components",
25
+ "$defs"
26
+ ],
27
+ "properties": {
28
+ "catalogId": {
29
+ "type": "string",
30
+ "format": "uri"
31
+ },
32
+ "$id": {
33
+ "type": "string",
34
+ "format": "uri"
35
+ },
36
+ "components": {
37
+ "type": "object",
38
+ "minProperties": 1,
39
+ "additionalProperties": {
40
+ "type": "object",
41
+ "required": [
42
+ "allOf",
43
+ "unevaluatedProperties"
44
+ ],
45
+ "properties": {
46
+ "allOf": {
47
+ "type": "array",
48
+ "minItems": 1
49
+ },
50
+ "unevaluatedProperties": {
51
+ "const": false
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "$defs": {
57
+ "type": "object",
58
+ "required": [
59
+ "anyComponent",
60
+ "theme"
61
+ ],
62
+ "not": {
63
+ "required": [
64
+ "surfaceProperties"
65
+ ]
66
+ },
67
+ "properties": {
68
+ "anyComponent": {
69
+ "type": "object",
70
+ "required": [
71
+ "oneOf"
72
+ ]
73
+ },
74
+ "theme": {
75
+ "type": "object",
76
+ "required": [
77
+ "properties"
78
+ ],
79
+ "properties": {
80
+ "properties": {
81
+ "type": "object",
82
+ "required": [
83
+ "primaryColor"
84
+ ]
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ },
92
+ "1.0": {
93
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
94
+ "$id": "https://rdombrowski.dev/meta/a2ui-catalog.v1_0.json",
95
+ "title": "A2UI catalog shape (v1.0)",
96
+ "description": "Structural invariants an A2UI v1.0 catalog must satisfy, derived from the checked-in basic catalog fixture. The version-distinguishing requirement is $defs.surfaceProperties (and the absence of $defs.theme).",
97
+ "type": "object",
98
+ "required": [
99
+ "$schema",
100
+ "$id",
101
+ "catalogId",
102
+ "title",
103
+ "description",
104
+ "components",
105
+ "$defs"
106
+ ],
107
+ "properties": {
108
+ "catalogId": {
109
+ "type": "string",
110
+ "format": "uri"
111
+ },
112
+ "$id": {
113
+ "type": "string",
114
+ "format": "uri"
115
+ },
116
+ "instructions": {
117
+ "type": "string"
118
+ },
119
+ "components": {
120
+ "type": "object",
121
+ "minProperties": 1,
122
+ "additionalProperties": {
123
+ "type": "object",
124
+ "required": [
125
+ "allOf",
126
+ "unevaluatedProperties"
127
+ ],
128
+ "properties": {
129
+ "allOf": {
130
+ "type": "array",
131
+ "minItems": 1
132
+ },
133
+ "unevaluatedProperties": {
134
+ "const": false
135
+ }
136
+ }
137
+ }
138
+ },
139
+ "$defs": {
140
+ "type": "object",
141
+ "required": [
142
+ "anyComponent",
143
+ "surfaceProperties"
144
+ ],
145
+ "not": {
146
+ "required": [
147
+ "theme"
148
+ ]
149
+ },
150
+ "properties": {
151
+ "anyComponent": {
152
+ "type": "object",
153
+ "required": [
154
+ "oneOf"
155
+ ]
156
+ },
157
+ "surfaceProperties": {
158
+ "type": "object",
159
+ "required": [
160
+ "properties"
161
+ ]
162
+ }
163
+ }
164
+ }
165
+ }
166
+ },
167
+ };
@@ -0,0 +1,173 @@
1
+ /**
2
+ * Contract-facing validation: what a profile can only be wrong about against
3
+ * a contract, proven to refuse (v2) and proven NOT to change behaviour (v1).
4
+ *
5
+ * The enforcement decision this file records: derived sub-component coverage
6
+ * is fatal for v2 profiles at every entry, and report-plus-`--strict-coverage`
7
+ * for v1. Measured before enforcement (scripts/sub-coverage-report.mjs, the
8
+ * 2aac076 record): pinned shadcn v2.3.0, astryx and acme all derive zero
9
+ * unresolved subs — so the fatal gate refuses no shipped artifact, only
10
+ * future profiles with genuine gaps, which is the point.
11
+ */
12
+ import { readFileSync } from "node:fs";
13
+ import { fileURLToPath } from "node:url";
14
+ import { describe, expect, it } from "vitest";
15
+ import { transformFromJson } from "./transform/index.js";
16
+ import { emitSurface } from "./targets/a2ui/surface.js";
17
+ import { loadProfile } from "./transform/profile-load.js";
18
+ import { ProfileContractError } from "./transform/validate-v2.js";
19
+ import { shadcnProfile } from "./transform/profiles.js";
20
+ import type { DspackDoc, DspackSurface } from "./types.js";
21
+
22
+ const repo = (p: string) => fileURLToPath(new URL(`../${p}`, import.meta.url));
23
+ const doc = JSON.parse(readFileSync(repo("input/shadcn-ui.dspack.json"), "utf8")) as DspackDoc;
24
+
25
+ /** A minimal v2 document whose one plan maps the contract's `card` compound. */
26
+ const v2Doc = (surface: unknown): Record<string, unknown> => ({
27
+ profileVersion: "2",
28
+ catalogTitle: "t",
29
+ catalogDescription: "d",
30
+ catalogIdBase: "https://example.test/catalogs/x",
31
+ instructions: "",
32
+ primaryColorToken: { category: "color", name: "primary" },
33
+ surfaceSynthesis: { textComponent: "Text", textProp: "text", wrapComponent: "Column", wrapChildrenProp: "children" },
34
+ synthesized: [
35
+ {
36
+ a2ui: "Text",
37
+ commons: ["ComponentCommon"],
38
+ structural: { text: { schema: { type: "string" }, description: "d", synthNote: "s" } },
39
+ propMap: { variant: { a2ui: "variant", kind: "enum", targetEnum: ["body", "h3", "caption"] } },
40
+ required: ["text"],
41
+ },
42
+ {
43
+ a2ui: "Column",
44
+ commons: ["ComponentCommon"],
45
+ structural: { children: { schema: { type: "array" }, description: "d", synthNote: "s" } },
46
+ required: ["children"],
47
+ },
48
+ ],
49
+ casualtyComponents: [],
50
+ components: [
51
+ {
52
+ a2ui: "Card",
53
+ dspackId: "card",
54
+ commons: ["ComponentCommon"],
55
+ structural: {
56
+ child: { schema: { type: "string" }, description: "d", synthNote: "s" },
57
+ label: { schema: { type: "string" }, description: "d", synthNote: "s" },
58
+ },
59
+ required: ["child"],
60
+ surface,
61
+ },
62
+ ],
63
+ });
64
+
65
+ /** The full card sub-family, resolved — the baseline that passes the gate. */
66
+ const RESOLVED = {
67
+ routes: [{ from: ["children"], to: "slot:child" }],
68
+ subs: {
69
+ "card-header": "transparent",
70
+ "card-content": "transparent",
71
+ "card-footer": "transparent",
72
+ "card-title": { asText: "h3" },
73
+ "card-description": { asText: "caption" },
74
+ },
75
+ };
76
+
77
+ const refusal = (surface: unknown): string => {
78
+ try {
79
+ transformFromJson(doc, { profile: loadProfile(v2Doc(surface)) });
80
+ return "PASSED";
81
+ } catch (e) {
82
+ if (e instanceof ProfileContractError) return e.issues.map((i) => `${i.path}: ${i.message}`).join("\n");
83
+ throw e;
84
+ }
85
+ };
86
+
87
+ describe("v2 contract validation refuses before emission", () => {
88
+ it("a fully resolved plan passes the gate", () => {
89
+ expect(refusal(RESOLVED)).toBe("PASSED");
90
+ });
91
+
92
+ it("an unresolved sub-component refuses, naming the sub and the decision to make", () => {
93
+ const { subs } = structuredClone(RESOLVED) as { subs: Record<string, unknown> };
94
+ delete subs["card-footer"];
95
+ const out = refusal({ ...RESOLVED, subs });
96
+ expect(out).toContain("'card-footer' of 'card' is unresolved");
97
+ expect(out).toContain("route, collect, transparent, asText, or drop");
98
+ });
99
+
100
+ it("a sub the contract does not declare refuses", () => {
101
+ const out = refusal({
102
+ ...RESOLVED,
103
+ subs: { ...RESOLVED.subs, "card-sidebar": "transparent" },
104
+ });
105
+ expect(out).toContain("'card-sidebar' is not a declared sub-component of 'card'");
106
+ });
107
+
108
+ it("reading an undeclared prop into a renamed destination refuses; the passthrough shape passes", () => {
109
+ const renamed = refusal({
110
+ ...RESOLVED,
111
+ routes: [...RESOLVED.routes, { from: ["self.props.badge"], to: "prop:label" }],
112
+ });
113
+ expect(renamed).toContain("self.props.badge");
114
+ expect(renamed).toContain("not a same-named structural passthrough");
115
+
116
+ const passthrough = refusal({
117
+ ...RESOLVED,
118
+ routes: [...RESOLVED.routes, { from: ["self.props.label"], to: "prop:label" }],
119
+ });
120
+ expect(passthrough).toBe("PASSED");
121
+ });
122
+
123
+ it("emitSurface runs the same gate as transform", () => {
124
+ const { subs } = structuredClone(RESOLVED) as { subs: Record<string, unknown> };
125
+ delete subs["card-footer"];
126
+ const surface: DspackSurface = {
127
+ dspackSurface: "0.1",
128
+ system: doc.name as string,
129
+ intent: "record-collection",
130
+ root: { component: "card", children: [] },
131
+ } as unknown as DspackSurface;
132
+ expect(() => emitSurface(surface, doc, { profile: loadProfile(v2Doc({ ...RESOLVED, subs })) })).toThrowError(
133
+ ProfileContractError,
134
+ );
135
+ });
136
+ });
137
+
138
+ describe("v1 behaviour is frozen: report, not refusal", () => {
139
+ it("a v1 profile with an unresolved sub still transforms — the gap lands in coverage", () => {
140
+ // The shipped card plan, its subFlatten stripped: card's five subs become
141
+ // unresolved. v1 must keep transforming (byte-frozen behaviour) while the
142
+ // coverage report says exactly what is missing.
143
+ const gappy = {
144
+ ...structuredClone(shadcnProfile),
145
+ components: shadcnProfile.components.map((p) =>
146
+ p.dspackId === "card" ? { ...p, surfacePlan: { childProp: "child" } } : p,
147
+ ),
148
+ };
149
+ const out = transformFromJson(doc, { profile: gappy });
150
+ const unresolved = out.mapping.coverage.filter(
151
+ (c) => c.disposition === "unclassified" && c.id.startsWith("card."),
152
+ );
153
+ expect(unresolved.map((c) => c.id).sort()).toEqual([
154
+ "card.card-content",
155
+ "card.card-description",
156
+ "card.card-footer",
157
+ "card.card-header",
158
+ "card.card-title",
159
+ ]);
160
+ // And the strict-coverage contract: these are exactly what exit 3 keys on.
161
+ expect(out.mapping.warnings.some((w) => w.code === "unresolved-sub:card.card-title")).toBe(true);
162
+ });
163
+
164
+ it("the shipped profiles derive zero unresolved subs — the measured gate behind enforcement", () => {
165
+ const out = transformFromJson(doc, { profile: shadcnProfile });
166
+ const unresolved = out.mapping.coverage.filter((c) => c.disposition === "unclassified");
167
+ expect(unresolved).toEqual([]);
168
+ // Derived sub rows exist and carry their classification.
169
+ const subRows = out.mapping.coverage.filter((c) => c.id.includes("."));
170
+ expect(subRows.length).toBeGreaterThanOrEqual(20);
171
+ expect(subRows.every((c) => c.disposition === "mapped" && c.detail)).toBe(true);
172
+ });
173
+ });
@@ -1,153 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://aestheticfunction.github.io/dspack-emit/schema/profile.v1.schema.json",
4
- "title": "dspack-emit a2ui Profile v1",
5
- "description": "JSON form of the a2ui target's mapping Profile. Mirrors the TypeScript Profile interface in src/transform/profiles.ts one to one; loadProfile() validates against this schema before the engine runs.",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "patternProperties": { "^x-": {} },
9
- "required": [
10
- "profileVersion",
11
- "catalogTitle",
12
- "catalogDescription",
13
- "catalogIdBase",
14
- "instructions",
15
- "primaryColorToken",
16
- "components",
17
- "synthesized",
18
- "casualtyComponents",
19
- "surfaceSynthesis"
20
- ],
21
- "properties": {
22
- "profileVersion": { "const": "1" },
23
- "catalogTitle": { "type": "string", "minLength": 1 },
24
- "catalogDescription": { "type": "string", "minLength": 1 },
25
- "catalogIdBase": { "type": "string", "format": "uri", "pattern": "^https://" },
26
- "instructions": { "type": "string" },
27
- "primaryColorToken": {
28
- "type": "object",
29
- "additionalProperties": false,
30
- "required": ["category", "name"],
31
- "properties": {
32
- "category": { "type": "string", "minLength": 1 },
33
- "name": { "type": "string", "minLength": 1 }
34
- }
35
- },
36
- "components": { "type": "array", "items": { "$ref": "#/$defs/componentPlan" } },
37
- "synthesized": { "type": "array", "items": { "$ref": "#/$defs/componentPlan" } },
38
- "casualtyComponents": {
39
- "type": "array",
40
- "items": {
41
- "type": "object",
42
- "additionalProperties": false,
43
- "patternProperties": { "^x-": {} },
44
- "required": ["dspackId", "attempted", "class", "reason"],
45
- "properties": {
46
- "dspackId": { "$ref": "#/$defs/dspackId" },
47
- "attempted": { "type": "string", "minLength": 1 },
48
- "class": { "enum": ["maps-cleanly", "synthesis-defaults", "lossy", "cannot-represent"] },
49
- "reason": { "type": "string", "minLength": 1 }
50
- }
51
- }
52
- },
53
- "intentionallyOmitted": { "type": "array", "items": { "$ref": "#/$defs/dspackId" } },
54
- "surfaceSynthesis": {
55
- "type": "object",
56
- "additionalProperties": false,
57
- "required": ["textComponent", "textProp", "wrapComponent", "wrapChildrenProp"],
58
- "properties": {
59
- "textComponent": { "$ref": "#/$defs/a2uiName" },
60
- "textProp": { "type": "string", "minLength": 1 },
61
- "wrapComponent": { "$ref": "#/$defs/a2uiName" },
62
- "wrapChildrenProp": { "type": "string", "minLength": 1 }
63
- }
64
- }
65
- },
66
- "$defs": {
67
- "dspackId": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" },
68
- "a2uiName": { "type": "string", "pattern": "^[A-Z][A-Za-z0-9]*$" },
69
- "componentPlan": {
70
- "type": "object",
71
- "additionalProperties": false,
72
- "patternProperties": { "^x-": {} },
73
- "required": ["a2ui", "commons", "structural", "required"],
74
- "properties": {
75
- "a2ui": { "$ref": "#/$defs/a2uiName" },
76
- "dspackId": { "$ref": "#/$defs/dspackId" },
77
- "description": { "type": "string" },
78
- "commons": { "type": "array", "items": { "type": "string", "minLength": 1 } },
79
- "structural": {
80
- "type": "object",
81
- "additionalProperties": {
82
- "type": "object",
83
- "additionalProperties": false,
84
- "required": ["schema", "description", "synthNote"],
85
- "properties": {
86
- "schema": {},
87
- "description": { "type": "string", "minLength": 1 },
88
- "synthNote": { "type": "string", "minLength": 1 }
89
- }
90
- }
91
- },
92
- "propMap": {
93
- "type": "object",
94
- "additionalProperties": {
95
- "type": "object",
96
- "additionalProperties": false,
97
- "required": ["a2ui", "kind"],
98
- "properties": {
99
- "a2ui": { "type": "string", "minLength": 1 },
100
- "kind": { "enum": ["enum", "string", "boolean", "number"] },
101
- "targetEnum": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
102
- "valueMap": { "type": "object", "additionalProperties": { "type": "string" } },
103
- "default": { "type": "string" },
104
- "description": { "type": "string" }
105
- }
106
- }
107
- },
108
- "required": { "type": "array", "items": { "type": "string" } },
109
- "surfacePlan": {
110
- "type": "object",
111
- "additionalProperties": false,
112
- "properties": {
113
- "subText": { "type": "object", "additionalProperties": { "type": "string" } },
114
- "subButtonText": { "type": "object", "additionalProperties": { "type": "string" } },
115
- "actionProp": { "type": "string" },
116
- "textChildProp": { "type": "string" },
117
- "textProp": { "type": "string" },
118
- "childProp": { "type": "string" },
119
- "childrenProp": { "type": "string" },
120
- "structuralPassthrough": { "type": "array", "items": { "type": "string" } },
121
- "subTable": {
122
- "type": "object",
123
- "additionalProperties": false,
124
- "required": ["caption", "header", "headerCell", "body", "row", "cell", "targetCaption", "targetColumns", "targetRows", "drops"],
125
- "properties": {
126
- "caption": { "type": "string" },
127
- "header": { "type": "string" },
128
- "headerCell": { "type": "string" },
129
- "body": { "type": "string" },
130
- "row": { "type": "string" },
131
- "cell": { "type": "string" },
132
- "targetCaption": { "type": "string" },
133
- "targetColumns": { "type": "string" },
134
- "targetRows": { "type": "string" },
135
- "drops": { "type": "object", "additionalProperties": { "type": "string" } }
136
- }
137
- },
138
- "subFlatten": {
139
- "type": "object",
140
- "additionalProperties": false,
141
- "required": ["transparent", "asText"],
142
- "properties": {
143
- "transparent": { "type": "array", "items": { "$ref": "#/$defs/dspackId" } },
144
- "asText": { "type": "object", "additionalProperties": { "type": "string" } }
145
- }
146
- }
147
- }
148
- },
149
- "subCoverage": { "type": "object", "additionalProperties": { "type": "string" } }
150
- }
151
- }
152
- }
153
- }
@@ -1,39 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://rdombrowski.dev/meta/a2ui-catalog.v0_9_1.json",
4
- "title": "A2UI catalog shape (v0.9.1)",
5
- "description": "Structural invariants an A2UI v0.9.1 catalog must satisfy, derived from the checked-in basic catalog fixture. The version-distinguishing requirement is $defs.theme (with primaryColor).",
6
- "type": "object",
7
- "required": ["$schema", "$id", "catalogId", "title", "description", "components", "$defs"],
8
- "properties": {
9
- "catalogId": { "type": "string", "format": "uri" },
10
- "$id": { "type": "string", "format": "uri" },
11
- "components": {
12
- "type": "object",
13
- "minProperties": 1,
14
- "additionalProperties": {
15
- "type": "object",
16
- "required": ["allOf", "unevaluatedProperties"],
17
- "properties": {
18
- "allOf": { "type": "array", "minItems": 1 },
19
- "unevaluatedProperties": { "const": false }
20
- }
21
- }
22
- },
23
- "$defs": {
24
- "type": "object",
25
- "required": ["anyComponent", "theme"],
26
- "not": { "required": ["surfaceProperties"] },
27
- "properties": {
28
- "anyComponent": { "type": "object", "required": ["oneOf"] },
29
- "theme": {
30
- "type": "object",
31
- "required": ["properties"],
32
- "properties": {
33
- "properties": { "type": "object", "required": ["primaryColor"] }
34
- }
35
- }
36
- }
37
- }
38
- }
39
- }
@@ -1,34 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://rdombrowski.dev/meta/a2ui-catalog.v1_0.json",
4
- "title": "A2UI catalog shape (v1.0)",
5
- "description": "Structural invariants an A2UI v1.0 catalog must satisfy, derived from the checked-in basic catalog fixture. The version-distinguishing requirement is $defs.surfaceProperties (and the absence of $defs.theme).",
6
- "type": "object",
7
- "required": ["$schema", "$id", "catalogId", "title", "description", "components", "$defs"],
8
- "properties": {
9
- "catalogId": { "type": "string", "format": "uri" },
10
- "$id": { "type": "string", "format": "uri" },
11
- "instructions": { "type": "string" },
12
- "components": {
13
- "type": "object",
14
- "minProperties": 1,
15
- "additionalProperties": {
16
- "type": "object",
17
- "required": ["allOf", "unevaluatedProperties"],
18
- "properties": {
19
- "allOf": { "type": "array", "minItems": 1 },
20
- "unevaluatedProperties": { "const": false }
21
- }
22
- }
23
- },
24
- "$defs": {
25
- "type": "object",
26
- "required": ["anyComponent", "surfaceProperties"],
27
- "not": { "required": ["theme"] },
28
- "properties": {
29
- "anyComponent": { "type": "object", "required": ["oneOf"] },
30
- "surfaceProperties": { "type": "object", "required": ["properties"] }
31
- }
32
- }
33
- }
34
- }