feat(tii)!: interpret the full complex param-type model#34
Conversation
Extend `ParamType` to interpret every shape `tx3c` emits into the TII params schema, per the canonical model in the SDK spec's `api-surface/args.md`. - Add `unit`, `utxo`, `anyAsset`, `map` (value), `record` (fields), and `variant` (cases) kinds; the previous `object`→custom and `oneOf`→custom now resolve to structured `record`/`variant`, and `additionalProperties` to `map`. - Resolve `#/components/schemas/<Name>` refs into the components table and recurse (previously wrapped opaquely as custom without recursing). - `fromJsonSchema` never throws: unrecognized shapes (bare `string`, unresolved object, unknown `$ref`, array without items/prefixItems) become `unknown` carrying the raw schema. A bare `string` is no longer assumed to be untyped. Builds on the earlier list/tuple + trailing-name `$ref` support. BREAKING CHANGE: the `custom` kind is renamed to `unknown`, and `fromJsonSchema` / `paramsFromSchema` no longer throw `InvalidParamTypeError` (they return `unknown` instead). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ver invoke path Behavior-preserving readability pass over the complex-param-type work, mirroring the rust/go/python siblings — identical kind map, all tests still pass. - Split fromJsonSchema into a thin dispatcher; extract the $ref / array / object arms into refType / arrayType / objectType (joining coreRefType / variantCase). - Remove the now-dead InvalidParamTypeError (this PR removed its throw sites) and the never-wired InvalidParamsSchemaError; go-sdk carries neither. - Add tests/fixtures/complex.tii and a Protocol.invoke integration test that guards components threading (resolved Record field + Variant cases), party Address params, and environment-schema params. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Follow-up readability pass (commit 72458e6) — behavior-preserving, same code-quality lens applied to the rust/go/python siblings. Identical kind map, Module cohesion — already good, no change. Decompose Drop dead error classes. This PR removed the four Close the |
Summary
Extends
ParamTypeto interpret every shapetx3cemits into the TII params schema, per the canonical model in the SDK spec'sapi-surface/args.md. The web-sdk slice of a cross-fleet complex-type parity effort (rust/go/python/web). Builds on the earlier list/tuple + trailing-name$refwork.Changes
unit/utxo/anyAsset/map(value) /record(fields) /variant(cases) kinds. The previousobject→custom andoneOf→custom now resolve to structuredrecord/variant, andadditionalPropertiestomap.#/components/schemas/<Name>refs into the components table and recurses (previously wrapped opaquely without recursing).string, unresolved object, unknown$ref, array without items/prefixItems) becomeunknowncarrying the raw schema.Tests
npm test— 131 pass (rewrittenparamType.test.tsover the full canonical table incl. both ref forms, nested compounds, map/record/variant, component resolution, and never-throw fallbacks).tsc --noEmitclean.Cross-checked against the shared fixture
sdk-spec/test-vectors/complex-types/complex.tii.Breaking change
The
customkind is renamed tounknown, andfromJsonSchema/paramsFromSchemano longer throwInvalidParamTypeError(they returnunknown). Needs a version bump persdk-spec/release-policy.md.🤖 Generated with Claude Code