Skip to content

[REQ][java][jackson] add @JsonPropertyOrder annotation #3629

Closed

Description

@jmini

When the model classes are serialized to JSON the order of the JSON members are not controlled.

Given this schema:

components:
  schemas:
    SomeObj:
      type: object
      properties:
        id:
          type: integer
          format: int64
        firstName:
          type: string
        lastName:
          type: string

This is not a big deal because the order is not relevant in a JSON object:

{
"id" : 42,
"firstName": "John",
"lastName": "Doe"
}

Is the same than:

{
"lastName": "Doe",
"id" : 42,
"firstName": "John"
}

But if the JSON objects are displayed or stored as file, it would be nice to have always the same order (the same as in the OpenAPI specification).

With Jackson the solution is to use the @JsonPropertyOrder property.

In my opinion this should be generated (maybe with an option to hide it for user that do not want it).

Activity

  1. auto-labeler commented on Aug 13, 2019

    @auto-labeler

    👍 Thanks for opening this issue!
    🏷 I have applied any labels matching special text in your issue.

    The team will review the labels and make any necessary changes.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions