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 3 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.
| - All helper properties (such as the relative layout `weight` property) MUST be inlined directly inside the properties block of each supporting component schema rather than referenced from a shared helper. | ||
| 3. **Restricted `$ref` Targets:** | ||
| - Local `$ref` targets are restricted to referencing the catalog's top-level components or functions (e.g., `#/components/Text`, `#/functions/required`). | ||
| - 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: |
There was a problem hiding this comment.
Instead of a list that needs to be maintained, couldn't you say:
| - 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: | |
| - External `$ref` targets MUST only reference the standard types inside `common_types.json` (`https://a2ui.org/specification/v1_0/common_types.json#/$defs/...`), and is limited to that set of schemas. |
Then we could avoid the list. I just worry that it will immediately be out of date.
Co-authored-by: Greg Spencer <gspencergoog@users.noreply.github.com> Signed-off-by: jacobsimionato <jacob.simionato@gmail.com>
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.