Class OpenAPISorter

java.lang.Object
io.openapitools.swagger.OpenAPISorter

public class OpenAPISorter
extends Object
Sorter for the contents of an OpenAPI specification.

Sorting the OpenAPI specification solves problems when the output of this plugin is committed in a version control system.

The swagger-core library generates non-deterministic output, because reflection operations on scanned Resource classes are non-deterministic in the order of methods and fields.

This class and its functionality may be removed if the generation of deterministic output is solved in swagger-core.

See https://github.com/swagger-api/swagger-core/issues/3475 See https://github.com/swagger-api/swagger-core/issues/2775 See https://github.com/swagger-api/swagger-core/issues/2828

  • Method Details

    • sort

      public static io.swagger.v3.oas.models.OpenAPI sort​(io.swagger.v3.oas.models.OpenAPI swagger)
      Sort all the paths and components of the OpenAPI specification, in place.
      Parameters:
      swagger - OpenAPI specification to apply sorting to
      Returns:
      the sorted version of the specification