Provide an @Required annotation to indicate that a field must be present
See original GitHub issueSee discussion at http://groups.google.com/group/google-
gson/browse_thread/thread/6cfdcc56742357da
During deserialization, Gson should throw a JsonParseException if it finds
that a field marked with @Required is not present.
During serialization, Gson should always write out a field marked @Required
even if it is null.
Original issue reported on code.google.com by inder123
on 17 Oct 2008 at 10:31
Issue Analytics
- State:
- Created 9 years ago
- Reactions:296
- Comments:20 (1 by maintainers)
Top Results From Across the Web
Spring - Required Annotation - GeeksforGeeks
This annotation indicates that the affected bean property must be populated at configuration time: either through an explicit property value ...
Read more >Data Annotations for validation, at least one required field?
DataAnnotations namespace, set it up to validate that at least one of the fields in the search is not null or empty? i.e...
Read more >Require a value in a field - Microsoft Support
In the Field Properties pane, on the General tab, set the Required property to Yes. The Required Field Property. Note: If you set...
Read more >AIP-203: Field behavior documentation
The use of REQUIRED indicates that the field must be present (and set to a non-empty value) on the request or resource. A...
Read more >4.11 Annotation-based configuration - Spring
This annotation simply indicates that the affected bean property must be ... is to treat annotated methods, constructors, and fields as indicating required...
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
Please use this thumbs up button to show your support. Every time someone replies with +1 we all get a (useless) email.
Still waiting for this feature… I want my Gson deserializing to throw an exception when a JSON doesnt have a parameter which my object do have and is either marked as
@Required
or not marked as@Optional
. This is a big dealbreaker that Gson doesn’t have this feature…