Skip to content

Support new @JsonProperty.isRequired for overridable definition of "required-ness" #5020

Description

@cowtowncoder

Describe your Issue

Now that @JsonProperty has "nullable" isRequired property (see FasterXML/jackson-annotations#284), JacksonAnnotationIntrospector needs to support it.

Logic is such that:

  1. if isRequired has value other than OptBoolean.DEFAULT, it is used as THE choice of required-ness
  2. otherwise if required = true, property is required
  3. otherwise (required = false), either
    • Property is NOT required (Jackson 2.x)
    • Property MAY OR MAY NOT BE required wrt annotation (higher-level defaults used)

This logic is specifically meant to allow finer-grain overridability with working defaults: before this change, setting of @JsonProperty.required -- and often, specifically, its default (false) setting was used.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.19Issues planned at 2.19 or later

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions