Implement x-www-form-urlencoded validation#237
Implement x-www-form-urlencoded validation#237ySnoopyDogy wants to merge 6 commits intopb33f:mainfrom
Conversation
also added a validation for XML namespaces and prefix
Potentially closes pb33f#180
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #237 +/- ##
==========================================
+ Coverage 97.61% 97.79% +0.18%
==========================================
Files 56 60 +4
Lines 5240 5769 +529
==========================================
+ Hits 5115 5642 +527
- Misses 125 127 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I need to add this to the docs, but I generally will hold all PRs that don't have full coverage, unless there is a solid reason. In this case, your code is solid! But some error paths have been uncovered. I know they are a pain to cover. The problem is that every slight drop in coverage compounds with every submission. I am responsible for this code once it's merged, and I strongly believe in high coverage in core libraries. Sorry to be pedantic, I hope you understand. in this PR there are a few error cases uncovered, a few invalid object or nil tests would bump it up and we can all be happy! |
This PR was made on top of #214, and closes #180.
The same idea from the XML validation was used for URLEncoded. We convert the data into a JSON structure matching the types from the Schema, so we can validate the JSON structure against the OpenAPI schema.
Created a new interface
URLEncodedValidatorwith two functions for validating url encoded:ValidateURLEncodedStringandValidateURLEncodedStringWithVersion.Added a new option to ValidationOptions:
AllowURLEncodedBodyValidationto enable URL Encoded validations in request/response bodies (the default is false). Created a function WithURLEncodedBodyValidation to enable the new validator option.No breaking changes with the new code, as the updated function was internal, and the URL Encoded body validation setting is false by default.