Skip to content

Sync spec: refund line products, open response enums, 503 handling - #8

Merged
sandervanhooft merged 1 commit into
mainfrom
refund-line-products-open-enums
Dec 3, 2026
Merged

sandervanhooft merged 1 commit into
mainfrom
refund-line-products-open-enums

Conversation

@sandervanhooft

Copy link
Copy Markdown
Member

Syncs openapi.yaml with docs.vatly.com (byte-identical to production) and regenerates the models.

Refund line products (vatlify #3088): RefundLine gains optional original_order_line_id, product_type and product_id, on refund resources and in refund.* webhooks.

Open response enums. Every enum in a response-only schema is now Literal[...] | str, so a value the API adds later (a new status, product type, mandate method…) parses instead of failing the whole response. Unknown fields were already kept (extra="allow"); a test now covers both.

  • Request enums stay closed, and so does Money.currency, which is shared with requests.
  • resource discriminators stay as they are. WebhookDelivery.event_name stays closed on purpose: construct_event() is documented as known-events-only, and construct_webhook_event() already returns UnsupportedWebhookEvent for unknown ones.
  • webhook_events.get(): event_name is open, and an object whose resource has no model is a plain mapping. A known resource that doesn't match its model still raises.
  • Compatibility: runtime parsing only accepts more than before. Type annotations widen, so strict type checkers may flag code that assigns these fields to a Literal variable.

503 / error code. 503 raises the new VatlyServiceUnavailableError, a subclass of VatlyApiError (which it raised before). Every VatlyError has .code from Error.code. A 503 with code: service_unavailable is answered before processing, so the SDK now retries it for unkeyed mutations too, with the same key and honoring Retry-After. Retries already happened for GETs and keyed writes.

Also generated from the new spec: tax_behavior on UpdateOneOffProductRequest and UpdateSubscriptionPlanRequest, and on pending_updates.

No release or version bump. Checks: ruff, mypy --strict, generate.py --check, 229 tests, uv build, twine check, wheel import.

Sync openapi.yaml with docs.vatly.com and regenerate the models. RefundLine
gains originalOrderLineId, productType and productId.

Response enums are now open (Literal[...] | str), so values the API adds
later parse instead of failing the response; request enums stay closed.
WebhookEvent.object keeps an object of an unknown resource as a mapping.

503 responses raise VatlyServiceUnavailableError (a VatlyApiError), every
VatlyError exposes Error.code, and a 503 with code service_unavailable is
retried for unkeyed mutations too, since Vatly answers it before processing.

Amp-Thread-ID: https://ampcode.com/threads/T-01a23df4-9d05-71be-8a71-16eb5a4affd6
Co-authored-by: Amp <amp@ampcode.com>
@sandervanhooft
sandervanhooft merged commit 655d316 into main Dec 3, 2026
14 checks passed
@sandervanhooft sandervanhooft mentioned this pull request Dec 4, 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.

1 participant