fix(backend): align address validation with GraphQL zipCode field#42
Open
dmeiser wants to merge 1 commit into
Open
fix(backend): align address validation with GraphQL zipCode field#42dmeiser wants to merge 1 commit into
dmeiser wants to merge 1 commit into
Conversation
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.
Contributor
There was a problem hiding this comment.
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_addressto require and validatezipCode(and to emit validation details keyed byzipCode). - Updated unit tests to use
zipCodeconsistently 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. |
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.
The GraphQL schema defines the customer address ZIP field as
zipCode, butvalidate_addressrequired the legacy keyzip. This caused valid frontend addresses to fail validation and report generation to omit the ZIP for records stored aszipCode.validate_addressto usezipCodefor required-field checks and ZIP format validation.zipCodeconsistently.Validation:
uv run pytest tests/unit --cov=src --cov-fail-under=100— 797 passed, 4 skipped, 100% coverage.