title: Swagger UI: How to custom sort resources
body: <p>Quiet pretty straighforward question: how can I sort the endpoints in swagger-ui in v2.2.6? I'm using springfox for the java part.</p>
  
  <p>In my main page of swagger, I'm having a collection of resources grouped by tags. These tags are in a random order. I would like to have it in a custom order (and if it's not possible, alphabetically).
  My SwaggerConfig.java file:</p>
  
  <pre><code>package cat.meteo.apiinterna.commons.config;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import springfox.documentation.builders.ApiInfoBuilder;
  import springfox.documentation.builders.PathSelectors;
  import springfox.documentation.builders.RequestHandlerSelectors;
  import springfox.documentation.service.ApiInfo;
  import springfox.documentation.service.Tag;
  import springfox.documentation.spi.DocumentationType;
  import springfox.documentation.spring.web.plugins.Docket;
  import springfox.documentation.swagger2.annotations.EnableSwagger2;
  
  @Configuration
  @EnableSwagger2
  public class SwaggerConfig {
  
  @Bean
  public Docket api() {
      return new Docket(DocumentationType.SWAGGER_2)
              .select()
              .apis(RequestHandlerSelectors.any())
              .paths(PathSelectors.any())
              .build()
              .tags(
                      new Tag("XEMA Me", "1"),
                      new Tag("XEMA Ul", "2"),
                      new Tag("XEMA Ag", "3"),
                      new Tag("Prono", "4"),
                      new Tag("Sound", "5")
              )
              .apiInfo(apiInfo());
  }
  
  private ApiInfo apiInfo() {
      return new ApiInfoBuilder()
              .title("API REST")
              .description("Self-documented API")
              .version("v0.1.0")
              .build();
      }
  }
  </code></pre>
  
  <p>And this is the tag resulting json file that swagger-ui uses in the same order. As you can see the order seems to be random. Not the java tags order, not alphabetically.
  (<a href="http://localhost:8080/XXX/v2/api-docs" rel="nofollow noreferrer">http://localhost:8080/XXX/v2/api-docs</a>)</p>
  
  <pre><code>"tags": [
  {
  "name": "XEMA Ul",
  "description": "2"
  },
  {
  "name": "XEMA Me",
  "description": "1"
  },
  {
  "name": "XEMA Ag",
  "description": "3"
  },
  {
  "name": "Sound",
  "description": "5"
  },
  {
  "name": "Prono",
  "description": "4"
  }
  ]
  </code></pre>