Hi

I found the issues #858 
<https://github.com/FasterXML/jackson-databind/issues/858> and #869 
<https://github.com/FasterXML/jackson-databind/issues/869> in GitHub Issues 
tracker regarding the required attribute. I understand the current 
code works only for creator parameters, as per the example provided 
by operatiay in #869

public class MyObject {
    String req;

    String opt;

    @JsonCreator
    public MyObject(
            @JsonProperty(required = true,  value="req") String req,
            @JsonProperty(required = false, value="opt") String opt) {
        this.req = req;
        this.opt = opt;
    }
}


I may be oversimplifying the implementation, but I added basic support for 
the original request by operatiay:

public class MyObject {
    @JsonProperty(required=true)
    String req;
    
    @JsonProperty
    String opt;
}


Tatu, can you check my implementation in this commit db0d690 
<https://github.com/htmsousa/jackson-databind/commit/db0d690371ca9cf116c285e03027c00e4b3b3113>
 and 
maybe provide some feedback. I can improve this implementation and maybe 
apply it to other deserializers and do a pull request. What do you think?

ps. sorry if this topic is duplicated but I can't see my previous post in 
the group.

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to