Add support for basic "is-required" checks on deserialization using `@JsonProperty(required=true)`
See original GitHub issue(note: moved from https://jira.codehaus.org/browse/JACKSON-767)
As per title, although full validation of values is out-of-scope for Jackson, very basic “must be included in JSON” checks may fall in 80/20 line of things. Especially since we already have annotation to use.
The trick here is implementation; from two distinct parts:
- This requires handling and retaining of extra state (what has been included) during deserialization by
BeanDeserializer
, and passing it; not trivial to do with current code. - Due to combinatorial explosion by features, efficiency, we need to be careful not to add Yet Another combination of things to tackle, requiring adding yet more similar (but not identical) methods
Issue Analytics
- State:
- Created 10 years ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top Results From Across the Web
How to ensure field inclusion in Jackson - java - Stack Overflow
... open issue from 2013 to add validation: Add support for basic "is-required" checks on deserialization using @JsonProperty(required=true).
Read more >JsonPropertyAttribute required - Json.NET
This sample uses JsonPropertyAttribute to set Required which is used during deserialization to validate the presence of required JSON properties.
Read more >Getting started with Schema Registry - AWS Glue
The following sections provide an overview and walk you through setting up and using Schema Registry. For information about Schema Registry concepts and ......
Read more >Jay Sridhar, Author at Novixys Software Dev Blog | Page 13 of ...
@JsonProperty can be used with @JsonCreator to indicate the constructor to use when deserializing JSON. Consider the following class which does ...
Read more >Dealing with Value Objects in REST API with Jackson - Tratif
Dealing with serialization and deserialization of ValueObjects with ... @JsonProperty(value = "zipCode", required = true) ZipCode zipCode, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
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
@utkarsh2012 If there is work we will update the issue. There is not much point in asking for things when there is no indication anything has changed. If you want to ask questions, in general, mailing list is a better place.
Do we have an update on this for class attributes? Been 1yr since last update.