-
Notifications
You must be signed in to change notification settings - Fork 15
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
Dissallow test/modification of some properties #33
Comments
What about using ValidationAttribute? |
@Havunen We could absolutly use |
This feature request #6 would combine modelstate validation and until that is implemented, it needs to be done manually |
After reading the PR's in the linked issue, i don't think that validation would suffice as i can't check if a value has changed using validation? It seems to be more oriented to validating a value of a field, like An email must contain @ and a valid domain. But in this case we want to deny the Json Patch access to some properties. I can see 2 solutions to this issue:
If the second option would be acceptable for you, then i could create a PR. |
One approach could be to have specific input model for the http patch routine where those properties are not allowed. I started thinking that if we introduce Well maybe we could start with simple approach and see if it ever becomes a use case. If you would like to see this implemented PR is welcome. This could maybe go into next major version as I would like to refactor the exception type as well |
@Havunen PR created :), One thing that might be nice but would require a bigger rewrite would be to include the full path in the exception that is thrown. But there is no need to do that for the first release in my opinion. |
@Havunen Any idea when a new nuget can be released with this functionality? (We need it before we go into production) |
Soon |
Release 3.3.0 has been published https://github.com/Havunen/SystemTextJsonPatch/releases/tag/v3.3.0 |
Thanks for the fast release, it works great :) But i managed to find one way you actually can write to a property marked with Example: [{"op":"add","path":"/safe/1","value":{"deny":"sneaky"}}] In this case the deny property was marked with |
Can you create separate issue for that please. It would be nice if you could patch that functionality |
@Havunen To be honest i don't know how to fix this issue, my guess is that the |
Okay lets document it then, could you send the PR for the doc update please? |
Hi we have some Classes where we apply modifications using the Patch object, but there are some Properties we don't want to allow tests or changes.
They currently have a Attribute on them, is there someway we could throw a exception when SystemTextJsonPatch tries to access them?
The text was updated successfully, but these errors were encountered: