Class OpenAPISorter


  • public class OpenAPISorter
    extends java.lang.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 Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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