Skip to content

Add MapperFeature.SORT_CREATOR_PROPERTIES_BY_DECLARATION_ORDER to use Creator properties' declaration order for sorting #4580

@cowtowncoder

Description

@cowtowncoder

Describe your Issue

Although Creator-provided properties are sorted before other properties, esp. if MapperFeature.SORT_CREATOR_PROPERTIES_FIRST is enabled.

But if MapperFeature.SORT_PROPERTIES_ALPHABETICALLY is enabled, properties of single Creator are still sorted alphabetically. This is probably not what is wanted, at least for Records.

So, we have 2 possibilities:

  1. If SORT_CREATOR_PROPERTIES_FIRST is enabled, retain order of all Properties-based Creators (unless there is explicit @JsonPropertyOrder)
  2. Only retain full ordering for Record Creators

Further we could add a new MapperFeature to control above cases.
Something like MapperFeature.RETAIN_ORDER_OF_CREATOR_PROPERTIES?

NOTE: this becomes more obvious with 3.0 when SORT_PROPERTIES_ALPHABETICALLY will be enabled by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.18Issues planned at 2.18 or later3.xIssues to be only tackled for Jackson 3.x, not 2.x

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions