question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:

  1. 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.
  2. 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:open
  • Created 10 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cowtowncodercommented, Aug 20, 2016

@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.

0reactions
utsengarcommented, Aug 18, 2016

Do we have an update on this for class attributes? Been 1yr since last update.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found