Skip to content

Objects properties order is not preserved with springdoc.api-docs.resolve-schema-properties = true #1274

Closed
@jawpio

Description

@jawpio

For some projects the object properties order is not preservered in the schema.

I checked the sample-springdoc-openapi-person-service if I change the Person properties order it's reflected in the swagger specification.

I created a minimalistic project which shows that the properties order is not preserved https://github.com/jawpio/springdoc-property-ordering-test.

In above project you can see that the SampleResponseClass looks as follows:

public class SampleResponseClass {

	private String id;

	private String name;

	private String lastName;

	private boolean aValue;

but it's generated as:

      "SampleResponseClass": {
        "type": "object",
        "properties": {
          "lastName": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "isaValue": {
            "type": "boolean"
          }
        }
      }

I tired to find what's causing that issue, but I was unable to find the reason yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions