fix(orders): tighten shipping address, line, and item schema constraints#121
Open
leofischer wants to merge 2 commits into
Open
fix(orders): tighten shipping address, line, and item schema constraints#121leofischer wants to merge 2 commits into
leofischer wants to merge 2 commits into
Conversation
Align the OpenAPI schemas with the validations enforced by payments-api's v200 param sanitizers, which were previously under-documented. - Extract the shipping-contact address into a shared schemas/customers/shipping_contact_address.yml and reference it from the create and update shipping-contact schemas, removing the duplicated inline address blocks. - Mark street1, postal_code, and country as required on the create path (matching ShippingContacts::Validator#validate_on_create); the update path keeps them optional. - Document the MX 5-digit postal code rule and add field descriptions. - Add maxLength: 250 to address fields, shipping line carrier/tracking_number/ method, and line-item name/brand/sku and tag items. - Regenerate _build/api.yaml. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Align the OpenAPI schemas with the validations enforced by payments-api's v200 param sanitizers, which were previously under-documented. - Extract the shipping-contact address into a shared schemas/customers/shipping_contact_address.yml and reference it from the create and update shipping-contact schemas, removing the duplicated inline address blocks. - Mark street1, postal_code, and country as required on the create path (matching ShippingContacts::Validator#validate_on_create); the update path keeps them optional. - Document the MX 5-digit postal code rule and add field descriptions. - Add min/max length constraints matching StringValidator (strict bounds: less_than/greater_than). String fields cap at maxLength 249 (the sanitizer rejects length >= 250); minLength derives from greater_than + 1. postal_code keeps maxLength 250, its only cap being the model-level zip validation. Applies to address fields, shipping line carrier/tracking_number/method, and line-item name/description/brand/sku/tags (create and update). - Regenerate _build/api.yaml. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Aligns the OpenAPI schemas for order shipping address, shipping line, and line item with the validations actually enforced by
payments-api'sv200param sanitizers. These fields were documented as free-form strings with no required markers or length limits, despite the API rejecting them.Targets
release/v2.3.0.Changes
Consolidation (shared address component)
schemas/customers/shipping_contact_address.yml; the create and update shipping-contact schemas now$refit instead of each carrying a duplicated inlineaddressblock. Theshipping_contactused by orders (order_request,order_update_request,split_order_request) already routes through these schemas, so the order shipping address is covered by the same definition.Required markers (matching
ShippingContacts::Validator#validate_on_create)address.street1,address.postal_code,address.countryare now required on create; the update path leaves them optional.Format / descriptions
country == MX-> 5-digit postal code) onpostal_code.countryhad one).Length constraints (matching
StringValidator)The sanitizer uses strict comparisons:
length >= less_than->too_long,length <= greater_than->too_short. So a 250-char value is rejected; the maximum accepted length is 249, andminLength = greater_than + 1.maxLength: 249on all sanitizer-bounded strings: addressstreet1/street2/city/state/country; shipping linecarrier/tracking_number/method; line-itemname/description/brand/skuandtags[]items (create + update).minLength:street1/country2;carrier/tracking_number/method/name/description3;brand2;sku1;tags[]items 2;tagsminItems: 1.postal_codekeepsmaxLength: 250: the sanitizer only type-checks it, so its only length cap is the model-levelvalidates :zip, length: { maximum: 250 }(inclusive).Build
_build/api.yamlviamake merge; all$refs resolve and the create-pathrequiredmarkers survive bundling.Notes
< 250; postal_code's 250 reflects the inclusive model bound.🤖 Generated with Claude Code