-
Notifications
You must be signed in to change notification settings - Fork 31
Throw exception when field type is incorrect #60
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
Merged
Merged
Conversation
This file contains 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
(cherry picked from commit d820bfe)
Codecov Report
@@ Coverage Diff @@
## master #60 +/- ##
==========================================
+ Coverage 96.85% 96.95% +0.09%
==========================================
Files 14 15 +1
Lines 573 591 +18
==========================================
+ Hits 555 573 +18
Misses 18 18
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Realised I didn't explain what this PR addresses! 🙈 We noticed the following edge cases:
The second commit, makes sure test code coverage doesn't decrease. I suggest we ignore the code climate issue. :) |
wmfgerrit
pushed a commit
to wikimedia/mediawiki-extensions
that referenced
this pull request
Nov 1, 2022
* Update Wikibase from branch 'master' to 55ac6e55d1bb900bf4ef549c95599fac16581b81 - Merge "REST: Handle invalid field type in JSON Patch" - REST: Handle invalid field type in JSON Patch Respond with a more specific error when the JSON Patch contains a field with an invalid type. Handled in `JsonDiffPatchValidator` while we wait for the upstream PR to be merged. swaggest/json-diff#60 Bug: T320705 Change-Id: I92290f5791b14e28e5fcd87d28c8b26d160e899f
wmfgerrit
pushed a commit
to wikimedia/mediawiki-extensions-Wikibase
that referenced
this pull request
Nov 1, 2022
Respond with a more specific error when the JSON Patch contains a field with an invalid type. Handled in `JsonDiffPatchValidator` while we wait for the upstream PR to be merged. swaggest/json-diff#60 Bug: T320705 Change-Id: I92290f5791b14e28e5fcd87d28c8b26d160e899f
wmfgerrit
pushed a commit
to wikimedia/mediawiki-extensions
that referenced
this pull request
Nov 14, 2022
* Update Wikibase from branch 'master' to d5ac0dea033aa4d6c7f4216e53b7156d32f3c45f - Merge "REST: Handle invalid field type via json-diff lib" - REST: Handle invalid field type via json-diff lib Removes temporary solution in JsonDiffJsonPatchValidator in favour of handling the `InvalidFieldTypeException` thrown by the JsonDiff lib after PR#60 merged upstream. swaggest/json-diff#60 Bug: T320705 Change-Id: I7eb29e574964cffa65d470afb8170a238d6827e0
wmfgerrit
pushed a commit
to wikimedia/mediawiki-extensions-Wikibase
that referenced
this pull request
Nov 14, 2022
Removes temporary solution in JsonDiffJsonPatchValidator in favour of handling the `InvalidFieldTypeException` thrown by the JsonDiff lib after PR#60 merged upstream. swaggest/json-diff#60 Bug: T320705 Change-Id: I7eb29e574964cffa65d470afb8170a238d6827e0
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.
Another late addition to our improvements on error handling (#53).
Fixes the following edge cases:
"op"
field is booleantrue
, it is interpreted as an"add"
operation instead of throwing an exception. This is due totrue
always matching the first [switch case] (Add::OP
)."op"
field is an Array (list) or Object, it results in a "PHP Notice Array/Object to string conversion" in the [UnknownOperationException
]"path"
or"from"
fields are not a string, an exception will be thrown inJsonPatch::apply()
rather thanJsonPatch::import()