feat(pay): upgrade OpenAPI spec to 3.1 and progenitor to 0.13#497
feat(pay): upgrade OpenAPI spec to 3.1 and progenitor to 0.13#497chris13524 wants to merge 5 commits into
Conversation
- Update openapi.json from 3.0.3 to 3.1.0 (version 2026-02-18).
- Replace progenitor 0.11.2 (crates.io) with WalletConnect/progenitor
fork at oas3-migration, which adds OpenAPI 3.1 support.
- Adapt pay/mod.rs to the new generated types:
- `.id(&payment_id)` -> `.id(payment_id.clone())` (PaymentId is now a
newtype that only impls `From<String>`).
- `CollectData.url` is non-optional `String`; `CollectData.schema` is
`serde_json::Value` (not Option<Value>).
- `Amount.unit` is now the `types::String` enum (Iso4217/Caip19);
flatten back to the prefixed string form.
- `GetPaymentOptionsResponse.options` is now `Option<Vec<...>>`;
unwrap with `.unwrap_or_default()`.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Thank you for your contribution! We ask that you please read and sign our CTA Document before we can accept your contribution. You can sign the CTA simply by posting a Pull Request Comment with the following text: I have read the CTA Document and I hereby sign the CTA Chris Smith seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
|
Claude finished @chris13524's task in 3m 44s —— View job PR Review: feat(pay): upgrade OpenAPI spec to 3.1 and progenitor to 0.13
License compliance: No new license issues. Breaking changes: Public/FFI surface is unchanged — Found 3 issue(s)Issue 1: Runtime deserialization will fail for
|
Picks up the upstream merge from oxidecomputer/progenitor (typify 0.6.2, tokio/uuid/clap/assert_cmd/regress version bumps, and the v0.14.0 release prep). Also bumps semver 1.0.27 -> 1.0.28 in the lockfile to satisfy typify 0.6.2's MSRV on semver. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copies external-latest.json from pay-core. Net semantic changes: - Add `PaymentFailureCode` schema (currently `declined_user`). - Add optional `failureCode` field on payment response objects. - Extend GetPaymentOptionsError enum: `payment_not_succeeded`, `already_refunded`. Compiles cleanly with no code changes — additions are all optional or enum-additive on the response side. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The OpenAPI spec defines a `String` schema as a oneOf of two object
variants (`Iso4217`/`Caip19`), but the runtime wire format is the plain
prefixed string described by the example (e.g. `"iso4217/USD"`). The
default progenitor codegen mismatched the wire and broke deserialization
of the `Amount.unit` field — visible in
`test_json_get_required_payment_actions_success`.
Use progenitor's `replace = { ... }` directive to skip generation of the
schema's `String` and use `std::string::String` directly. Also drops the
manual variant-flatten that's no longer needed in `From<types::Amount>`.
Also collapses a multi-line `pay_debug!` to satisfy `cargo +nightly fmt
--all -- --check`.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
I have read the CTA Document and I hereby sign the CTA |
Pay-core's openapi correctly describes `Amount.unit` (and the other two
`AmountUnit`-typed fields) as a plain `string` schema once
WalletConnect/pay-core#603 lands. Pre-applies the equivalent
transformation to yttrium's vendored copy of openapi.json:
- Drops the bogus `String` component schema (a tagged oneOf of
`Iso4217`/`Caip19` object variants that never matched the wire form).
- Inlines a `{type: "string", example: "iso4217/USD"}` schema at each
`unit` field site that previously `$ref`-ed the bad schema.
With the spec corrected, the `replace = { String = std::string::String }`
workaround in `progenitor::generate_api!` is no longer needed and is
dropped. The 82 pay tests still pass; the test that originally regressed
(`test_json_get_required_payment_actions_success`) deserializes the
plain prefixed-string `unit` field via the standard generated types.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
crates/yttrium/src/pay/openapi.jsonfrom OpenAPI 3.0.3 to 3.1.0 (version2026-02-18).progenitor 0.11.2(crates.io) with the WalletConnect/progenitor fork atoas3-migration, which adds OpenAPI 3.1 support and includes a header-param Option fix. Depends on Migrate to oas3 (OpenAPI 3.1 support) + header param Option fix WalletConnect/progenitor#1.pay/mod.rsto the new generated types from progenitor 0.13.Type changes consumed
PaymentIdis now a strict newtype that only implsFrom<String>, so.id(&payment_id)becomes.id(payment_id.clone())(or.to_string()when starting from&str).CollectData.urlis non-optionalString;CollectData.schemaisserde_json::Value(notOption<Value>).Amount.unitis now the generatedtypes::Stringenum (Iso4217/Caip19variants); flattened back to the prefixed string form ("iso4217/..."/"caip19/...").GetPaymentOptionsResponse.optionsis nowOption<Vec<...>>; unwrapped with.unwrap_or_default().Known issue
The new openapi.json defines a top-level
Stringschema as aoneOfof two object variants (Iso4217/Caip19), but the runtime format (per the spec example) is a plain prefixed string like"iso4217/USD". Serde deserialization will likely fail at runtime on theunitfield. This is a schema authoring issue rather than a progenitor or code issue, but worth flagging — the schema may need to revertunitto a plainstringtype with a description.Test plan
cargo check --features=full --lib --bins -p yttriumpassescargo check --features=full --testspassesjust test-pay-e2e) — requiresREOWN_PROJECT_IDjust kotlin,just swift)unitfield once the schema issue is resolved🤖 Generated with Claude Code