@aestheticfunction/dspack-emit 0.3.2 → 0.4.1

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.
@@ -0,0 +1,153 @@
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
+ }
@@ -0,0 +1,229 @@
1
+ /**
2
+ * scaffoldProfile: a mechanical 1:1 draft Profile from a dspack contract.
3
+ *
4
+ * Seeded from the json-render CatalogModel (the judgment-free 1:1 IR): every
5
+ * top-level contract component becomes a ComponentPlan with verbatim prop
6
+ * projections; compound sub-components get subFlatten directives derived from
7
+ * their *declared* `acceptsChildren` (text → asText, otherwise transparent).
8
+ *
9
+ * The scaffold invents no judgment: no valueMaps, no casualties, no lossy
10
+ * projections. Everything a human must review is returned as `notes` — the
11
+ * scaffold's analog of dspack-export's `awaitingAuthorship`. The result is a
12
+ * valid v1 profile document (loadProfile accepts it) whose transform passes
13
+ * gates A1/A2 with full coverage; whether each mapping is *right* is the
14
+ * author's call.
15
+ */
16
+ import type { DspackDoc, DspackProp } from "../types.js";
17
+ import { buildCatalogModel, type CatalogComponent } from "../targets/json-render/model.js";
18
+
19
+ export interface ScaffoldOptions {
20
+ /** Required: the project's catalog identity root (https URI). */
21
+ catalogIdBase: string;
22
+ catalogTitle?: string;
23
+ catalogDescription?: string;
24
+ instructions?: string;
25
+ /** Which token supplies theme.primaryColor; auto-detects color.primary when omitted. */
26
+ primaryColorToken?: { category: string; name: string };
27
+ }
28
+
29
+ export interface ScaffoldNote {
30
+ /** What the note is about: a component id, "<id>.<prop>", or a profile field. */
31
+ target: string;
32
+ note: string;
33
+ }
34
+
35
+ export interface ScaffoldResult {
36
+ /** A v1 profile *document* (includes profileVersion; loadProfile accepts it). */
37
+ profile: Record<string, unknown>;
38
+ /** Everything that needs human judgment before the profile is trustworthy. */
39
+ notes: ScaffoldNote[];
40
+ }
41
+
42
+ const DYN_STRING = { $ref: "#/$defs/DynamicString" };
43
+ const CHILD_LIST = { $ref: "#/$defs/ChildList" };
44
+ const COMP_ID = { $ref: "#/$defs/ComponentId" };
45
+
46
+ const TEXT_PLAN = {
47
+ a2ui: "Text",
48
+ commons: ["ComponentCommon"],
49
+ description: "Displays text content. Synthesized A2UI content primitive (not in the contract).",
50
+ structural: {
51
+ text: {
52
+ schema: DYN_STRING,
53
+ description: "The text content to display.",
54
+ synthNote: "A2UI content primitive required to render labels/titles in a surface.",
55
+ },
56
+ },
57
+ propMap: {
58
+ variant: {
59
+ a2ui: "variant",
60
+ kind: "enum",
61
+ targetEnum: ["h1", "h2", "h3", "h4", "h5", "caption", "body"],
62
+ default: "body",
63
+ description: "A hint for the base text style.",
64
+ },
65
+ },
66
+ required: ["text"],
67
+ };
68
+
69
+ const COLUMN_PLAN = {
70
+ a2ui: "Column",
71
+ commons: ["ComponentCommon"],
72
+ description:
73
+ "Arranges children vertically. Synthesized A2UI structural primitive (the contract has no layout component).",
74
+ structural: {
75
+ children: {
76
+ schema: CHILD_LIST,
77
+ description: "Child component IDs (or a template).",
78
+ synthNote: "A2UI structural primitive required to compose multiple children.",
79
+ },
80
+ },
81
+ required: ["children"],
82
+ };
83
+
84
+ interface SubDecl {
85
+ id: string;
86
+ acceptsChildren?: string;
87
+ }
88
+
89
+ function subsOf(doc: DspackDoc, id: string): SubDecl[] {
90
+ const composition = (doc.components?.[id]?.composition ?? {}) as { subComponents?: unknown[] };
91
+ const out: SubDecl[] = [];
92
+ for (const raw of composition.subComponents ?? []) {
93
+ if (typeof raw === "string") out.push({ id: raw });
94
+ else if (raw && typeof raw === "object" && typeof (raw as SubDecl).id === "string") out.push(raw as SubDecl);
95
+ }
96
+ return out;
97
+ }
98
+
99
+ export function scaffoldProfile(doc: DspackDoc, options: ScaffoldOptions): ScaffoldResult {
100
+ const notes: ScaffoldNote[] = [];
101
+ const model = buildCatalogModel(doc, {});
102
+ const byId = new Map<string, CatalogComponent>(model.components.map((c) => [c.dspackId, c]));
103
+ const topLevelIds = Object.keys(doc.components ?? {});
104
+ const name = (id: string) => byId.get(id)?.name ?? id;
105
+
106
+ const usedNames = new Set(topLevelIds.map((id) => name(id)));
107
+
108
+ const components = topLevelIds.map((id) => {
109
+ const entry = byId.get(id)!;
110
+ const contractProps = (doc.components?.[id]?.props ?? {}) as Record<string, DspackProp>;
111
+
112
+ const propMap: Record<string, unknown> = {};
113
+ for (const prop of entry.props) {
114
+ if (prop.synthesized) continue; // the model's universal text prop belongs to json-render, not here
115
+ const plan: Record<string, unknown> = { a2ui: prop.name, kind: prop.kind };
116
+ if (prop.kind === "enum") plan.targetEnum = prop.values;
117
+ const dflt = contractProps[prop.name]?.default;
118
+ if (typeof dflt === "string") plan.default = dflt;
119
+ if (prop.description) plan.description = prop.description;
120
+ propMap[prop.name] = plan;
121
+ }
122
+ for (const excluded of entry.excludedProps) {
123
+ notes.push({
124
+ target: `${id}.${excluded.name}`,
125
+ note: `prop not scaffolded (${excluded.reason}); map it via a structural slot, or declare the component a casualty if it cannot be represented.`,
126
+ });
127
+ }
128
+
129
+ const required = Object.entries(contractProps)
130
+ .filter(([, p]) => p.required === true)
131
+ .map(([propName]) => propName)
132
+ .filter((propName) => propName in propMap);
133
+
134
+ const plan: Record<string, unknown> = {
135
+ a2ui: entry.name,
136
+ dspackId: id,
137
+ commons: ["ComponentCommon"],
138
+ structural: {},
139
+ required,
140
+ };
141
+ if (Object.keys(propMap).length > 0) plan.propMap = propMap;
142
+ else
143
+ notes.push({
144
+ target: id,
145
+ note: "no declarative props were scaffolded; the contract likely needs prop enrichment before this mapping is useful.",
146
+ });
147
+
148
+ const subs = subsOf(doc, id);
149
+ if (subs.length > 0) {
150
+ const transparent = subs.filter((s) => s.acceptsChildren !== "text").map((s) => s.id);
151
+ const asText = Object.fromEntries(subs.filter((s) => s.acceptsChildren === "text").map((s) => [s.id, "body"]));
152
+ plan.structural = {
153
+ child: {
154
+ schema: COMP_ID,
155
+ description: "The ID of the single child component. Wrap multiple elements in a Column and pass its ID.",
156
+ synthNote:
157
+ "Scaffolded: the compound's sub-components flatten (subFlatten) and collapse to a single, possibly Column-wrapped, child slot.",
158
+ },
159
+ };
160
+ (plan.required as string[]).push("child");
161
+ plan.surfacePlan = { childProp: "child", subFlatten: { transparent, asText } };
162
+ plan.subCoverage = Object.fromEntries(
163
+ subs.map((s) => [
164
+ s.id,
165
+ s.acceptsChildren === "text"
166
+ ? "text -> synthesized Text (variant body) [scaffolded from acceptsChildren: text — review]"
167
+ : "transparent grouping: children splice inline, in order [scaffolded — review]",
168
+ ]),
169
+ );
170
+ notes.push({
171
+ target: id,
172
+ note: `compound scaffolded from declared acceptsChildren (${subs.length} sub-components: ${transparent.length} transparent, ${Object.keys(asText).length} asText); review each subCoverage line and pick text variants.`,
173
+ });
174
+ }
175
+
176
+ return plan;
177
+ });
178
+
179
+ const synthesized: Record<string, unknown>[] = [];
180
+ for (const primitive of [TEXT_PLAN, COLUMN_PLAN]) {
181
+ if (usedNames.has(primitive.a2ui)) {
182
+ notes.push({
183
+ target: primitive.a2ui,
184
+ note: `contract already has a component named '${primitive.a2ui}'; the synthesized primitive was skipped — verify surfaceSynthesis points at a component with the expected '${primitive.a2ui === "Text" ? "text" : "children"}' prop.`,
185
+ });
186
+ } else {
187
+ synthesized.push(structuredClone(primitive) as Record<string, unknown>);
188
+ }
189
+ }
190
+
191
+ let primaryColorToken = options.primaryColorToken;
192
+ if (!primaryColorToken) {
193
+ const hasColorPrimary = Boolean((doc.tokens as Record<string, { values?: Record<string, unknown> }> | undefined)?.color?.values?.primary);
194
+ primaryColorToken = { category: "color", name: "primary" };
195
+ notes.push({
196
+ target: "primaryColorToken",
197
+ note: hasColorPrimary
198
+ ? "auto-detected color.primary; verify it is the intended theme primary."
199
+ : "defaulted to color.primary, which this contract does not define — theme.primaryColor will emit null with a warning until you point this at a real token.",
200
+ });
201
+ }
202
+
203
+ const profile: Record<string, unknown> = {
204
+ profileVersion: "1",
205
+ catalogTitle: options.catalogTitle ?? `${doc.name} — A2UI catalog (compiled from dspack)`,
206
+ catalogDescription:
207
+ options.catalogDescription ??
208
+ `A2UI catalog compiled from the ${doc.name} dspack contract by scaffoldProfile. Mechanical 1:1 draft: review the scaffold notes before trusting any mapping.`,
209
+ catalogIdBase: options.catalogIdBase,
210
+ instructions: options.instructions ?? "For layout, use the Column component to organize other components.",
211
+ primaryColorToken,
212
+ components,
213
+ synthesized,
214
+ casualtyComponents: [],
215
+ surfaceSynthesis: {
216
+ textComponent: "Text",
217
+ textProp: "text",
218
+ wrapComponent: "Column",
219
+ wrapChildrenProp: "children",
220
+ },
221
+ };
222
+
223
+ notes.push({
224
+ target: "casualtyComponents",
225
+ note: "scaffolds never declare casualties; components that cannot be represented must be moved here by the author, with a reason.",
226
+ });
227
+
228
+ return { profile, notes };
229
+ }
@@ -12,10 +12,9 @@
12
12
  * 3. instance: every component instance in the hand-authored surface validates
13
13
  * against the catalog's own #/$defs/anyComponent.
14
14
  */
15
- import { readFileSync } from "node:fs";
16
- import { fileURLToPath } from "node:url";
17
15
  import Ajv2020 from "ajv/dist/2020.js";
18
16
  import addFormats from "ajv-formats";
17
+ import { catalogMetaSchemas } from "./meta/catalog-meta.js";
19
18
  import type { A2uiCatalog, A2uiVersion, Json } from "../types.js";
20
19
 
21
20
  export interface GateResult {
@@ -31,9 +30,6 @@ export interface ValidationReport {
31
30
  gates: GateResult[];
32
31
  }
33
32
 
34
- const metaPath = (ver: A2uiVersion): string =>
35
- fileURLToPath(new URL(`./meta/a2ui-catalog.meta.${ver === "0.9.1" ? "0_9_1" : "1_0"}.json`, import.meta.url));
36
-
37
33
  function newAjv(): Ajv2020 {
38
34
  const ajv = new Ajv2020({ strict: false, allErrors: true, validateFormats: true });
39
35
  addFormats(ajv);
@@ -95,7 +91,7 @@ export function validateCatalog(
95
91
  });
96
92
 
97
93
  // Gate 2 — catalog shape.
98
- const meta = JSON.parse(readFileSync(metaPath(version), "utf8")) as Json;
94
+ const meta = catalogMetaSchemas[version];
99
95
  const validateShape = newAjv().compile(meta);
100
96
  const shapeOk = validateShape(catalog) as boolean;
101
97
  gates.push({
@@ -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
+ };
@@ -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
- }