Skip to content

feat(swift): define A2UI v0.9.1 common type schemas with swift-json-schema#1994

Merged
gspencergoog merged 11 commits into
a2ui-project:mainfrom
pinieb:swift-2
Jul 17, 2026
Merged

feat(swift): define A2UI v0.9.1 common type schemas with swift-json-schema#1994
gspencergoog merged 11 commits into
a2ui-project:mainfrom
pinieb:swift-2

Conversation

@pinieb

@pinieb pinieb commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Description

Implements all 14 A2UI v0.9.1 common type JSON Schema definitions using
the swift-json-schema fork. Schemas are defined as a raw JSON document
matching the specification's common_types.json exactly, and registered
into Context via the remoteSchema parameter for $ref resolution.

Changes:

  • Define complete common types document in A2UICommonSchema (all 14
    defs: ComponentId, AccessibilityAttributes, ComponentCommon, ChildList,
    DataBinding, DynamicValue, DynamicString, DynamicNumber, DynamicBoolean,
    DynamicStringList, FunctionCall, CheckRule, Checkable, Action)
  • Add A2UISchemaRegistry helper to create a Context pre-populated with
    A2UI schemas
  • Add 31 tests covering URI helpers, document structure, schema registry,
    validation of all schema types (positive and negative cases), and
    cross-reference resolution (including recursive Action → FunctionCall
    → DynamicValue chains)
  • Remove placeholder A2UIJSONTests (superseded by comprehensive tests)

Design notes:

  • Raw JSON string approach used instead of JSONValue dictionary literals
    to avoid Swift type-checker issues with deeply nested expressions
  • FunctionCall's catalog.json oneOf reference omitted; catalog-level
    validation handled at runtime by ComponentCatalog
  • Context.remoteSchemaStorage is internal in the fork, so schemas are
    registered via the Context(remoteSchema:) initializer

Verification:

  • swift build passes (all targets)
  • swift test passes (34 tests in 3 suites, 0.017s)

pinieb added 5 commits July 8, 2026 11:37
…ma dependency

Replaces the custom JSONSchema target with a multi-target Swift package
structure that uses the swift-json-schema fork (v0.13.1) as an external
dependency. This is the foundation for porting the A2UI v0.9.1 protocol
implementation from prototype to production quality.

Changes:
- Remove custom JSONSchema target (JSONValue.swift + tests)
- Add swift-json-schema dependency (from: "0.13.1") to Package.swift
- Bump swift-tools-version to 6.1 and add macOS 13 to platforms
- Define 4 production targets: A2UIJSON, A2UICore, A2UISwiftUI, A2UISampleClient
- Define 3 test targets with placeholder tests
- Create stub source files for each target
- Update AGENTS.md to document new target architecture
- Update .gitignore for Swift Package Manager artifacts

Verification:
- `swift package resolve` resolves swift-json-schema at 0.13.1
- `swift build` compiles all 7 targets
- `swift test --enable-swift-testing` passes (3 placeholder tests)
…chema

Implements all 14 A2UI v0.9.1 common type JSON Schema definitions using
the swift-json-schema fork. Schemas are defined as a raw JSON document
matching the specification's common_types.json exactly, and registered
into Context via the remoteSchema parameter for $ref resolution.

Changes:
- Define complete common types document in A2UICommonSchema (all 14
  defs: ComponentId, AccessibilityAttributes, ComponentCommon, ChildList,
  DataBinding, DynamicValue, DynamicString, DynamicNumber, DynamicBoolean,
  DynamicStringList, FunctionCall, CheckRule, Checkable, Action)
- Add A2UISchemaRegistry helper to create a Context pre-populated with
  A2UI schemas
- Add 31 tests covering URI helpers, document structure, schema registry,
  validation of all schema types (positive and negative cases), and
  cross-reference resolution (including recursive Action → FunctionCall
  → DynamicValue chains)
- Remove placeholder A2UIJSONTests (superseded by comprehensive tests)

Design notes:
- Raw JSON string approach used instead of JSONValue dictionary literals
  to avoid Swift type-checker issues with deeply nested expressions
- FunctionCall's catalog.json oneOf reference omitted; catalog-level
  validation handled at runtime by ComponentCatalog
- Context.remoteSchemaStorage is internal in the fork, so schemas are
  registered via the Context(remoteSchema:) initializer

Verification:
- swift build passes (all targets)
- swift test passes (34 tests in 3 suites, 0.017s)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the complete A2UI v0.9.1 common type schema definitions (A2UICommonSchema) and a helper registry (A2UISchemaRegistry) to facilitate JSON schema validation and $ref resolution in Swift. It also adds comprehensive unit tests verifying the structure and validation behavior of these schemas. The reviewer feedback highlights two main issues: several lines within the raw JSON string literal exceed the 100-character limit, and the use of try! for parsing the document violates safety guidelines against forced tries.

Comment thread swift/core/Sources/A2UIJSON/A2UICommonSchema.swift
Comment thread swift/core/Sources/A2UIJSON/A2UICommonSchema.swift Outdated
pinieb and others added 4 commits July 14, 2026 12:46
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Pete Biencourt <piebie@google.com>
@pinieb
pinieb marked this pull request as ready for review July 14, 2026 17:12
@pinieb
pinieb requested a review from jacobsimionato July 16, 2026 20:38
Comment thread swift/core/Sources/A2UIJSON/A2UICommonSchema.swift
@pinieb
pinieb enabled auto-merge (squash) July 17, 2026 15:10
@gspencergoog
gspencergoog disabled auto-merge July 17, 2026 19:32
@gspencergoog
gspencergoog merged commit 73ca6b5 into a2ui-project:main Jul 17, 2026
20 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in A2UI Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants