Add option to reject readOnly/writeOnly validations#257
Open
byted wants to merge 3 commits intopb33f:mainfrom
Open
Add option to reject readOnly/writeOnly validations#257byted wants to merge 3 commits intopb33f:mainfrom
byted wants to merge 3 commits intopb33f:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #257 +/- ##
==========================================
+ Coverage 97.94% 97.97% +0.03%
==========================================
Files 64 64
Lines 6525 6627 +102
==========================================
+ Hits 6391 6493 +102
Misses 133 133
Partials 1 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:
|
When StrictRejectReadOnly is enabled, readOnly properties in requests are reported as validation errors instead of being silently skipped. When StrictRejectWriteOnly is enabled, writeOnly properties in responses are reported similarly. Addresses pb33f#90
Tests for pb33f#90 - 10 strict-level tests: rejection on/off, direction-specific, nested, allOf, combined flags - 2 error constructor tests for ReadOnlyPropertyError/WriteOnlyPropertyError - 2 integration tests for request/response dispatch
3493ec4 to
c9e4272
Compare
Cover checkReadWriteOnlyViolation calls in: - recurseIntoDeclaredProperties (explicit + pattern properties) - validateVariantWithParent (oneOf) - recurseIntoDeclaredPropertiesWithMerged (oneOf + additionalProperties: false) - recurseIntoAllOfDeclaredProperties (allOf + additionalProperties: false) - WithStrictRejectReadOnly/WithStrictRejectWriteOnly option functions - WithExistingOpts copy of new fields
c9e4272 to
0ea4d3f
Compare
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.
Adds a strict config option to fail when the payload contains a property that is marked as
readOnlyorwriteOnlyrespectively.Relates to #90
This PR does NOT solve interactions between
requiredandreadOnlyon the same property. I might be interested in adding this as well but I think this will be a bit more complex for me.