fix: add facility_type validation to prevent 500 on invalid input#3554
Open
Rahwulkumar wants to merge 1 commit intoohcnetwork:developfrom
Open
fix: add facility_type validation to prevent 500 on invalid input#3554Rahwulkumar wants to merge 1 commit intoohcnetwork:developfrom
Rahwulkumar wants to merge 1 commit intoohcnetwork:developfrom
Conversation
…Error Invalid facility_type values like "private" caused an unhandled KeyError in perform_extra_deserialization when looking up REVERSE_REVERSE_FACILITY_TYPES. Added a field_validator that checks the value exists in the valid types dictionary and raises a descriptive 400 validation error listing all valid facility type options instead of crashing with a 500. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA field validator has been added to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Changes
Added a
field_validatorforfacility_typeinFacilityCreateSpecthat validates the input value againstREVERSE_REVERSE_FACILITY_TYPESbefore deserialization occurs.This prevents a
500 Internal Server Error(KeyError) and returns a proper400 Bad Requestwith a list of valid facility type options.Fixes #3553
Summary by CodeRabbit