Repository navigation
Sync spec: refund line products, open response enums, 503 handling - #8
Merged
Merged
Conversation
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>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Syncs
openapi.yamlwith docs.vatly.com (byte-identical to production) and regenerates the models.Refund line products (vatlify #3088):
RefundLinegains optionaloriginal_order_line_id,product_typeandproduct_id, on refund resources and inrefund.*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.Money.currency, which is shared with requests.resourcediscriminators stay as they are.WebhookDelivery.event_namestays closed on purpose:construct_event()is documented as known-events-only, andconstruct_webhook_event()already returnsUnsupportedWebhookEventfor unknown ones.webhook_events.get():event_nameis open, and anobjectwhoseresourcehas no model is a plain mapping. A known resource that doesn't match its model still raises.Literalvariable.503 / error code.
503raises the newVatlyServiceUnavailableError, a subclass ofVatlyApiError(which it raised before). EveryVatlyErrorhas.codefromError.code. A503withcode: service_unavailableis answered before processing, so the SDK now retries it for unkeyed mutations too, with the same key and honoringRetry-After. Retries already happened for GETs and keyed writes.Also generated from the new spec:
tax_behavioronUpdateOneOffProductRequestandUpdateSubscriptionPlanRequest, and onpending_updates.No release or version bump. Checks: ruff, mypy --strict,
generate.py --check, 229 tests,uv build, twine check, wheel import.