Skip to content

Cart SDK Zod schemas drop fields from account checkouts and add-to-cart responses #649

Description

@field123

@epcc-sdk/sdks-cart-checkout-order/zod provides schemas for validating API payloads. Two of them silently remove data:

  • zCheckoutApiBody.parse(body) on an account checkout removes data.account and data.contact.
  • zCartsResponse.parse(response), used for the response to adding items to a cart, removes most item fields.

Expected: parsing a valid payload keeps all of its fields.

Cause:

  • In the checkout schema, every field of the customer-checkout shape is optional, so an account checkout matches that shape first and its extra fields are stripped.
  • In the cart schema, response items are described with the request item shapes.

The TypeScript types are correct; only the schemas are affected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions