On Tue, Jan 23, 2018 at 2:20 AM, 黄浪 <[email protected]> wrote: > As far as I know, required in JsonProperty(value="xxx", required=true) only > works in JsonCreator. > > But JsonMerge is not compatible with JsonCreator.
Correct: merge is meant for updating existing objects, and creators are for creating new objects. > Now I want to do with required fields and deep merge for object updating, is > there a way to satisfy both? If you mean that you would want to verify that even in merging case, certain property is required for any update, that is not supported. In future (3.x) required-checks may be implemented for setters/fields as well, but even then implementation with merge might be tricky... and it's complicated by the fact that some use cases could prefer not to apply requirements on merge case (to allow partial updates). Your best bet as is would probably be to implement merge part manually, within setter. Setter on existing POJO would know its own state, be able to update it based on incoming value created by Jackson. -+ Tatu +- -- 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.
