Best practices regarding unknown properties
See original GitHub issueRequests can be validated via a custom schema, e.g.
req.checkBody({
email: { ...
});
which is great. Are there any guidelines what to do, if the request should only contain the email
property and nothing else? For example the following request body should cause validation to fail
{
"email": "example@example.org",
"extra": "I should not be here!"
}
with an error message along the lines of Unknown property "extra"
.
Any thoughts / hints appreciated! 😃
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to Ignore Unknown Properties While Parsing JSON in ...
Though, the preferred approach is to ignore unknown properties at the class level using @JsonIgnoreProperties(ignoreUnknown = true) and only do this on the ......
Read more >Best practices
This guide is a work in progress and is not currently complete. Feel free to contact us to propose topics that should be...
Read more >How to handle unknown properties and methods using ...
Learn Swift coding for iOS with these free tutorials.
Read more >How to Ignore Unknown Properties While ... - GeeksforGeeks
However, the preferred approach is to ignore unknown properties at the class level using @JsonIgnoreProperties(ignoreUnknown = true) and only do ...
Read more >REST Assured Tutorial 41 – Ignore unknown properties during ...
Learn to ignore unknown properties during deserialization using @JsonIgnoreProperties of Jackson API in Java. ignoreUnknown property of ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nice, thanks for the reference! 👍 that’s pretty much my use case actually, the solution with lodash
pretty much solves my problem! 🎉
Primary difference to this issue is that, rejecting unknown properties in a request could help potential client API developers. I’ll keep this open as a reference 📘
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.