Skip to content

fix: add field validation to CardQuery model#2

Closed
Washio20 wants to merge 1 commit intomainfrom
fix/bug-9
Closed

fix: add field validation to CardQuery model#2
Washio20 wants to merge 1 commit intomainfrom
fix/bug-9

Conversation

@Washio20
Copy link
Owner

Summary

  • Adds max_length=128, min_length=1, and alphanumeric pattern validation to CardQuery.number field
  • Previously, CardQuery.number was a plain str with no constraints, so invalid input (e.g., overly long strings or special characters) would pass validation and hit the database, returning 404 instead of the expected 422 validation error
  • The validation now matches the constraints used in CardModel.number

Closes stayforge/Stayforge_Networks_Access#9

Test plan

  • Verify that sending a card number longer than 128 characters returns 422 (not 404)
  • Verify that sending a card number with special characters returns 422
  • Verify that sending a valid card number still works correctly

🤖 Generated with Claude Code

Add min_length=1 and max_length=128 constraints to the CardQuery.number
field so that invalid card numbers are rejected with a 422 Unprocessable
Entity response instead of being passed through to the database and
returning a misleading 404.

Closes stayforge/Stayforge_Networks_Access#9

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Washio20 Washio20 closed this Feb 27, 2026
@Washio20 Washio20 deleted the fix/bug-9 branch February 27, 2026 16:01
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.

1 participant