-
-
Notifications
You must be signed in to change notification settings - Fork 160
JADNC: Required Input validation disabled for partial patching / relationships #781
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
bart-degreed
merged 27 commits into
json-api-dotnet:master
from
sasman0001:input_validation_disable_validators
Jun 16, 2020
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
c4c27aa
disable validator if partial patch
ead6930
Create required validator that can be diabled to allow for partial pa…
a4c688d
formatting
7d3f57a
Remove unneeded reference.
11bd7d9
package reference
c02ef34
Requested changes:
9e40b88
Add version wildcard
a0de349
expect possible null in HttpContextExtension method
86989e6
change parameter order and naming for consistency
50ae2e4
Requested changes
102e636
Remove unneeded null check.
3917539
add null checks
cfbc9e3
generate fake name for author
0bcebe3
Moved logic to RequestDeserializer, overriding methods in BaseDocumen…
6a682ed
remove references
c2f2a69
formatting
81e764e
back to var
126a1a8
Requested changes:
a1596d5
formatting
d82f193
formatting
6882b19
change access modifiers
96cbd84
Requested changes:
945691d
refactor
4496d72
remoev comma.
4bc23b7
Merge remote-tracking branch 'upstream/master' into input_validation_…
7eeb6c5
Cleanup
44a9d92
removed unneeded code
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,4 +18,4 @@ | |
| <BogusVersion>29.0.1</BogusVersion> | ||
| <MoqVersion>4.13.1</MoqVersion> | ||
| </PropertyGroup> | ||
| </Project> | ||
| </Project> | ||
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using System.ComponentModel.DataAnnotations; | ||
| using Microsoft.AspNetCore.Http; | ||
| using Microsoft.Extensions.DependencyInjection; | ||
| using JsonApiDotNetCore.Extensions; | ||
|
|
||
| namespace JsonApiDotNetCore.Models | ||
| { | ||
| public sealed class IsRequiredAttribute : RequiredAttribute | ||
| { | ||
| private bool _isDisabled; | ||
|
|
||
| public override bool IsValid(object value) | ||
| { | ||
| return _isDisabled || base.IsValid(value); | ||
| } | ||
|
|
||
| protected override ValidationResult IsValid(object value, ValidationContext validationContext) | ||
| { | ||
| var httpContextAccessor = (IHttpContextAccessor)validationContext.GetRequiredService(typeof(IHttpContextAccessor)); | ||
| _isDisabled = httpContextAccessor.HttpContext.IsValidatorDisabled(validationContext.MemberName, validationContext.ObjectType.Name); | ||
| return _isDisabled ? ValidationResult.Success : base.IsValid(value, validationContext); | ||
| } | ||
| } | ||
| } |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.