Skip to content

fix(backend): align address validation with GraphQL zipCode field#42

Open
dmeiser wants to merge 1 commit into
mainfrom
fix/backend-zipcode-field-alignment
Open

fix(backend): align address validation with GraphQL zipCode field#42
dmeiser wants to merge 1 commit into
mainfrom
fix/backend-zipcode-field-alignment

Conversation

@dmeiser

@dmeiser dmeiser commented Jun 19, 2026

Copy link
Copy Markdown
Owner

The GraphQL schema defines the customer address ZIP field as zipCode, but validate_address required the legacy key zip. This caused valid frontend addresses to fail validation and report generation to omit the ZIP for records stored as zipCode.

  • Change validate_address to use zipCode for required-field checks and ZIP format validation.
  • Update unit tests to use zipCode consistently.

Validation: uv run pytest tests/unit --cov=src --cov-fail-under=100 — 797 passed, 4 skipped, 100% coverage.

The GraphQL schema defines the customer address ZIP field as zipCode, but
validate_address required the legacy key zip. This caused valid frontend
addresses to fail validation and report generation to omit the ZIP for
records stored as zipCode.

- Change validate_address to use zipCode for required-field checks and
  ZIP format validation.
- Update unit tests to use zipCode consistently.

All unit tests pass with 100% coverage.
Copilot AI review requested due to automatic review settings June 19, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns backend address validation with the GraphQL/Frontend contract by treating zipCode as the canonical ZIP field (instead of the legacy zip). This prevents valid addresses submitted by the frontend from failing validation and keeps validation error details consistent with the API shape.

Changes:

  • Updated validate_address to require and validate zipCode (and to emit validation details keyed by zipCode).
  • Updated unit tests to use zipCode consistently in address fixtures and assertions.
  • Minor whitespace cleanup in line item validation helper.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/utils/validation.py Switches required-field and ZIP format validation from zip to zipCode, and aligns error details accordingly.
tests/unit/test_validation.py Updates address-related tests and assertions to use zipCode instead of zip.

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.

2 participants