Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #3629
Closed
Open
Issue created Aug 13, 2019 by Administrator@rootContributor

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

Created by: 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).

Assignee
Assign to
Time tracking