Skip to content

Ordering of various JSONSchema validation constraints changed in generated OpenAPI spec #4926

Open
@adriansuarez

Description

@adriansuarez

This was observed on the upgrade from 2.2.30 to 2.2.34.

The following validation constraints now appear at the end of the generated JSONSchemas:

  • default
  • enum
  • items

I suspect that the OpenAPI object that the spec is generated from internally has a LinkedHashMap for each object node to preserve the ordering that properties were added in, because I have my own post-processor that adds and updates various properties and I have always observed that the properties added by the post-processor appear last.
But the constraints above now appear last.

This is problematic because I have a test in CI that checks that the OpenAPI spec that is checked in does not diverge from what would be generated from the code.
I can update the checked in spec based on what Swagger generates with version 2.2.34, but I want to confirm that the new ordering is stable.

I also find it weird for standard validation constraints like default, enum, and items to appear after vendor-specific extensions prefixed with x-.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions