Skip to content

Support handling of @JsonProperty.required for Creator methods #781

@cowtowncoder

Description

@cowtowncoder

Currently required property of @JsonProperty is only provided as metadata, and used for creating things like JSON Schemas. Deserialization does not enforce required-ness due to technical difficulties; specifically, since JsonDeserializer instances can not have state (they are shared and need to be stateless), any state needs to be either stored in DeserializationContext somehow, or carried along as extra parameter throughout internal calls within BeanDeserializer.

However: handling of Creator methods is different in that state is already tracked: values of Creator parameters must be buffered, to be passed when everything has been collected. Adding bit of extra tracking and checking for required-ness should be much less work.

The initial implementation could just use required property; and once this works, additional functionality for per-creator/global-defaults (DeserializationFeature) may be considered as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions