-
Notifications
You must be signed in to change notification settings - Fork 49
Fix: Input Validation handle top level default. #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Input Validation handle top level default. #144
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #144 +/- ##
============================================
+ Coverage 80.39% 80.46% +0.06%
Complexity 178 178
============================================
Files 20 20
Lines 1474 1474
Branches 119 119
============================================
+ Hits 1185 1186 +1
+ Misses 289 288 -1
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:
|
a4484a3 to
9b3a130
Compare
Co-authored-by: Greg Ziółkowski <[email protected]>
Apparently draft-04 of JSON schema allows the top level default, that we are using, but ajv validator errors if a top level default is used, it also error if null or undefined is passed as input.
This PR fixes the issue, we remove the default from the compile schema and use it as the input when it is defined.
Testing
On core switch to PR (which has required core changes to be draft-04 complient and work correctly, like removing examples and return JSON containing a default of {} instead of []).
Paste the following on the browser console:
Verify both abilities execute with success.