spec(v1.0): Implement Strict Catalog JSON Schema Restrictions and Consolidation#1629
spec(v1.0): Implement Strict Catalog JSON Schema Restrictions and Consolidation#1629jacobsimionato wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the catalog schemas by inlining the layout weight property directly into individual components and removing the shared CatalogComponentCommon definition, aligning with new structural restrictions documented in a2ui_protocol.md. Additionally, client_capabilities.json has been updated to strictly define $defs properties. The review feedback suggests two key improvements: expanding the documented list of allowed external $ref targets in a2ui_protocol.md to include ComponentCommon, Checkable, and Action, and tightening the anyComponent and anyFunction schemas in client_capabilities.json by referencing the JSON Schema draft-2020-12 meta-schema.
| - External `$ref` targets MUST reference the standard types inside `common_types.json` (`https://a2ui.org/specification/v1_0/common_types.json#/$defs/...`), limited to the following allowed schemas: | ||
| - `ComponentId` | ||
| - `ChildList` | ||
| - `DynamicString` | ||
| - `DynamicNumber` | ||
| - `DynamicBoolean` | ||
| - `DynamicStringList` | ||
| - `DynamicValue` | ||
| - `CheckRule` |
There was a problem hiding this comment.
The list of allowed external $ref targets from common_types.json is missing several schemas that are actively used in the standard catalogs:
ComponentCommon(used by all components for baseline identity and accessibility attributes)Checkable(used by input components and buttons for client-side checks)Action(used by buttons to define interaction handlers)
To ensure the documentation is complete and accurate, please add these schemas to the allowed list.
Suggested change:
- External `$ref` targets MUST reference the standard types inside `common_types.json` (`https://a2ui.org/specification/v1_0/common_types.json#/$defs/...`), limited to the following allowed schemas:
- `ComponentId`
- `ChildList`
- `DynamicString`
- `DynamicNumber`
- `DynamicBoolean`
- `DynamicStringList`
- `DynamicValue`
- `CheckRule`
- `ComponentCommon`
- `Checkable`
- `Action`| "anyComponent": { | ||
| "type": "object", | ||
| "description": "Unified validation schema for all components." | ||
| }, | ||
| "anyFunction": { | ||
| "type": "object", | ||
| "description": "Unified validation schema for all functions." | ||
| } |
There was a problem hiding this comment.
The anyComponent and anyFunction schemas are defined with a loose "type": "object". Since they are themselves JSON Schemas that validate components and functions, they should be defined as references to the JSON Schema draft-2020-12 meta-schema. This ensures strictness and consistency with surfaceProperties (which correctly uses "$ref": "https://json-schema.org/draft/2020-12/schema").
"anyComponent": {
"title": "A2UI Any Component Schema",
"description": "Unified validation schema for all components.",
"$ref": "https://json-schema.org/draft/2020-12/schema"
},
"anyFunction": {
"title": "A2UI Any Function Schema",
"description": "Unified validation schema for all functions.",
"$ref": "https://json-schema.org/draft/2020-12/schema"
}
Description
This pull request implements strict JSON Schema restrictions on component and function catalogs as proposed under A2UI v1.0, and resolves a schema discrepancy regarding
surfaceProperties.These structural constraints are designed to allow catalog files (
catalog.json) to be translated reliably into alternative LLM-friendly DSL formats (e.g., HTML-like XML or compact functional/programmatic DSLs) and directly mapped to type-safe client SDK models.Closes #1627
Rationale
surfacePropertieswas expected at the top level of the Catalog object inclient_capabilities.jsonbut implemented inside$defsin actual catalogs.Detailed Breakdown of Changes
client_capabilities.json):surfacePropertiesunder the Catalog$defsproperty as a reference to a JSON Schema itself, correcting the mismatch.$defsin Catalog to exclusively permit the standard keys:anyComponent,anyFunction, andsurfaceProperties.catalog.json):CatalogComponentCommonhelper definition."weight"property schema directly within all individual component definitions.a2ui_protocol.md):Catalog JSON Schema Structural Restrictionsin the v1.0 protocol document.Catalog Conventions (The "Unwritten Rules").Verification & Testing
To verify these changes locally:
client_capabilities.jsonand follow the strict identifier naming rules.