mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
added sort
This commit is contained in:
parent
7c2d09d0e4
commit
671c5880b9
@ -11,12 +11,26 @@ import io.swagger.models.parameters.Parameter;
|
|||||||
import io.swagger.models.parameters.PathParameter;
|
import io.swagger.models.parameters.PathParameter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DynamicSwaggerConfig extends BeanConfig {
|
public class DynamicSwaggerConfig extends BeanConfig {
|
||||||
static List<String> clients = new ArrayList<String>();
|
static List<String> clients = new ArrayList<String>();
|
||||||
static List<String> servers = new ArrayList<String>();
|
static List<String> servers = new ArrayList<String>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
List<CodegenConfig> extensions = Codegen.getExtensions();
|
||||||
|
for (CodegenConfig config : extensions) {
|
||||||
|
if (config.getTag().equals(CodegenType.CLIENT) || config.getTag().equals(CodegenType.DOCUMENTATION)) {
|
||||||
|
clients.add(config.getName());
|
||||||
|
} else if (config.getTag().equals(CodegenType.SERVER)) {
|
||||||
|
servers.add(config.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Collections.sort(clients);
|
||||||
|
Collections.sort(servers);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Swagger configure(Swagger swagger) {
|
public Swagger configure(Swagger swagger) {
|
||||||
Path clientPath = swagger.getPaths().get("/gen/clients/{language}");
|
Path clientPath = swagger.getPaths().get("/gen/clients/{language}");
|
||||||
@ -62,15 +76,4 @@ public class DynamicSwaggerConfig extends BeanConfig {
|
|||||||
.host(getHost())
|
.host(getHost())
|
||||||
.basePath("/api");
|
.basePath("/api");
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
List<CodegenConfig> extensions = Codegen.getExtensions();
|
|
||||||
for (CodegenConfig config : extensions) {
|
|
||||||
if (config.getTag().equals(CodegenType.CLIENT) || config.getTag().equals(CodegenType.DOCUMENTATION)) {
|
|
||||||
clients.add(config.getName());
|
|
||||||
} else if (config.getTag().equals(CodegenType.SERVER)) {
|
|
||||||
servers.add(config.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,20 @@ public class SwaggerResource {
|
|||||||
static List<String> servers = new ArrayList<String>();
|
static List<String> servers = new ArrayList<String>();
|
||||||
private static Map<String, Generated> fileMap = new HashMap<String, Generated>();
|
private static Map<String, Generated> fileMap = new HashMap<String, Generated>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
List<CodegenConfig> extensions = Codegen.getExtensions();
|
||||||
|
for (CodegenConfig config : extensions) {
|
||||||
|
if (config.getTag().equals(CodegenType.CLIENT) || config.getTag().equals(CodegenType.DOCUMENTATION)) {
|
||||||
|
clients.add(config.getName());
|
||||||
|
} else if (config.getTag().equals(CodegenType.SERVER)) {
|
||||||
|
servers.add(config.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(clients);
|
||||||
|
Collections.sort(servers);
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/download/{fileId}")
|
@Path("/download/{fileId}")
|
||||||
@Produces({MediaType.APPLICATION_OCTET_STREAM})
|
@Produces({MediaType.APPLICATION_OCTET_STREAM})
|
||||||
@ -202,15 +216,4 @@ public class SwaggerResource {
|
|||||||
return Response.status(500).build();
|
return Response.status(500).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
List<CodegenConfig> extensions = Codegen.getExtensions();
|
|
||||||
for (CodegenConfig config : extensions) {
|
|
||||||
if (config.getTag().equals(CodegenType.CLIENT) || config.getTag().equals(CodegenType.DOCUMENTATION)) {
|
|
||||||
clients.add(config.getName());
|
|
||||||
} else if (config.getTag().equals(CodegenType.SERVER)) {
|
|
||||||
servers.add(config.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user