[java] jaxrs (all) add usetags option (#6130)

* Adds "useTags" option to all jaxrs code generators (AbstractJAXRSServerCodegen):
  - jaxrs-jersey
  - jaxrs-spec
  - jaxrs-cxf-cdi
  - jaxrs-resteasy
  - jaxrs-cxf
  - jaxrs-cxf-extended
  - java-msf4j
  - jaxrs-resteasy-eap
* jaxrs-spec
  - Changed handling of root paths: e.g "/:", "/{id}:" to simplify code and create a more consistent behaviour
    -- old: use tag for classname
    -- new: use tag only if useTags is enabled, use "DefaultApi" if not
* @path class level annotation
  - for all generators above and the microprofile generator (uses same jaxrs postprocessing)
  - extended the "commonPath" to contain more than only the root path if possible
  - e.g. "/group1/subgroup1/op1" -> "/group1/subgroup1" is moved to class level annotation
This commit is contained in:
Philipp Paris
2020-09-21 03:18:07 +02:00
committed by GitHub
parent 3ca6bc2518
commit c7d5275b62
75 changed files with 755 additions and 876 deletions

View File

@@ -51,6 +51,7 @@ sidebar_label: java-msf4j
|sourceFolder|source folder for generated code| |src/main/java|
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## IMPORT MAPPING

View File

@@ -57,6 +57,7 @@ sidebar_label: jaxrs-cxf-cdi
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useSwaggerAnnotations|Whether to generate Swagger annotations.| |true|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## IMPORT MAPPING

View File

@@ -71,6 +71,7 @@ sidebar_label: jaxrs-cxf-extended
|useSpringAnnotationConfig|Use Spring Annotation Config| |false|
|useSwaggerFeature|Use Swagger Feature| |false|
|useSwaggerUI|Use Swagger UI| |false|
|useTags|use tags for creating interface and controller classnames| |true|
|useWadlFeature|Use WADL Feature| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -66,6 +66,7 @@ sidebar_label: jaxrs-cxf
|useSpringAnnotationConfig|Use Spring Annotation Config| |false|
|useSwaggerFeature|Use Swagger Feature| |false|
|useSwaggerUI|Use Swagger UI| |false|
|useTags|use tags for creating interface and controller classnames| |true|
|useWadlFeature|Use WADL Feature| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|

View File

@@ -52,6 +52,7 @@ sidebar_label: jaxrs-resteasy-eap
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useSwaggerFeature|Use dynamic Swagger generator| |false|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## IMPORT MAPPING

View File

@@ -51,6 +51,7 @@ sidebar_label: jaxrs-resteasy
|sourceFolder|source folder for generated code| |src/main/java|
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## IMPORT MAPPING

View File

@@ -57,6 +57,7 @@ sidebar_label: jaxrs-spec
|title|a title describing the application| |OpenAPI Server|
|useBeanValidation|Use BeanValidation API annotations| |true|
|useSwaggerAnnotations|Whether to generate Swagger annotations.| |true|
|useTags|use tags for creating interface and controller classnames| |false|
|withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false|
## IMPORT MAPPING

View File

@@ -17,9 +17,11 @@
package org.openapitools.codegen.languages;
import com.google.common.annotations.VisibleForTesting;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.PathItem;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
import org.openapitools.codegen.utils.URLPathUtils;
@@ -30,10 +32,10 @@ import java.io.File;
import java.net.URL;
import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize;
public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen implements BeanValidationFeatures {
public static final String SERVER_PORT = "serverPort";
public static final String USE_TAGS = "useTags";
/**
* Name of the sub-directory in "src/main/resource" where to find the
* Mustache template for the JAX-RS Codegen.
@@ -43,7 +45,9 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
protected String testResourcesFolder = "src/test/resources";
protected String title = "OpenAPI Server";
protected String serverPort = "8080";
protected boolean useBeanValidation = true;
protected boolean useTags = false;
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractJavaJAXRSServerCodegen.class);
@@ -72,6 +76,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
cliOptions.add(new CliOption("title", "a title describing the application").defaultValue(title));
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations",useBeanValidation));
cliOptions.add(new CliOption(SERVER_PORT, "The port on which the server should be started").defaultValue(serverPort));
cliOptions.add(CliOption.newBoolean(USE_TAGS, "use tags for creating interface and controller classnames"));
}
@@ -93,11 +98,32 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
}
if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION));
setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION));
}
if (additionalProperties.containsKey(USE_TAGS)) {
setUseTags(convertPropertyToBoolean(USE_TAGS));
}
writePropertyBack(USE_BEANVALIDATION, useBeanValidation);
}
@Override
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
final String basePath = StringUtils.substringBefore(StringUtils.removeStart(resourcePath, "/"), "/");
if (!StringUtils.isEmpty(basePath)) {
co.subresourceOperation = !co.path.isEmpty();
}
if (useTags) {
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
} else {
co.baseName = basePath;
if (StringUtils.isEmpty(co.baseName) || StringUtils.containsAny(co.baseName, "{", "}")) {
co.baseName = "default";
}
final List<CodegenOperation> opList = operations.computeIfAbsent(co.baseName, k -> new ArrayList<>());
opList.add(co);
}
}
@Override
@@ -151,9 +177,8 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
static Map<String, Object> jaxrsPostProcessOperations(Map<String, Object> objs) {
@SuppressWarnings("unchecked")
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
String commonPath = null;
if (operations != null) {
String commonBaseName = null;
boolean baseNameEquals = true;
@SuppressWarnings("unchecked")
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
for (CodegenOperation operation : ops) {
@@ -223,24 +248,18 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
} else if ("map".equals(operation.returnContainer)) {
operation.returnContainer = "Map";
}
if(commonBaseName == null) {
commonBaseName = operation.baseName;
} else if(!commonBaseName.equals(operation.baseName)) {
baseNameEquals = false;
if (commonPath == null) {
commonPath = operation.path;
} else {
commonPath = getCommonPath(commonPath, operation.path);
}
}
if(baseNameEquals) {
objs.put("commonPath", commonBaseName);
} else {
for (CodegenOperation operation : ops) {
if(operation.baseName != null) {
operation.path = "/" + operation.baseName + operation.path;
operation.baseName = null;
}
}
objs.put("commonPath", null);
for (CodegenOperation co : ops) {
co.path = StringUtils.removeStart(co.path, commonPath);
co.subresourceOperation = co.path.length() > 1;
}
objs.put("commonPath", "/".equals(commonPath) ? StringUtils.EMPTY : commonPath);
}
return objs;
}
@@ -251,7 +270,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
if (computed.length() > 0) {
computed = sanitizeName(computed);
}
return super.toApiName(computed);
return super.toApiName(computed);
}
@Override
@@ -273,6 +292,19 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
return result;
}
private static String getCommonPath(String path1, String path2) {
final String[] parts1 = StringUtils.split(path1, "/");
final String[] parts2 = StringUtils.split(path2, "/");
StringBuilder builder = new StringBuilder();
for (int i = 0; i < Math.min(parts1.length, parts2.length); i++) {
if (!parts1[i].equals(parts2[i])) {
break;
}
builder.append("/").append(parts1[i]);
}
return builder.toString();
}
private String implFileFolder(String output) {
return outputFolder + "/" + output + "/" + apiPackage().replace('.', '/');
}
@@ -281,5 +313,8 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen
this.useBeanValidation = useBeanValidation;
}
@VisibleForTesting
public void setUseTags(boolean useTags) {
this.useTags = useTags;
}
}

View File

@@ -72,6 +72,7 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
super();
supportsInheritance = true;
useTags = true;
artifactId = "openapi-cxf-server";
@@ -79,6 +80,7 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
// clioOptions default redifinition need to be updated
updateOption(CodegenConstants.ARTIFACT_ID, this.getArtifactId());
updateOption(USE_TAGS, String.valueOf(true));
apiTemplateFiles.put("apiServiceImpl.mustache", ".java");
@@ -234,12 +236,6 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
return "jaxrs-cxf";
}
@Override
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
co.subresourceOperation = !co.path.isEmpty();
}
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
super.postProcessModelProperty(model, property);

View File

@@ -17,19 +17,14 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
import org.openapitools.codegen.meta.features.DocumentationFeature;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static org.openapitools.codegen.utils.StringUtils.camelize;
public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
public static final String INTERFACE_ONLY = "interfaceOnly";
@@ -54,8 +49,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
private boolean useJackson = false;
private String openApiSpecFileLocation = "src/main/openapi/openapi.yaml";
private String primaryResourceName;
public JavaJAXRSSpecServerCodegen() {
super();
@@ -240,41 +233,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
this.openApiSpecFileLocation = location;
}
@Override
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
String basePath = resourcePath;
if (basePath.startsWith("/")) {
basePath = basePath.substring(1);
}
int pos = basePath.indexOf("/");
if (pos > 0) {
basePath = basePath.substring(0, pos);
}
String operationKey = basePath;
if (StringUtils.isEmpty(basePath)) {
basePath = tag;
operationKey = "";
primaryResourceName = tag;
} else if (basePath.matches("\\{.*\\}")) {
basePath = tag;
operationKey = "";
co.subresourceOperation = true;
} else {
if (co.path.startsWith("/" + basePath)) {
co.path = co.path.substring(("/" + basePath).length());
}
co.subresourceOperation = !co.path.isEmpty();
}
List<CodegenOperation> opList = operations.get(operationKey);
if (opList == null || opList.isEmpty()) {
opList = new ArrayList<CodegenOperation>();
operations.put(operationKey, opList);
}
opList.add(co);
co.baseName = basePath;
}
@Override
public CodegenModel fromModel(String name, Schema model) {
CodegenModel codegenModel = super.fromModel(name, model);
@@ -302,16 +260,4 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen {
return "Generates a Java JAXRS Server according to JAXRS 2.0 specification.";
}
@Override
public String toApiName(final String name) {
String computed = name;
if (computed.length() == 0) {
if (primaryResourceName == null) {
return "DefaultApi";
}
return primaryResourceName + "Api";
}
computed = sanitizeName(computed);
return camelize(computed) + "Api";
}
}

View File

@@ -17,7 +17,6 @@
package org.openapitools.codegen.languages;
import io.swagger.v3.oas.models.Operation;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.*;
@@ -34,9 +33,6 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
* Default library template to use. (Default: jersey2)
*/
public static final String DEFAULT_JERSEY_LIBRARY = LIBRARY_JERSEY2;
public static final String USE_TAGS = "useTags";
protected boolean useTags = false;
public JavaJerseyServerCodegen() {
super();
@@ -65,7 +61,6 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
cliOptions.add(library);
cliOptions.add(CliOption.newBoolean(SUPPORT_JAVA6, "Whether to support Java6 with the Jersey1/2 library."));
cliOptions.add(CliOption.newBoolean(USE_TAGS, "use tags for creating interface and controller classnames"));
}
@Override
@@ -108,10 +103,6 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER);
}
if (additionalProperties.containsKey(USE_TAGS)) {
this.setUseTags(Boolean.valueOf(additionalProperties.get(USE_TAGS).toString()));
}
if ("joda".equals(dateLibrary)) {
supportingFiles.add(new SupportingFile("JodaDateTimeProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaDateTimeProvider.java"));
supportingFiles.add(new SupportingFile("JodaLocalDateProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaLocalDateProvider.java"));
@@ -160,59 +151,4 @@ public class JavaJerseyServerCodegen extends AbstractJavaJAXRSServerCodegen {
return objs;
}
@Override
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
if (useTags) {
String basePath = tag.toLowerCase(Locale.ROOT);
if (basePath.startsWith("/")) {
basePath = basePath.substring(1);
}
int pos = basePath.indexOf("/");
if (pos > 0) {
basePath = basePath.substring(0, pos);
}
boolean pathStartsWithBasePath = co.path.startsWith("/" + basePath);
if (pathStartsWithBasePath) {
co.path = co.path.substring(("/" + basePath).length());
}
co.subresourceOperation = !co.path.isEmpty();
super.addOperationToGroup(tag, resourcePath, operation, co, operations);
if (pathStartsWithBasePath) {
co.baseName = basePath;
} else {
co.baseName = null;
}
} else {
String basePath = resourcePath;
if (basePath.startsWith("/")) {
basePath = basePath.substring(1);
}
int pos = basePath.indexOf("/");
if (pos > 0) {
basePath = basePath.substring(0, pos);
}
if (StringUtils.isEmpty(basePath)) {
basePath = "default";
} else {
if (co.path.startsWith("/" + basePath)) {
co.path = co.path.substring(("/" + basePath).length());
}
co.subresourceOperation = !co.path.isEmpty();
}
List<CodegenOperation> opList = operations.get(basePath);
if (opList == null || opList.isEmpty()) {
opList = new ArrayList<CodegenOperation>();
operations.put(basePath, opList);
}
opList.add(co);
co.baseName = basePath;
}
}
public void setUseTags(boolean useTags) {
this.useTags = useTags;
}
}

View File

@@ -144,32 +144,4 @@ public class JavaMSF4JServerCodegen extends AbstractJavaJAXRSServerCodegen {
return objs;
}
@Override
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
String basePath = resourcePath;
if (basePath.startsWith("/")) {
basePath = basePath.substring(1);
}
int pos = basePath.indexOf("/");
if (pos > 0) {
basePath = basePath.substring(0, pos);
}
if (StringUtils.isEmpty(basePath)) {
basePath = "default";
} else {
if (co.path.startsWith("/" + basePath)) {
co.path = co.path.substring(("/" + basePath).length());
}
co.subresourceOperation = !co.path.isEmpty();
}
List<CodegenOperation> opList = operations.get(basePath);
if (opList == null) {
opList = new ArrayList<CodegenOperation>();
operations.put(basePath, opList);
}
opList.add(co);
co.baseName = basePath;
}
}

View File

@@ -120,34 +120,6 @@ public class JavaResteasyEapServerCodegen extends AbstractJavaJAXRSServerCodegen
}
@Override
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
String basePath = resourcePath;
if (basePath.startsWith("/")) {
basePath = basePath.substring(1);
}
int pos = basePath.indexOf("/");
if (pos > 0) {
basePath = basePath.substring(0, pos);
}
if (StringUtils.isEmpty(basePath)) {
basePath = "default";
} else {
if (co.path.startsWith("/" + basePath)) {
co.path = co.path.substring(("/" + basePath).length());
}
co.subresourceOperation = !co.path.isEmpty();
}
List<CodegenOperation> opList = operations.get(basePath);
if (opList == null || opList.isEmpty()) {
opList = new ArrayList<CodegenOperation>();
operations.put(basePath, opList);
}
opList.add(co);
co.baseName = basePath;
}
@Override
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
return super.postProcessOperationsWithModels(objs, allModels);

View File

@@ -131,34 +131,6 @@ public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen im
}
}
@Override
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
String basePath = resourcePath;
if (basePath.startsWith("/")) {
basePath = basePath.substring(1);
}
int pos = basePath.indexOf("/");
if (pos > 0) {
basePath = basePath.substring(0, pos);
}
if (StringUtils.isEmpty(basePath)) {
basePath = "default";
} else {
if (co.path.startsWith("/" + basePath)) {
co.path = co.path.substring(("/" + basePath).length());
}
co.subresourceOperation = !co.path.isEmpty();
}
List<CodegenOperation> opList = operations.get(basePath);
if (opList == null || opList.isEmpty()) {
opList = new ArrayList<CodegenOperation>();
operations.put(basePath, opList);
}
opList.add(co);
co.baseName = basePath;
}
@Override
public Map<String, Object> postProcessOperationsWithModels(Map<String, Object> objs, List<Object> allModels) {
return super.postProcessOperationsWithModels(objs, allModels);

View File

@@ -150,7 +150,7 @@ All URIs are relative to *{{basePath}}*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{commonPath}}{{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
## Documentation for Models

View File

@@ -6,7 +6,7 @@ All URIs are relative to *{{basePath}}*
Method | HTTP request | Description
------------- | ------------- | -------------
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{commonPath}}{{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}
{{#operations}}

View File

@@ -31,7 +31,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient
@RegisterProvider(ApiExceptionMapper.class)
@Path("{{^useAnnotatedBasePath}}/{{/useAnnotatedBasePath}}{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}")
@Path("{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}{{commonPath}}")
public interface {{classname}} {
{{#operations}}
{{#operation}}

View File

@@ -29,7 +29,7 @@ import javax.validation.constraints.*;
import javax.validation.Valid;
{{/useBeanValidation}}
{{#commonPath}}@Path("/{{{commonPath}}}"){{/commonPath}}{{^commonPath}}@Path(""){{/commonPath}}
@Path("{{commonPath}}")
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@io.swagger.annotations.Api(description = "the {{{baseName}}} API")

View File

@@ -23,7 +23,7 @@ import java.util.List;
{{#useBeanValidation}}
import javax.validation.constraints.*;
{{/useBeanValidation}}
@Path("/{{{baseName}}}")
@Path("{{commonPath}}")
@RequestScoped
@Api(description = "the {{{baseName}}} API")

View File

@@ -32,7 +32,7 @@ import javax.validation.Valid;
{{/appDescription}}
*/
{{/appName}}
@Path("{{^useAnnotatedBasePath}}/{{/useAnnotatedBasePath}}{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}")
@Path("{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}{{commonPath}}")
@Api(value = "/", description = "{{description}}")
{{#addConsumesProducesJson}}
@Consumes(MediaType.APPLICATION_JSON)

View File

@@ -32,7 +32,7 @@ import javax.validation.Valid;
{{/appDescription}}
*/
{{/appName}}
@Path("{{^useAnnotatedBasePath}}/{{/useAnnotatedBasePath}}{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}")
@Path("{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}{{commonPath}}")
@Api(value = "/", description = "{{description}}")
{{#addConsumesProducesJson}}
@Consumes(MediaType.APPLICATION_JSON)

View File

@@ -28,7 +28,7 @@ import javax.validation.constraints.*;
import javax.validation.Valid;
{{/useBeanValidation}}
@Path("/{{{baseName}}}")
@Path("{{commonPath}}")
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@io.swagger.annotations.Api(description = "the {{{baseName}}} API")

View File

@@ -27,7 +27,7 @@ import javax.validation.Valid;
{{/useBeanValidation}}
{{#operations}}{{#operation}}{{#isMultipart}}import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
{{/isMultipart}}{{/operation}}{{/operations}}
@Path("/{{{baseName}}}")
@Path("{{commonPath}}")
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@io.swagger.annotations.Api(description = "the {{{baseName}}} API")

View File

@@ -23,7 +23,7 @@ import javax.validation.Valid;
{{/useBeanValidation}}
{{#operations}}{{#operation}}{{#isMultipart}}import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
{{/isMultipart}}{{/operation}}{{/operations}}
@Path("/{{{baseName}}}")
@Path("{{commonPath}}")
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@io.swagger.annotations.Api(description = "the {{{baseName}}} API")

View File

@@ -16,7 +16,7 @@ import java.util.List;
{{#useBeanValidation}}import javax.validation.constraints.*;
import javax.validation.Valid;{{/useBeanValidation}}
@Path("/{{{baseName}}}"){{#useSwaggerAnnotations}}
@Path("{{commonPath}}"){{#useSwaggerAnnotations}}
@Api(description = "the {{{baseName}}} API"){{/useSwaggerAnnotations}}{{#hasConsumes}}
@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}{{#hasProduces}}
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}

View File

@@ -23,7 +23,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*;
@Path("/{{{baseName}}}")
@Path("{{commonPath}}")
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@io.swagger.annotations.Api(description = "the {{baseName}} API")

View File

@@ -20,11 +20,14 @@ package org.openapitools.codegen.java.jaxrs;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.servers.Server;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.languages.AbstractJavaJAXRSServerCodegen;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.*;
public class AbstractJavaJAXRSServerCodegenTest {
private final AbstractJavaJAXRSServerCodegen fakeJavaJAXRSCodegen = new P_AbstractJavaJAXRSServerCodegen();
@@ -102,6 +105,76 @@ public class AbstractJavaJAXRSServerCodegenTest {
Assert.assertEquals(codegen.additionalProperties().get(AbstractJavaJAXRSServerCodegen.SERVER_PORT), "8088");
}
@Test
public void testCommonPath() {
final AbstractJavaJAXRSServerCodegen codegen = new P_AbstractJavaJAXRSServerCodegen();
Map<String, Object> objs = new HashMap<>();
Map<String, List<CodegenOperation>> opMap = new HashMap<>();
List<CodegenOperation> operations = new ArrayList<>();
objs.put("operations", opMap);
opMap.put("operation", operations);
operations.add(getCo("/"));
codegen.postProcessOperationsWithModels(objs, Collections.emptyList());
Assert.assertEquals(objs.get("commonPath"), "");
Assert.assertEquals(operations.get(0).path, "");
Assert.assertFalse(operations.get(0).subresourceOperation);
operations.clear();
operations.add(getCo("/test"));
codegen.postProcessOperationsWithModels(objs, Collections.emptyList());
Assert.assertEquals(objs.get("commonPath"), "/test");
Assert.assertEquals(operations.get(0).path, "");
Assert.assertFalse(operations.get(0).subresourceOperation);
operations.clear();
operations.add(getCo("/"));
operations.add(getCo("/op1"));
codegen.postProcessOperationsWithModels(objs, Collections.emptyList());
Assert.assertEquals(objs.get("commonPath"), "");
Assert.assertEquals(operations.get(0).path, "/");
Assert.assertFalse(operations.get(0).subresourceOperation);
Assert.assertEquals(operations.get(1).path, "/op1");
Assert.assertTrue(operations.get(1).subresourceOperation);
operations.clear();
operations.add(getCo("/group1/subgroup1/op1"));
operations.add(getCo("/group1/subgroup1/op2"));
codegen.postProcessOperationsWithModels(objs, Collections.emptyList());
Assert.assertEquals(objs.get("commonPath"), "/group1/subgroup1");
Assert.assertEquals(operations.get(0).path, "/op1");
Assert.assertTrue(operations.get(0).subresourceOperation);
Assert.assertEquals(operations.get(1).path, "/op2");
Assert.assertTrue(operations.get(1).subresourceOperation);
operations.clear();
operations.add(getCo("/op1"));
operations.add(getCo("/op2"));
codegen.postProcessOperationsWithModels(objs, Collections.emptyList());
Assert.assertEquals(objs.get("commonPath"), "");
Assert.assertEquals(operations.get(0).path, "/op1");
Assert.assertTrue(operations.get(0).subresourceOperation);
Assert.assertEquals(operations.get(1).path, "/op2");
Assert.assertTrue(operations.get(1).subresourceOperation);
operations.clear();
operations.add(getCo("/group1"));
operations.add(getCo("/group1/op1"));
codegen.postProcessOperationsWithModels(objs, Collections.emptyList());
Assert.assertEquals(objs.get("commonPath"), "/group1");
Assert.assertEquals(operations.get(0).path, "");
Assert.assertFalse(operations.get(0).subresourceOperation);
Assert.assertEquals(operations.get(1).path, "/op1");
Assert.assertTrue(operations.get(1).subresourceOperation);
operations.clear();
}
private CodegenOperation getCo(final String path) {
final CodegenOperation co = new CodegenOperation();
co.path = path;
return co;
}
private static class P_AbstractJavaJAXRSServerCodegen extends AbstractJavaJAXRSServerCodegen {
@Override

View File

@@ -0,0 +1,12 @@
package org.openapitools.codegen.java.jaxrs;
import org.openapitools.codegen.languages.JavaJAXRSCXFCDIServerCodegen;
import org.testng.annotations.BeforeMethod;
public class JavaJAXRSCXFCDIServerCodegenTest extends JavaJaxrsBaseTest {
@BeforeMethod
public void beforeMethod() {
codegen = new JavaJAXRSCXFCDIServerCodegen();
}
}

View File

@@ -368,82 +368,6 @@ public class JavaJAXRSCXFExtServerCodegenTest extends JavaJaxrsBaseTest {
assertEquals(testerCodegen.getTestDataControlFile(), new File(curdir, "my/test-data-control.json"));
}
@Test
public void testAddOperationToGroup() throws Exception {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();
OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/tags.yaml", null, new ParseOptions())
.getOpenAPI();
codegen.setOutputDir(output.getAbsolutePath());
ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
MockDefaultGenerator generator = new MockDefaultGenerator();
generator.opts(input).generate();
WrittenTemplateBasedFile tag1File = TestUtils.getTemplateBasedFile(generator, output,
"src/gen/java/org/openapitools/api/Tag1Api.java");
assertEquals(tag1File.getTemplateData().get("baseName"), "Tag1");
assertEquals(tag1File.getTemplateData().get("commonPath"), "Tag1");
List<CodegenOperation> tag1List = getOperationsList(tag1File.getTemplateData());
assertEquals(tag1List.size(), 1);
assertEquals(tag1List.get(0).path, "/group1/op1");
assertEquals(tag1List.get(0).baseName, "Tag1");
assertEquals(tag1List.get(0).subresourceOperation, true);
WrittenTemplateBasedFile tag2File = TestUtils.getTemplateBasedFile(generator, output,
"src/gen/java/org/openapitools/api/Tag2Api.java");
assertEquals(tag2File.getTemplateData().get("baseName"), "Tag2");
assertEquals(tag2File.getTemplateData().get("commonPath"), "Tag2");
List<CodegenOperation> tag2List = getOperationsList(tag2File.getTemplateData());
assertEquals(tag2List.size(), 2);
assertEquals(tag2List.get(0).path, "/group1/op2");
assertEquals(tag2List.get(0).baseName, "Tag2");
assertEquals(tag2List.get(0).subresourceOperation, true);
assertEquals(tag2List.get(1).path, "/group2/op3");
assertEquals(tag2List.get(1).baseName, "Tag2");
assertEquals(tag2List.get(1).subresourceOperation, true);
WrittenTemplateBasedFile defaultFile = TestUtils.getTemplateBasedFile(generator, output,
"src/gen/java/org/openapitools/api/DefaultApi.java");
assertEquals(defaultFile.getTemplateData().get("baseName"), "Default");
assertEquals(defaultFile.getTemplateData().get("commonPath"), "Default");
List<CodegenOperation> defaultList = getOperationsList(defaultFile.getTemplateData());
assertEquals(defaultList.size(), 1);
assertEquals(defaultList.get(0).path, "/group3/op4");
assertEquals(defaultList.get(0).baseName, "Default");
assertEquals(defaultList.get(0).subresourceOperation, true);
WrittenTemplateBasedFile group4File = TestUtils.getTemplateBasedFile(generator, output,
"src/gen/java/org/openapitools/api/Group4Api.java");
assertEquals(group4File.getTemplateData().get("baseName"), "Group4");
assertEquals(group4File.getTemplateData().get("commonPath"), "Group4");
List<CodegenOperation> group4List = getOperationsList(group4File.getTemplateData());
assertEquals(group4List.size(), 2);
assertEquals(group4List.get(0).path, "/group4/op5");
assertEquals(group4List.get(0).baseName, "Group4");
assertEquals(group4List.get(0).subresourceOperation, true);
assertEquals(group4List.get(1).path, "/group4/op6");
assertEquals(group4List.get(1).baseName, "Group4");
assertEquals(group4List.get(1).subresourceOperation, true);
WrittenTemplateBasedFile group5File = TestUtils.getTemplateBasedFile(generator, output,
"src/gen/java/org/openapitools/api/Group5Api.java");
assertEquals(group5File.getTemplateData().get("baseName"), "Group5");
assertEquals(group5File.getTemplateData().get("commonPath"), "Group5");
List<CodegenOperation> group5List = getOperationsList(group5File.getTemplateData());
assertEquals(group5List.size(), 2);
assertEquals(group5List.get(0).path, "/group5/op7");
assertEquals(group5List.get(0).baseName, "Group5");
assertEquals(group5List.get(0).subresourceOperation, true);
assertEquals(group5List.get(1).path, "/group6/op8");
assertEquals(group5List.get(1).baseName, "Group5");
assertEquals(group5List.get(1).subresourceOperation, true);
}
@Test()
public void testGenerateOperationBodyWithCodedTestData() throws Exception {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();

View File

@@ -31,6 +31,7 @@ import java.util.Map;
import static org.openapitools.codegen.TestUtils.assertFileContains;
import static org.openapitools.codegen.TestUtils.validateJavaSourceFiles;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
/**
@@ -119,19 +120,40 @@ public class JavaJAXRSSpecServerCodegenTest extends JavaJaxrsBaseTest {
/**
* Test
* {@link JavaJAXRSSpecServerCodegen#addOperationToGroup(String, String, Operation, CodegenOperation, Map)} for Resource with path "/" and set tag.
* {@link JavaJAXRSSpecServerCodegen#addOperationToGroup(String, String, Operation, CodegenOperation, Map)} for Resource with path "/" without "useTags"
*/
@Test
public void testAddOperationToGroupForRootResource() {
public void testAddOperationToGroupForRootResourceAndUseTagsFalse() {
CodegenOperation codegenOperation = new CodegenOperation();
codegenOperation.operationId = "findPrimaryresource";
codegenOperation.path = "/";
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
codegen.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
Assert.assertEquals(operationList.size(), 1);
assertTrue(operationList.containsKey(""));
Assert.assertTrue(operationList.containsKey("default"));
Assert.assertEquals(codegenOperation.baseName, "default");
}
/**
* Test
* {@link JavaJAXRSSpecServerCodegen#addOperationToGroup(String, String, Operation, CodegenOperation, Map)} for Resource with path "/" with "useTags"
*/
@Test
public void testAddOperationToGroupForRootResourceAndUseTagsTrue() {
CodegenOperation codegenOperation = new CodegenOperation();
codegenOperation.operationId = "findPrimaryresource";
codegenOperation.path = "/";
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
codegen.setUseTags(true);
codegen.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
Assert.assertEquals(operationList.size(), 1);
Assert.assertTrue(operationList.containsKey("Primaryresource"));
Assert.assertEquals(codegenOperation.baseName, "Primaryresource");
}
@@ -140,16 +162,36 @@ public class JavaJAXRSSpecServerCodegenTest extends JavaJaxrsBaseTest {
* {@link JavaJAXRSSpecServerCodegen#addOperationToGroup(String, String, Operation, CodegenOperation, Map)} for Resource with path param.
*/
@Test
public void testAddOperationToGroupForRootResourcePathParam() {
public void testAddOperationToGroupForRootResourcePathParamAndUseTagsFalse() {
CodegenOperation codegenOperation = new CodegenOperation();
codegenOperation.operationId = "getPrimaryresource";
codegenOperation.path = "/{uuid}";
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
codegen.addOperationToGroup("Primaryresource", "/{uuid}", operation, codegenOperation, operationList);
Assert.assertEquals(operationList.size(), 1);
assertTrue(operationList.containsKey(""));
Assert.assertTrue(operationList.containsKey("default"));
}
/**
* Test
* {@link JavaJAXRSSpecServerCodegen#addOperationToGroup(String, String, Operation, CodegenOperation, Map)} for Resource with path param.
*/
@Test
public void testAddOperationToGroupForRootResourcePathParamAndUseTagsTrue() {
CodegenOperation codegenOperation = new CodegenOperation();
codegenOperation.operationId = "getPrimaryresource";
codegenOperation.path = "/{uuid}";
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
codegen.setUseTags(true);
codegen.addOperationToGroup("Primaryresource", "/{uuid}", operation, codegenOperation, operationList);
Assert.assertEquals(operationList.size(), 1);
Assert.assertTrue(operationList.containsKey("Primaryresource"));
Assert.assertEquals(codegenOperation.baseName, "Primaryresource");
}
@@ -181,21 +223,6 @@ public class JavaJAXRSSpecServerCodegenTest extends JavaJaxrsBaseTest {
Assert.assertEquals(subresource, "SubresourceApi");
}
/**
* Test {@link JavaJAXRSSpecServerCodegen#toApiName(String)} with primary resource.
*/
@Test
public void testToApiNameForPrimaryResource() {
CodegenOperation codegenOperation = new CodegenOperation();
codegenOperation.operationId = "findPrimaryresource";
Operation operation = new Operation();
Map<String, List<CodegenOperation>> operationList = new HashMap<>();
codegen.addOperationToGroup("Primaryresource", "/", operation, codegenOperation, operationList);
final String subresource = codegen.toApiName("");
Assert.assertEquals(subresource, "PrimaryresourceApi");
}
@Test
public void testGeneratePingDefaultLocation() throws Exception {
Map<String, Object> properties = new HashMap<>();

View File

@@ -5,15 +5,20 @@ import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.parser.core.models.ParseOptions;
import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.MockDefaultGenerator;
import org.openapitools.codegen.TestUtils;
import org.openapitools.codegen.languages.AbstractJavaJAXRSServerCodegen;
import org.openapitools.codegen.languages.features.CXFServerFeatures;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
import java.util.Map;
import java.nio.file.Paths;
import static org.openapitools.codegen.TestUtils.assertFileContains;
@@ -127,4 +132,142 @@ public abstract class JavaJaxrsBaseTest {
assertFileContains(Paths.get(outputPath + "/src/gen/java/org/openapitools/api/ExamplesApi.java"), "DefaultValue");
}
@Test
public void testAddOperationToGroupUseTagsTrue() throws IOException {
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/tags.yaml");
codegen.setUseTags(true);
codegen.setOutputDir(output.getAbsolutePath());
MockDefaultGenerator generator = new MockDefaultGenerator();
generator.opts(new ClientOptInput().openAPI(openAPI).config(codegen)).generate();
MockDefaultGenerator.WrittenTemplateBasedFile tag0File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Tag0Api.java");
Assert.assertEquals(tag0File.getTemplateData().get("baseName"), "Tag0");
Assert.assertEquals(tag0File.getTemplateData().get("commonPath"), "");
List<CodegenOperation> tag0 = getOperationsList(tag0File.getTemplateData());
Assert.assertEquals(tag0.size(), 2);
assertOperation(tag0.get(0), "Tag0", "/", false);
assertOperation(tag0.get(1), "Tag0", "/{id}", true);
MockDefaultGenerator.WrittenTemplateBasedFile tag1File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Tag1Api.java");
Assert.assertEquals(tag1File.getTemplateData().get("baseName"), "Tag1");
Assert.assertEquals(tag1File.getTemplateData().get("commonPath"), "/group1/op1");
List<CodegenOperation> tag1 = getOperationsList(tag1File.getTemplateData());
Assert.assertEquals(tag1.size(), 1);
assertOperation(tag1.get(0), "Tag1", "", false);
MockDefaultGenerator.WrittenTemplateBasedFile tag2File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Tag2Api.java");
Assert.assertEquals(tag2File.getTemplateData().get("baseName"), "Tag2");
Assert.assertEquals(tag2File.getTemplateData().get("commonPath"), "");
List<CodegenOperation> tag2 = getOperationsList(tag2File.getTemplateData());
Assert.assertEquals(tag2.size(), 2);
assertOperation(tag2.get(0), "Tag2", "/group1/op2", true);
assertOperation(tag2.get(1), "Tag2", "/group2/op3", true);
MockDefaultGenerator.WrittenTemplateBasedFile defaultFile = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/DefaultApi.java");
Assert.assertEquals(defaultFile.getTemplateData().get("baseName"), "Default");
Assert.assertEquals(defaultFile.getTemplateData().get("commonPath"), "/group3/op4");
List<CodegenOperation> noTag = getOperationsList(defaultFile.getTemplateData());
Assert.assertEquals(noTag.size(), 1);
assertOperation(noTag.get(0), "Default", "", false);
MockDefaultGenerator.WrittenTemplateBasedFile group4File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group4Api.java");
Assert.assertEquals(group4File.getTemplateData().get("baseName"), "Group4");
Assert.assertEquals(group4File.getTemplateData().get("commonPath"), "/group4");
List<CodegenOperation> group4 = getOperationsList(group4File.getTemplateData());
Assert.assertEquals(group4.size(), 2);
assertOperation(group4.get(0), "Group4", "/op5", true);
assertOperation(group4.get(1), "Group4", "/op6", true);
MockDefaultGenerator.WrittenTemplateBasedFile group5File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group5Api.java");
Assert.assertEquals(group5File.getTemplateData().get("baseName"), "Group5");
Assert.assertEquals(group5File.getTemplateData().get("commonPath"), "");
List<CodegenOperation> group5 = getOperationsList(group5File.getTemplateData());
Assert.assertEquals(group5.size(), 2);
assertOperation(group5.get(0), "Group5", "/group5/op7", true);
assertOperation(group5.get(1), "Group5", "/group6/op8", true);
}
@Test
public void testAddOperationToGroupUseTagsFalse() throws Exception {
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/tags.yaml");
codegen.setUseTags(false);
codegen.setOutputDir(output.getAbsolutePath());
MockDefaultGenerator generator = new MockDefaultGenerator();
generator.opts(new ClientOptInput().openAPI(openAPI).config(codegen)).generate();
MockDefaultGenerator.WrittenTemplateBasedFile tag0File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/DefaultApi.java");
Assert.assertEquals(tag0File.getTemplateData().get("baseName"), "default");
Assert.assertEquals(tag0File.getTemplateData().get("commonPath"), "");
List<CodegenOperation> tag0 = getOperationsList(tag0File.getTemplateData());
Assert.assertEquals(tag0.size(), 2);
assertOperation(tag0.get(0), "default", "/", false);
assertOperation(tag0.get(1), "default", "/{id}", true);
MockDefaultGenerator.WrittenTemplateBasedFile group1File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group1Api.java");
Assert.assertEquals(group1File.getTemplateData().get("baseName"), "group1");
Assert.assertEquals(group1File.getTemplateData().get("commonPath"), "/group1");
List<CodegenOperation> group1 = getOperationsList(group1File.getTemplateData());
Assert.assertEquals(group1.size(), 2);
assertOperation(group1.get(0), "group1", "/op1", true);
assertOperation(group1.get(1), "group1", "/op2", true);
MockDefaultGenerator.WrittenTemplateBasedFile group2File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group2Api.java");
Assert.assertEquals(group2File.getTemplateData().get("baseName"), "group2");
Assert.assertEquals(group2File.getTemplateData().get("commonPath"), "/group2/op3");
List<CodegenOperation> group2 = getOperationsList(group2File.getTemplateData());
Assert.assertEquals(group2.size(), 1);
assertOperation(group2.get(0), "group2", "", false);
MockDefaultGenerator.WrittenTemplateBasedFile group3File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group3Api.java");
Assert.assertEquals(group3File.getTemplateData().get("baseName"), "group3");
Assert.assertEquals(group3File.getTemplateData().get("commonPath"), "/group3/op4");
List<CodegenOperation> group3 = getOperationsList(group3File.getTemplateData());
Assert.assertEquals(group3.size(), 1);
assertOperation(group3.get(0), "group3", "", false);
MockDefaultGenerator.WrittenTemplateBasedFile group4File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group4Api.java");
Assert.assertEquals(group4File.getTemplateData().get("baseName"), "group4");
Assert.assertEquals(group4File.getTemplateData().get("commonPath"), "/group4");
List<CodegenOperation> group4 = getOperationsList(group4File.getTemplateData());
Assert.assertEquals(group4.size(), 2);
assertOperation(group4.get(0), "group4", "/op5", true);
assertOperation(group4.get(1), "group4", "/op6", true);
MockDefaultGenerator.WrittenTemplateBasedFile group5File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group5Api.java");
Assert.assertEquals(group5File.getTemplateData().get("baseName"), "group5");
Assert.assertEquals(group5File.getTemplateData().get("commonPath"), "/group5/op7");
List<CodegenOperation> group5 = getOperationsList(group5File.getTemplateData());
Assert.assertEquals(group5.size(), 1);
assertOperation(group5.get(0), "group5", "", false);
MockDefaultGenerator.WrittenTemplateBasedFile group6File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group6Api.java");
Assert.assertEquals(group6File.getTemplateData().get("baseName"), "group6");
Assert.assertEquals(group6File.getTemplateData().get("commonPath"), "/group6/op8");
List<CodegenOperation> group6 = getOperationsList(group6File.getTemplateData());
Assert.assertEquals(group6.size(), 1);
assertOperation(group6.get(0), "group6", "", false);
}
private void assertOperation(CodegenOperation op, String expectedBasename, String expectedPath, boolean expectedSubResourceOp) {
Assert.assertEquals(op.path, expectedPath);
Assert.assertEquals(op.baseName, expectedBasename);
Assert.assertEquals(op.subresourceOperation, expectedSubResourceOp);
}
@SuppressWarnings("unchecked")
private List<CodegenOperation> getOperationsList(Map<String, Object> templateData) {
Assert.assertTrue(templateData.get("operations") instanceof Map);
Map<String, Object> operations = (Map<String, Object>) templateData.get("operations");
Assert.assertTrue(operations.get("operation") instanceof List);
return (List<CodegenOperation>) operations.get("operation");
}
}

View File

@@ -87,159 +87,4 @@ public class JavaJerseyServerCodegenTest extends JavaJaxrsBaseTest {
Assert.assertEquals(codegen.additionalProperties().get(JavaJerseyServerCodegen.SERVER_PORT), "8088");
}
@Test
public void testAddOperationToGroupUseTagsFalse() throws Exception {
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/tags.yaml");
((JavaJerseyServerCodegen) codegen).setUseTags(false);
codegen.setOutputDir(output.getAbsolutePath());
ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
MockDefaultGenerator generator = new MockDefaultGenerator();
generator.opts(input).generate();
WrittenTemplateBasedFile group1File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group1Api.java");
Assert.assertEquals(group1File.getTemplateData().get("baseName"), "group1");
Assert.assertEquals(group1File.getTemplateData().get("commonPath"), "group1");
List<CodegenOperation> group1 = getOperationsList(group1File.getTemplateData());
Assert.assertEquals(group1.size(), 2);
Assert.assertEquals(group1.get(0).path, "/op1");
Assert.assertEquals(group1.get(0).baseName, "group1");
Assert.assertEquals(group1.get(0).subresourceOperation, true);
Assert.assertEquals(group1.get(1).path, "/op2");
Assert.assertEquals(group1.get(1).baseName, "group1");
Assert.assertEquals(group1.get(1).subresourceOperation, true);
WrittenTemplateBasedFile group2File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group2Api.java");
Assert.assertEquals(group2File.getTemplateData().get("baseName"), "group2");
Assert.assertEquals(group2File.getTemplateData().get("commonPath"), "group2");
List<CodegenOperation> group2 = getOperationsList(group2File.getTemplateData());
Assert.assertEquals(group2.size(), 1);
Assert.assertEquals(group2.get(0).path, "/op3");
Assert.assertEquals(group2.get(0).baseName, "group2");
Assert.assertEquals(group2.get(0).subresourceOperation, true);
WrittenTemplateBasedFile group3File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group3Api.java");
Assert.assertEquals(group3File.getTemplateData().get("baseName"), "group3");
Assert.assertEquals(group3File.getTemplateData().get("commonPath"), "group3");
List<CodegenOperation> group3 = getOperationsList(group3File.getTemplateData());
Assert.assertEquals(group3.size(), 1);
Assert.assertEquals(group3.get(0).path, "/op4");
Assert.assertEquals(group3.get(0).baseName, "group3");
Assert.assertEquals(group3.get(0).subresourceOperation, true);
WrittenTemplateBasedFile group4File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group4Api.java");
Assert.assertEquals(group4File.getTemplateData().get("baseName"), "group4");
Assert.assertEquals(group4File.getTemplateData().get("commonPath"), "group4");
List<CodegenOperation> group4 = getOperationsList(group4File.getTemplateData());
Assert.assertEquals(group4.size(), 2);
Assert.assertEquals(group4.get(0).path, "/op5");
Assert.assertEquals(group4.get(0).baseName, "group4");
Assert.assertEquals(group4.get(0).subresourceOperation, true);
Assert.assertEquals(group4.get(1).path, "/op6");
Assert.assertEquals(group4.get(1).baseName, "group4");
Assert.assertEquals(group4.get(1).subresourceOperation, true);
WrittenTemplateBasedFile group5File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group5Api.java");
Assert.assertEquals(group5File.getTemplateData().get("baseName"), "group5");
Assert.assertEquals(group5File.getTemplateData().get("commonPath"), "group5");
List<CodegenOperation> group5 = getOperationsList(group5File.getTemplateData());
Assert.assertEquals(group5.size(), 1);
Assert.assertEquals(group5.get(0).path, "/op7");
Assert.assertEquals(group5.get(0).baseName, "group5");
Assert.assertEquals(group5.get(0).subresourceOperation, true);
WrittenTemplateBasedFile group6File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group6Api.java");
Assert.assertEquals(group6File.getTemplateData().get("baseName"), "group6");
Assert.assertEquals(group6File.getTemplateData().get("commonPath"), "group6");
List<CodegenOperation> group6 = getOperationsList(group6File.getTemplateData());
Assert.assertEquals(group6.size(), 1);
Assert.assertEquals(group6.get(0).path, "/op8");
Assert.assertEquals(group6.get(0).baseName, "group6");
Assert.assertEquals(group6.get(0).subresourceOperation, true);
}
@Test
public void testAddOperationToGroupUseTagsTrue() throws Exception {
File output = Files.createTempDirectory("test").toFile();
output.deleteOnExit();
OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/tags.yaml");
((JavaJerseyServerCodegen) codegen).setUseTags(true);
codegen.setOutputDir(output.getAbsolutePath());
ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
MockDefaultGenerator generator = new MockDefaultGenerator();
generator.opts(input).generate();
WrittenTemplateBasedFile tag1File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Tag1Api.java");
Assert.assertEquals(tag1File.getTemplateData().get("baseName"), "Tag1");
Assert.assertEquals(tag1File.getTemplateData().get("commonPath"), null);
List<CodegenOperation> tag1List = getOperationsList(tag1File.getTemplateData());
Assert.assertEquals(tag1List.size(), 1);
Assert.assertEquals(tag1List.get(0).path, "/group1/op1");
Assert.assertEquals(tag1List.get(0).baseName, null);
Assert.assertEquals(tag1List.get(0).subresourceOperation, true);
WrittenTemplateBasedFile tag2File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Tag2Api.java");
Assert.assertEquals(tag2File.getTemplateData().get("baseName"), "Tag2");
Assert.assertEquals(tag2File.getTemplateData().get("commonPath"), null);
List<CodegenOperation> tag2List = getOperationsList(tag2File.getTemplateData());
Assert.assertEquals(tag2List.size(), 2);
Assert.assertEquals(tag2List.get(0).path, "/group1/op2");
Assert.assertEquals(tag2List.get(0).baseName, null);
Assert.assertEquals(tag2List.get(0).subresourceOperation, true);
Assert.assertEquals(tag2List.get(1).path, "/group2/op3");
Assert.assertEquals(tag2List.get(1).baseName, null);
Assert.assertEquals(tag2List.get(1).subresourceOperation, true);
WrittenTemplateBasedFile defaultFile = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/DefaultApi.java");
Assert.assertEquals(defaultFile.getTemplateData().get("baseName"), "Default");
Assert.assertEquals(defaultFile.getTemplateData().get("commonPath"), null);
List<CodegenOperation> defaultList = getOperationsList(defaultFile.getTemplateData());
Assert.assertEquals(defaultList.size(), 1);
Assert.assertEquals(defaultList.get(0).path, "/group3/op4");
Assert.assertEquals(defaultList.get(0).baseName, null);
Assert.assertEquals(defaultList.get(0).subresourceOperation, true);
WrittenTemplateBasedFile group4File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group4Api.java");
Assert.assertEquals(group4File.getTemplateData().get("baseName"), "Group4");
Assert.assertEquals(group4File.getTemplateData().get("commonPath"), "group4");
List<CodegenOperation> group4List = getOperationsList(group4File.getTemplateData());
Assert.assertEquals(group4List.size(), 2);
Assert.assertEquals(group4List.get(0).path, "/op5");
Assert.assertEquals(group4List.get(0).baseName, "group4");
Assert.assertEquals(group4List.get(0).subresourceOperation, true);
Assert.assertEquals(group4List.get(1).path, "/op6");
Assert.assertEquals(group4List.get(1).baseName, "group4");
Assert.assertEquals(group4List.get(1).subresourceOperation, true);
WrittenTemplateBasedFile group5File = TestUtils.getTemplateBasedFile(generator, output, "src/gen/java/org/openapitools/api/Group5Api.java");
Assert.assertEquals(group5File.getTemplateData().get("baseName"), "Group5");
Assert.assertEquals(group5File.getTemplateData().get("commonPath"), null);
List<CodegenOperation> group5List = getOperationsList(group5File.getTemplateData());
Assert.assertEquals(group5List.size(), 2);
Assert.assertEquals(group5List.get(0).path, "/group5/op7");
Assert.assertEquals(group5List.get(0).baseName, null);
Assert.assertEquals(group5List.get(0).subresourceOperation, true);
Assert.assertEquals(group5List.get(1).path, "/group6/op8");
Assert.assertEquals(group5List.get(1).baseName, null);
Assert.assertEquals(group5List.get(1).subresourceOperation, true);
}
@SuppressWarnings("unchecked")
private List<CodegenOperation> getOperationsList(Map<String, Object> templateData) {
Assert.assertTrue(templateData.get("operations") instanceof Map);
Map<String, Object> operations = (Map<String, Object>) templateData.get("operations");
Assert.assertTrue(operations.get("operation") instanceof List);
return (List<CodegenOperation>) operations.get("operation");
}
}

View File

@@ -6,6 +6,28 @@ info:
servers:
- url: 'http://api.company.xyz/v2'
paths:
/:
get:
tags:
- tag0
operationId: op0
responses:
'200':
description: Ok
/{id}:
get:
tags:
- tag0
operationId: opId
parameters:
- name: id
in: path
required: true
schema:
type: integer
responses:
'200':
description: Ok
/group1/op1:
get:
tags:

View File

@@ -49,7 +49,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient
@RegisterProvider(ApiExceptionMapper.class)
@Path("/")
@Path("/pet")
public interface PetApi {
/**
@@ -57,7 +57,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
public void addPet(Pet body) throws ApiException, ProcessingException;
@@ -66,7 +66,7 @@ public interface PetApi {
*
*/
@DELETE
@Path("/pet/{petId}")
@Path("/{petId}")
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException;
/**
@@ -76,7 +76,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/findByStatus")
@Path("/findByStatus")
@Produces({ "application/xml", "application/json" })
public List<Pet> findPetsByStatus(@QueryParam("status") List<String> status) throws ApiException, ProcessingException;
@@ -87,7 +87,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/findByTags")
@Path("/findByTags")
@Produces({ "application/xml", "application/json" })
public List<Pet> findPetsByTags(@QueryParam("tags") List<String> tags) throws ApiException, ProcessingException;
@@ -98,7 +98,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/{petId}")
@Path("/{petId}")
@Produces({ "application/xml", "application/json" })
public Pet getPetById(@PathParam("petId") Long petId) throws ApiException, ProcessingException;
@@ -107,7 +107,7 @@ public interface PetApi {
*
*/
@PUT
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
public void updatePet(Pet body) throws ApiException, ProcessingException;
@@ -116,7 +116,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet/{petId}")
@Path("/{petId}")
@Consumes({ "application/x-www-form-urlencoded" })
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status) throws ApiException, ProcessingException;
@@ -125,7 +125,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet/{petId}/uploadImage")
@Path("/{petId}/uploadImage")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json" })
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail) throws ApiException, ProcessingException;

View File

@@ -47,7 +47,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient
@RegisterProvider(ApiExceptionMapper.class)
@Path("/")
@Path("/store")
public interface StoreApi {
/**
@@ -57,7 +57,7 @@ public interface StoreApi {
*
*/
@DELETE
@Path("/store/order/{orderId}")
@Path("/order/{orderId}")
public void deleteOrder(@PathParam("orderId") String orderId) throws ApiException, ProcessingException;
/**
@@ -67,7 +67,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/inventory")
@Path("/inventory")
@Produces({ "application/json" })
public Map<String, Integer> getInventory() throws ApiException, ProcessingException;
@@ -78,7 +78,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/order/{orderId}")
@Path("/order/{orderId}")
@Produces({ "application/xml", "application/json" })
public Order getOrderById(@PathParam("orderId") Long orderId) throws ApiException, ProcessingException;
@@ -87,7 +87,7 @@ public interface StoreApi {
*
*/
@POST
@Path("/store/order")
@Path("/order")
@Produces({ "application/xml", "application/json" })
public Order placeOrder(Order body) throws ApiException, ProcessingException;
}

View File

@@ -47,7 +47,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
@RegisterRestClient
@RegisterProvider(ApiExceptionMapper.class)
@Path("/")
@Path("/user")
public interface UserApi {
/**
@@ -57,7 +57,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user")
public void createUser(User body) throws ApiException, ProcessingException;
/**
@@ -65,7 +65,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithArray")
@Path("/createWithArray")
public void createUsersWithArrayInput(List<User> body) throws ApiException, ProcessingException;
/**
@@ -73,7 +73,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithList")
@Path("/createWithList")
public void createUsersWithListInput(List<User> body) throws ApiException, ProcessingException;
/**
@@ -83,7 +83,7 @@ public interface UserApi {
*
*/
@DELETE
@Path("/user/{username}")
@Path("/{username}")
public void deleteUser(@PathParam("username") String username) throws ApiException, ProcessingException;
/**
@@ -91,7 +91,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/{username}")
@Path("/{username}")
@Produces({ "application/xml", "application/json" })
public User getUserByName(@PathParam("username") String username) throws ApiException, ProcessingException;
@@ -100,7 +100,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/login")
@Path("/login")
@Produces({ "application/xml", "application/json" })
public String loginUser(@QueryParam("username") String username, @QueryParam("password") String password) throws ApiException, ProcessingException;
@@ -109,7 +109,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/logout")
@Path("/logout")
public void logoutUser() throws ApiException, ProcessingException;
/**
@@ -119,7 +119,7 @@ public interface UserApi {
*
*/
@PUT
@Path("/user/{username}")
@Path("/{username}")
public void updateUser(@PathParam("username") String username, User body) throws ApiException, ProcessingException;
}

View File

@@ -25,7 +25,7 @@ import io.swagger.jaxrs.PATCH;
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/")
@Path("/pet")
@Api(value = "/", description = "")
public interface PetApi {
@@ -34,7 +34,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@ApiOperation(value = "Add a new pet to the store", tags={ })
@ApiResponses(value = {
@@ -46,7 +46,7 @@ public interface PetApi {
*
*/
@DELETE
@Path("/pet/{petId}")
@Path("/{petId}")
@ApiOperation(value = "Deletes a pet", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid pet value") })
@@ -59,7 +59,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/findByStatus")
@Path("/findByStatus")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Finds Pets by status", tags={ })
@ApiResponses(value = {
@@ -74,7 +74,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/findByTags")
@Path("/findByTags")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Finds Pets by tags", tags={ })
@ApiResponses(value = {
@@ -89,7 +89,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/{petId}")
@Path("/{petId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find pet by ID", tags={ })
@ApiResponses(value = {
@@ -103,7 +103,7 @@ public interface PetApi {
*
*/
@PUT
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@ApiOperation(value = "Update an existing pet", tags={ })
@ApiResponses(value = {
@@ -117,7 +117,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet/{petId}")
@Path("/{petId}")
@Consumes({ "application/x-www-form-urlencoded" })
@ApiOperation(value = "Updates a pet in the store with form data", tags={ })
@ApiResponses(value = {
@@ -129,7 +129,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet/{petId}/uploadImage")
@Path("/{petId}/uploadImage")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json" })
@ApiOperation(value = "uploads an image", tags={ })

View File

@@ -23,7 +23,7 @@ import io.swagger.jaxrs.PATCH;
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/")
@Path("/store")
@Api(value = "/", description = "")
public interface StoreApi {
@@ -34,7 +34,7 @@ public interface StoreApi {
*
*/
@DELETE
@Path("/store/order/{orderId}")
@Path("/order/{orderId}")
@ApiOperation(value = "Delete purchase order by ID", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@@ -48,7 +48,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/inventory")
@Path("/inventory")
@Produces({ "application/json" })
@ApiOperation(value = "Returns pet inventories by status", tags={ })
@ApiResponses(value = {
@@ -62,7 +62,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/order/{orderId}")
@Path("/order/{orderId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find purchase order by ID", tags={ })
@ApiResponses(value = {
@@ -76,7 +76,7 @@ public interface StoreApi {
*
*/
@POST
@Path("/store/order")
@Path("/order")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Place an order for a pet", tags={ })
@ApiResponses(value = {

View File

@@ -23,7 +23,7 @@ import io.swagger.jaxrs.PATCH;
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/")
@Path("/user")
@Api(value = "/", description = "")
public interface UserApi {
@@ -34,7 +34,6 @@ public interface UserApi {
*
*/
@POST
@Path("/user")
@ApiOperation(value = "Create user", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -45,7 +44,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithArray")
@Path("/createWithArray")
@ApiOperation(value = "Creates list of users with given input array", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -56,7 +55,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithList")
@Path("/createWithList")
@ApiOperation(value = "Creates list of users with given input array", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -69,7 +68,7 @@ public interface UserApi {
*
*/
@DELETE
@Path("/user/{username}")
@Path("/{username}")
@ApiOperation(value = "Delete user", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied"),
@@ -81,7 +80,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/{username}")
@Path("/{username}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get user by user name", tags={ })
@ApiResponses(value = {
@@ -95,7 +94,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/login")
@Path("/login")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Logs user into the system", tags={ })
@ApiResponses(value = {
@@ -108,7 +107,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/logout")
@Path("/logout")
@ApiOperation(value = "Logs out current logged in user session", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -121,7 +120,7 @@ public interface UserApi {
*
*/
@PUT
@Path("/user/{username}")
@Path("/{username}")
@ApiOperation(value = "Updated user", tags={ })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid user supplied"),

View File

@@ -22,7 +22,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*;
@Path("/another-fake")
@Path("/another-fake/dummy")
@io.swagger.annotations.Api(description = "the another-fake API")
@@ -31,7 +31,7 @@ public class AnotherFakeApi {
private final AnotherFakeApiService delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi();
@PATCH
@Path("/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", })

View File

@@ -27,7 +27,7 @@ import javax.validation.Valid;
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/v2")
@Path("/v2/pet")
@Api(value = "/", description = "")
public interface PetApi {
@@ -36,7 +36,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@ApiOperation(value = "Add a new pet to the store", tags={ "pet", })
@ApiResponses(value = {
@@ -48,7 +48,7 @@ public interface PetApi {
*
*/
@DELETE
@Path("/pet/{petId}")
@Path("/{petId}")
@ApiOperation(value = "Deletes a pet", tags={ "pet", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid pet value") })
@@ -61,7 +61,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/findByStatus")
@Path("/findByStatus")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Finds Pets by status", tags={ "pet", })
@ApiResponses(value = {
@@ -76,7 +76,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/findByTags")
@Path("/findByTags")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
@ApiResponses(value = {
@@ -91,7 +91,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/{petId}")
@Path("/{petId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find pet by ID", tags={ "pet", })
@ApiResponses(value = {
@@ -105,7 +105,7 @@ public interface PetApi {
*
*/
@PUT
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@ApiOperation(value = "Update an existing pet", tags={ "pet", })
@ApiResponses(value = {
@@ -119,7 +119,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet/{petId}")
@Path("/{petId}")
@Consumes({ "application/x-www-form-urlencoded" })
@ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", })
@ApiResponses(value = {
@@ -131,7 +131,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet/{petId}/uploadImage")
@Path("/{petId}/uploadImage")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json" })
@ApiOperation(value = "uploads an image", tags={ "pet" })

View File

@@ -26,7 +26,7 @@ import javax.validation.Valid;
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/v2")
@Path("/v2/store")
@Api(value = "/", description = "")
public interface StoreApi {
@@ -37,7 +37,7 @@ public interface StoreApi {
*
*/
@DELETE
@Path("/store/order/{orderId}")
@Path("/order/{orderId}")
@ApiOperation(value = "Delete purchase order by ID", tags={ "store", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@@ -51,7 +51,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/inventory")
@Path("/inventory")
@Produces({ "application/json" })
@ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
@ApiResponses(value = {
@@ -65,7 +65,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/order/{orderId}")
@Path("/order/{orderId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find purchase order by ID", tags={ "store", })
@ApiResponses(value = {
@@ -79,7 +79,7 @@ public interface StoreApi {
*
*/
@POST
@Path("/store/order")
@Path("/order")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Place an order for a pet", tags={ "store" })
@ApiResponses(value = {

View File

@@ -26,7 +26,7 @@ import javax.validation.Valid;
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/v2")
@Path("/v2/user")
@Api(value = "/", description = "")
public interface UserApi {
@@ -37,7 +37,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user")
@ApiOperation(value = "Create user", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -48,7 +48,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithArray")
@Path("/createWithArray")
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -59,7 +59,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithList")
@Path("/createWithList")
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -72,7 +72,7 @@ public interface UserApi {
*
*/
@DELETE
@Path("/user/{username}")
@Path("/{username}")
@ApiOperation(value = "Delete user", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied"),
@@ -84,7 +84,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/{username}")
@Path("/{username}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get user by user name", tags={ "user", })
@ApiResponses(value = {
@@ -98,7 +98,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/login")
@Path("/login")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Logs user into the system", tags={ "user", })
@ApiResponses(value = {
@@ -111,7 +111,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/logout")
@Path("/logout")
@ApiOperation(value = "Logs out current logged in user session", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -124,7 +124,7 @@ public interface UserApi {
*
*/
@PUT
@Path("/user/{username}")
@Path("/{username}")
@ApiOperation(value = "Updated user", tags={ "user" })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid user supplied"),

View File

@@ -27,7 +27,7 @@ import javax.validation.Valid;
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/")
@Path("/pet")
@Api(value = "/", description = "")
public interface PetApi {
@@ -36,7 +36,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@ApiOperation(value = "Add a new pet to the store", tags={ "pet", })
@ApiResponses(value = {
@@ -48,7 +48,7 @@ public interface PetApi {
*
*/
@DELETE
@Path("/pet/{petId}")
@Path("/{petId}")
@ApiOperation(value = "Deletes a pet", tags={ "pet", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid pet value") })
@@ -61,7 +61,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/findByStatus")
@Path("/findByStatus")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Finds Pets by status", tags={ "pet", })
@ApiResponses(value = {
@@ -76,7 +76,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/findByTags")
@Path("/findByTags")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
@ApiResponses(value = {
@@ -91,7 +91,7 @@ public interface PetApi {
*
*/
@GET
@Path("/pet/{petId}")
@Path("/{petId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find pet by ID", tags={ "pet", })
@ApiResponses(value = {
@@ -105,7 +105,7 @@ public interface PetApi {
*
*/
@PUT
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@ApiOperation(value = "Update an existing pet", tags={ "pet", })
@ApiResponses(value = {
@@ -119,7 +119,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet/{petId}")
@Path("/{petId}")
@Consumes({ "application/x-www-form-urlencoded" })
@ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", })
@ApiResponses(value = {
@@ -131,7 +131,7 @@ public interface PetApi {
*
*/
@POST
@Path("/pet/{petId}/uploadImage")
@Path("/{petId}/uploadImage")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json" })
@ApiOperation(value = "uploads an image", tags={ "pet" })

View File

@@ -26,7 +26,7 @@ import javax.validation.Valid;
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/")
@Path("/store")
@Api(value = "/", description = "")
public interface StoreApi {
@@ -37,7 +37,7 @@ public interface StoreApi {
*
*/
@DELETE
@Path("/store/order/{orderId}")
@Path("/order/{orderId}")
@ApiOperation(value = "Delete purchase order by ID", tags={ "store", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@@ -51,7 +51,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/inventory")
@Path("/inventory")
@Produces({ "application/json" })
@ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
@ApiResponses(value = {
@@ -65,7 +65,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/order/{orderId}")
@Path("/order/{orderId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find purchase order by ID", tags={ "store", })
@ApiResponses(value = {
@@ -79,7 +79,7 @@ public interface StoreApi {
*
*/
@POST
@Path("/store/order")
@Path("/order")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Place an order for a pet", tags={ "store" })
@ApiResponses(value = {

View File

@@ -26,7 +26,7 @@ import javax.validation.Valid;
* <p>This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
*/
@Path("/")
@Path("/user")
@Api(value = "/", description = "")
public interface UserApi {
@@ -37,7 +37,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user")
@ApiOperation(value = "Create user", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -48,7 +48,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithArray")
@Path("/createWithArray")
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -59,7 +59,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithList")
@Path("/createWithList")
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -72,7 +72,7 @@ public interface UserApi {
*
*/
@DELETE
@Path("/user/{username}")
@Path("/{username}")
@ApiOperation(value = "Delete user", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied"),
@@ -84,7 +84,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/{username}")
@Path("/{username}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get user by user name", tags={ "user", })
@ApiResponses(value = {
@@ -98,7 +98,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/login")
@Path("/login")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Logs user into the system", tags={ "user", })
@ApiResponses(value = {
@@ -111,7 +111,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/logout")
@Path("/logout")
@ApiOperation(value = "Logs out current logged in user session", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -124,7 +124,7 @@ public interface UserApi {
*
*/
@PUT
@Path("/user/{username}")
@Path("/{username}")
@ApiOperation(value = "Updated user", tags={ "user" })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid user supplied"),

View File

@@ -27,7 +27,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/v2")
@Path("/v2/another-fake/dummy")
@Api(value = "/", description = "")
public interface AnotherFakeApi {
@@ -38,7 +38,7 @@ public interface AnotherFakeApi {
*
*/
@PATCH
@Path("/another-fake/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test special tags", tags={ "$another-fake?" })

View File

@@ -35,7 +35,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/v2")
@Path("/v2/fake")
@Api(value = "/", description = "")
public interface FakeApi {
@@ -46,7 +46,7 @@ public interface FakeApi {
*
*/
@POST
@Path("/fake/create_xml_item")
@Path("/create_xml_item")
@Consumes({ "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" })
@ApiOperation(value = "creates an XmlItem", tags={ "fake", })
@ApiResponses(value = {
@@ -54,7 +54,7 @@ public interface FakeApi {
public void createXmlItem(@Valid XmlItem xmlItem);
@POST
@Path("/fake/outer/boolean")
@Path("/outer/boolean")
@Consumes({ "text/plain" })
@Produces({ "*/*" })
@ApiOperation(value = "", tags={ "fake", })
@@ -63,7 +63,7 @@ public interface FakeApi {
public Boolean fakeOuterBooleanSerialize(@Valid Boolean body);
@POST
@Path("/fake/outer/composite")
@Path("/outer/composite")
@Consumes({ "application/json" })
@Produces({ "*/*" })
@ApiOperation(value = "", tags={ "fake", })
@@ -72,7 +72,7 @@ public interface FakeApi {
public OuterComposite fakeOuterCompositeSerialize(@Valid OuterComposite body);
@POST
@Path("/fake/outer/number")
@Path("/outer/number")
@Consumes({ "text/plain" })
@Produces({ "*/*" })
@ApiOperation(value = "", tags={ "fake", })
@@ -81,7 +81,7 @@ public interface FakeApi {
public BigDecimal fakeOuterNumberSerialize(@Valid BigDecimal body);
@POST
@Path("/fake/outer/string")
@Path("/outer/string")
@Consumes({ "text/plain" })
@Produces({ "*/*" })
@ApiOperation(value = "", tags={ "fake", })
@@ -90,7 +90,7 @@ public interface FakeApi {
public String fakeOuterStringSerialize(@Valid String body);
@PUT
@Path("/fake/body-with-file-schema")
@Path("/body-with-file-schema")
@Consumes({ "application/json" })
@ApiOperation(value = "", tags={ "fake", })
@ApiResponses(value = {
@@ -98,7 +98,7 @@ public interface FakeApi {
public void testBodyWithFileSchema(@Valid FileSchemaTestClass body);
@PUT
@Path("/fake/body-with-query-params")
@Path("/body-with-query-params")
@Consumes({ "application/json" })
@ApiOperation(value = "", tags={ "fake", })
@ApiResponses(value = {
@@ -112,7 +112,7 @@ public interface FakeApi {
*
*/
@PATCH
@Path("/fake")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test \"client\" model", tags={ "fake", })
@@ -127,7 +127,7 @@ public interface FakeApi {
*
*/
@POST
@Path("/fake")
@Consumes({ "application/x-www-form-urlencoded" })
@ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", tags={ "fake", })
@ApiResponses(value = {
@@ -142,7 +142,7 @@ public interface FakeApi {
*
*/
@GET
@Path("/fake")
@Consumes({ "application/x-www-form-urlencoded" })
@ApiOperation(value = "To test enum parameters", tags={ "fake", })
@ApiResponses(value = {
@@ -157,7 +157,7 @@ public interface FakeApi {
*
*/
@DELETE
@Path("/fake")
@ApiOperation(value = "Fake endpoint to test group parameters (optional)", tags={ "fake", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Someting wrong") })
@@ -168,7 +168,7 @@ public interface FakeApi {
*
*/
@POST
@Path("/fake/inline-additionalProperties")
@Path("/inline-additionalProperties")
@Consumes({ "application/json" })
@ApiOperation(value = "test inline additionalProperties", tags={ "fake", })
@ApiResponses(value = {
@@ -180,7 +180,7 @@ public interface FakeApi {
*
*/
@GET
@Path("/fake/jsonFormData")
@Path("/jsonFormData")
@Consumes({ "application/x-www-form-urlencoded" })
@ApiOperation(value = "test json serialization of form data", tags={ "fake", })
@ApiResponses(value = {
@@ -188,7 +188,7 @@ public interface FakeApi {
public void testJsonFormData(@Multipart(value = "param") String param, @Multipart(value = "param2") String param2);
@PUT
@Path("/fake/test-query-paramters")
@Path("/test-query-paramters")
@ApiOperation(value = "", tags={ "fake" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success") })

View File

@@ -27,7 +27,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/v2")
@Path("/v2/fake_classname_test")
@Api(value = "/", description = "")
public interface FakeClassnameTags123Api {
@@ -38,7 +38,7 @@ public interface FakeClassnameTags123Api {
*
*/
@PATCH
@Path("/fake_classname_test")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test class name in snake case", tags={ "fake_classname_tags 123#$%^" })

View File

@@ -27,7 +27,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/v2")
@Path("/v2/store")
@Api(value = "/", description = "")
public interface StoreApi {
@@ -38,7 +38,7 @@ public interface StoreApi {
*
*/
@DELETE
@Path("/store/order/{order_id}")
@Path("/order/{order_id}")
@ApiOperation(value = "Delete purchase order by ID", tags={ "store", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@@ -52,7 +52,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/inventory")
@Path("/inventory")
@Produces({ "application/json" })
@ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
@ApiResponses(value = {
@@ -66,7 +66,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/order/{order_id}")
@Path("/order/{order_id}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find purchase order by ID", tags={ "store", })
@ApiResponses(value = {
@@ -80,7 +80,7 @@ public interface StoreApi {
*
*/
@POST
@Path("/store/order")
@Path("/order")
@Consumes({ "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Place an order for a pet", tags={ "store" })

View File

@@ -27,7 +27,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/v2")
@Path("/v2/user")
@Api(value = "/", description = "")
public interface UserApi {
@@ -38,7 +38,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user")
@Consumes({ "application/json" })
@ApiOperation(value = "Create user", tags={ "user", })
@ApiResponses(value = {
@@ -50,7 +50,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithArray")
@Path("/createWithArray")
@Consumes({ "application/json" })
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
@ApiResponses(value = {
@@ -62,7 +62,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithList")
@Path("/createWithList")
@Consumes({ "application/json" })
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
@ApiResponses(value = {
@@ -76,7 +76,7 @@ public interface UserApi {
*
*/
@DELETE
@Path("/user/{username}")
@Path("/{username}")
@ApiOperation(value = "Delete user", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied"),
@@ -88,7 +88,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/{username}")
@Path("/{username}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get user by user name", tags={ "user", })
@ApiResponses(value = {
@@ -102,7 +102,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/login")
@Path("/login")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Logs user into the system", tags={ "user", })
@ApiResponses(value = {
@@ -115,7 +115,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/logout")
@Path("/logout")
@ApiOperation(value = "Logs out current logged in user session", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -128,7 +128,7 @@ public interface UserApi {
*
*/
@PUT
@Path("/user/{username}")
@Path("/{username}")
@Consumes({ "application/json" })
@ApiOperation(value = "Updated user", tags={ "user" })
@ApiResponses(value = {

View File

@@ -8,6 +8,7 @@ import java.util.Map;
import org.openapitools.model.ModelApiResponse;
import org.openapitools.model.Pet;
import java.util.Set;
import org.openapitools.model.Tag;
import java.io.InputStream;
import java.io.OutputStream;

View File

@@ -3,289 +3,289 @@
"AnotherFakeApi" : {
"call123testSpecialTags" : {
"body" : {
"client" : "jcG45"
"client" : "H49xB46c"
},
"response" : {
"client" : "X370r"
"client" : "zK162Z97Sp"
}
}
},
"FakeApi" : {
"createXmlItem" : {
"xmlItem" : {
"attributeString" : "Eb2u1U6",
"attributeInteger" : 147520098,
"attributeString" : "VdV2H",
"attributeInteger" : 1985822263,
"attributeBoolean" : true,
"wrappedArray" : [ 386706627 ],
"nameString" : "dh860",
"nameInteger" : 1987576209,
"nameBoolean" : true,
"nameArray" : [ -659992604 ],
"nameWrappedArray" : [ -2119625820 ],
"prefixString" : "i3F56",
"prefixInteger" : 1911338960,
"wrappedArray" : [ -653110137 ],
"nameString" : "xXCcI",
"nameInteger" : 1435348393,
"nameBoolean" : false,
"nameArray" : [ -1465299265 ],
"nameWrappedArray" : [ -1132116825 ],
"prefixString" : "nshJlelLdkT",
"prefixInteger" : -323382715,
"prefixBoolean" : true,
"prefixArray" : [ 1722883742 ],
"prefixWrappedArray" : [ 1078700186 ],
"namespaceString" : "iS4Ds71",
"namespaceInteger" : 487489352,
"namespaceBoolean" : false,
"namespaceArray" : [ 1680914373 ],
"namespaceWrappedArray" : [ -1665967400 ],
"prefixNsString" : "Dw4j1",
"prefixNsInteger" : 1066222353,
"prefixNsBoolean" : true,
"prefixNsArray" : [ -323311251 ],
"prefixNsWrappedArray" : [ -97625425 ]
"prefixArray" : [ -1698013553 ],
"prefixWrappedArray" : [ 2102585931 ],
"namespaceString" : "f9B44",
"namespaceInteger" : 735368440,
"namespaceBoolean" : true,
"namespaceArray" : [ -1500170356 ],
"namespaceWrappedArray" : [ 1934138047 ],
"prefixNsString" : "qShbM9wXexPJx9S",
"prefixNsInteger" : -1395825230,
"prefixNsBoolean" : false,
"prefixNsArray" : [ 738380003 ],
"prefixNsWrappedArray" : [ -1696217090 ]
}
},
"fakeOuterBooleanSerialize" : {
"body" : false,
"response" : true
"response" : false
},
"fakeOuterCompositeSerialize" : {
"body" : {
"myString" : "X2D3gz",
"myString" : "fU2m0ch",
"myBoolean" : false
},
"response" : {
"myString" : "CoPXZxn",
"myBoolean" : false
"myString" : "XZj3D1c",
"myBoolean" : true
}
},
"fakeOuterStringSerialize" : {
"body" : "n7l4XMo",
"response" : "Qr4co9"
"body" : "h594z",
"response" : "R6iEmf"
},
"testBodyWithQueryParams" : {
"query" : "UV9bdZ2",
"query" : "BycK2e5ck",
"body" : {
"id" : 4000262934535942144,
"username" : "XLJ4b9",
"firstName" : "hSDrOu",
"lastName" : "L11r0",
"email" : "Kjq6Mi61",
"password" : "hF294",
"phone" : "JJVU9",
"userStatus" : -1075062101
"id" : 8061566482760544256,
"username" : "OBn2r37",
"firstName" : "gynQS5Q",
"lastName" : "ngp3l",
"email" : "rvo582gu5",
"password" : "u3pb34G",
"phone" : "Yq3UltIC",
"userStatus" : -140157280
}
},
"testClientModel" : {
"body" : {
"client" : "A4h15W9u21"
"client" : "kU591"
},
"response" : {
"client" : "Og4a5"
"client" : "ZHJlEQ"
}
},
"testEndpointParameters" : {
"_double" : 91.68589154730603,
"patternWithoutDelimiter" : "^K᫢",
"_byte" : "VA==",
"integer" : 79,
"int32" : 67,
"int64" : 2105658579350773760,
"_float" : -8.599085E37,
"string" : "/o/i",
"binary" : "6F2DE9EC31",
"_double" : 77.14654636614235246584049686929773770316387526690959930419921875,
"patternWithoutDelimiter" : "^V莙샊䲎ꖣ",
"_byte" : "/w==",
"integer" : 70,
"int32" : 159,
"int64" : -5610633869890439168,
"_float" : -8.269394E37,
"string" : "/f/i",
"binary" : "3FDF5E5AAC31E6CED35A8273D5E3",
"dateTime" : "1970-01-01T00:00:00.000Z",
"password" : "ZO4zar14Va3jI1l",
"paramCallback" : "wPk77B7e5xF"
"password" : "QM3mg8dETB9V",
"paramCallback" : "mYVLDL7p1aQ1hEXp"
},
"testEnumParameters" : {
"enumHeaderStringArray" : [ ">" ],
"enumHeaderString" : "_abc",
"enumQueryStringArray" : [ ">" ],
"enumQueryString" : "_abc",
"enumQueryInteger" : -2,
"enumQueryString" : "-efg",
"enumQueryInteger" : 1,
"enumQueryDouble" : 1.1,
"enumFormStringArray" : [ ">" ],
"enumFormString" : "(xyz)"
},
"testGroupParameters" : {
"requiredStringGroup" : 1207842123,
"requiredBooleanGroup" : false,
"requiredInt64Group" : 5596825593739094016,
"stringGroup" : 159421280,
"booleanGroup" : false,
"int64Group" : -371090919006941184
"requiredStringGroup" : 1721428609,
"requiredBooleanGroup" : true,
"requiredInt64Group" : 6251741858524090368,
"stringGroup" : -1910958390,
"booleanGroup" : true,
"int64Group" : -28864628130875392
},
"testInlineAdditionalProperties" : {
"param" : {
"wudzp01O" : "mE6kw6wXNh"
"NUMQ6" : "bnoWB8"
}
},
"testJsonFormData" : {
"param" : "Gfe588Q6",
"param2" : "QBx28IQ"
"param" : "Pt801ksy",
"param2" : "qp87bc3g3G"
},
"testQueryParameterCollectionFormat" : {
"pipe" : [ "tCOmW" ],
"ioutil" : [ "iy6kr" ],
"http" : [ "yoZlS" ],
"url" : [ "zBeSEe" ],
"context" : [ "SP17wCv8k2" ]
"pipe" : [ "XZSjj" ],
"ioutil" : [ "PQ9ae6" ],
"http" : [ "j1HS55g" ],
"url" : [ "WIg2d" ],
"context" : [ "h77kAFh84Xr" ]
}
},
"FakeClassnameTags123Api" : {
"testClassname" : {
"body" : {
"client" : "S1aOxISzBs"
"client" : "UVYPp8"
},
"response" : {
"client" : "TbGI9"
"client" : "YDo68"
}
}
},
"PetApi" : {
"addPet" : {
"body" : {
"id" : -2653750499344775168,
"id" : 8891319799441512448,
"category" : {
"id" : -2928510589379909632,
"name" : "TO3p80Ky2x"
"id" : -7863708794475802624,
"name" : "vPxzrnzEz"
},
"name" : "Qm6N3dP3",
"photoUrls" : [ "p53C0" ],
"name" : "u7u1d2",
"photoUrls" : [ "ZO5v69" ],
"tags" : [ {
"id" : -2307271697209421824,
"name" : "Al1TO"
"id" : 7101244779399524352,
"name" : "mvNiOIS"
} ],
"status" : "available"
"status" : "sold"
}
},
"deletePet" : {
"petId" : -5729095497896138752,
"apiKey" : "emX89u"
"petId" : 5479846688156180480,
"apiKey" : "wM95de3"
},
"findPetsByStatus" : {
"status" : [ "pending" ],
"status" : [ "sold" ],
"response" : [ {
"id" : 6691518087482916864,
"id" : -6386097881258229760,
"category" : {
"id" : 6964466714983940096,
"name" : "koE81eyo"
"id" : -1623288558445953024,
"name" : "C80Sg"
},
"name" : "y4m4PhCE0i",
"photoUrls" : [ "IqJJmx" ],
"name" : "DHW5c",
"photoUrls" : [ "vNRx7Rdk" ],
"tags" : [ {
"id" : 8012801031574112256,
"name" : "YrJn1yGs0z"
"id" : 2752729086447992832,
"name" : "Pixm2M"
} ],
"status" : "sold"
} ]
},
"findPetsByTags" : {
"tags" : [ "j3nfE" ],
"tags" : [ "oaBIAn33l" ],
"response" : [ {
"id" : -9197231497833564160,
"id" : 7485821031783129088,
"category" : {
"id" : -5988701284856627200,
"name" : "BauS54"
"id" : -734764145756803072,
"name" : "w691Tma7t"
},
"name" : "M8kI7",
"photoUrls" : [ "Qa714D5" ],
"name" : "s776V7LH",
"photoUrls" : [ "e7ak1" ],
"tags" : [ {
"id" : 4440883532640208896,
"name" : "Nkk3DY5"
"id" : 6586288673970786304,
"name" : "rmN4W"
} ],
"status" : "available"
"status" : "pending"
} ]
},
"getPetById" : {
"petId" : -6219590703298789376,
"petId" : -6141172981557239808,
"response" : {
"id" : 5993566911200026624,
"id" : 2677865709357674496,
"category" : {
"id" : -2117647852255066112,
"name" : "eubaw7"
"id" : 1810496265643943936,
"name" : "PX8GS"
},
"name" : "ET50LhRvnd",
"photoUrls" : [ "O99qs1" ],
"name" : "d2Is9E69p",
"photoUrls" : [ "X8h1b" ],
"tags" : [ {
"id" : 2761338271092506624,
"name" : "jfPAX"
"id" : 8787473320999102464,
"name" : "bIj65"
} ],
"status" : "sold"
"status" : "available"
}
},
"updatePet" : {
"body" : {
"id" : -1456079319067897856,
"id" : 881108123786188800,
"category" : {
"id" : 5419421286905976832,
"name" : "X0q8S"
"id" : -1905683116272592896,
"name" : "AZ9PQ"
},
"name" : "he3p7",
"photoUrls" : [ "xlE9clF" ],
"name" : "jgCX3",
"photoUrls" : [ "A8j15" ],
"tags" : [ {
"id" : 2103387396570261504,
"name" : "gcerr1IP"
"id" : -4584517902421798912,
"name" : "Qtxc19"
} ],
"status" : "sold"
}
},
"updatePetWithForm" : {
"petId" : -7656356217721585664,
"name" : "A2bOl",
"status" : "PH9f8356iEBn"
"petId" : 2003658532906545152,
"name" : "Y4t62b",
"status" : "iqtZ4c"
},
"uploadFile" : {
"petId" : 6952534196252968960,
"additionalMetadata" : "G4m059l",
"file" : "9C9DA0EAF5D2AF1F6864A6",
"petId" : 6368392635725230080,
"additionalMetadata" : "acV45p1lrvF",
"file" : "B9DDB395CDC6BF",
"response" : {
"code" : -1435192892,
"type" : "gw24XnMH7",
"message" : "zzB72Z"
"code" : -948139149,
"type" : "dm3vxsNtg94DA",
"message" : "I9pPJHHy"
}
},
"uploadFileWithRequiredFile" : {
"petId" : 512037124265578496,
"requiredFile" : "D8B705A8FB3F407B2F8E",
"additionalMetadata" : "PY6nDn9",
"petId" : -3179009564025681920,
"requiredFile" : "A3BD3D2A9B",
"additionalMetadata" : "oH3AJp",
"response" : {
"code" : -1333813556,
"type" : "BrrZM",
"message" : "tFr79X"
"code" : 1609753546,
"type" : "KB01Ywc",
"message" : "k5Tdo6KI8R"
}
}
},
"StoreApi" : {
"deleteOrder" : {
"orderId" : "HsU41"
"orderId" : "Njre4sim1K"
},
"getInventory" : {
"response" : {
"ziD75" : 294464959
"DmV7HIW" : -957358378
}
},
"getOrderById" : {
"orderId" : 4,
"orderId" : 5,
"response" : {
"id" : 3165203730926016512,
"petId" : -3012698886004281344,
"quantity" : -60286595,
"id" : 9083935428378738688,
"petId" : -415650740527329280,
"quantity" : 1933320870,
"shipDate" : "1970-01-01T00:00:00.000Z",
"status" : "delivered",
"status" : "approved",
"complete" : true
}
},
"placeOrder" : {
"body" : {
"id" : 3338410355229698048,
"petId" : -4961432594453067776,
"quantity" : 1842478858,
"shipDate" : "1970-01-01T00:00:00.000Z",
"status" : "approved",
"complete" : true
},
"response" : {
"id" : -1005036856530139136,
"petId" : -4453012365528330240,
"quantity" : -2040456846,
"id" : 7905609264485345280,
"petId" : 8669731635642066944,
"quantity" : 1770652468,
"shipDate" : "1970-01-01T00:00:00.000Z",
"status" : "placed",
"complete" : false
},
"response" : {
"id" : 5726396383392079872,
"petId" : -1877008552549234688,
"quantity" : -1249341230,
"shipDate" : "1970-01-01T00:00:00.000Z",
"status" : "approved",
"complete" : true
}
}
@@ -293,72 +293,72 @@
"UserApi" : {
"createUser" : {
"body" : {
"id" : -8606986596057917440,
"username" : "tL0ec",
"firstName" : "Y0loLMb",
"lastName" : "zT5201",
"email" : "u81A86VgXTIE",
"password" : "HP0SR",
"phone" : "w1WQ810b",
"userStatus" : -1376509587
"id" : -2522006695369119744,
"username" : "e3n5Jp",
"firstName" : "xf4m9",
"lastName" : "LRCWB",
"email" : "PaM4rJTpAEl",
"password" : "C92h4xy",
"phone" : "yGI3dfw",
"userStatus" : -497475079
}
},
"createUsersWithArrayInput" : {
"body" : [ {
"id" : -1966638810474690560,
"username" : "VTWlOg",
"firstName" : "jpFb3",
"lastName" : "t25dWgTQ",
"email" : "aqf3E",
"password" : "Avn2BM8xK",
"phone" : "E4JIl",
"userStatus" : -1484810590
"id" : -6033644635618054144,
"username" : "qqPJ1w",
"firstName" : "yA79k9",
"lastName" : "gV5zF2oS9rP",
"email" : "kc67Kq7",
"password" : "xp5DnN",
"phone" : "H8326ObyFXEuu",
"userStatus" : 368047528
} ]
},
"createUsersWithListInput" : {
"body" : [ {
"id" : 8585018130972989440,
"username" : "P9vsF",
"firstName" : "J7CAoNQj",
"lastName" : "WD1h9",
"email" : "jKzvi6",
"password" : "cHska",
"phone" : "Dldds",
"userStatus" : 1097971227
"id" : -9072679361396154368,
"username" : "nw5KS",
"firstName" : "FYnnFJV",
"lastName" : "LE531n3fjKy2f7",
"email" : "TZ13kH",
"password" : "j0k6176",
"phone" : "Z40in9ROO",
"userStatus" : 1717817265
} ]
},
"deleteUser" : {
"username" : "iT0Ys"
"username" : "A8pQjrpsR9bF"
},
"getUserByName" : {
"username" : "QpJg1",
"username" : "R81k71I",
"response" : {
"id" : 14156895191257088,
"username" : "sor05q0v8f",
"firstName" : "r4D82",
"lastName" : "WHMFN933cK1",
"email" : "BaLHhmu008",
"password" : "qk44V",
"phone" : "tUzVV",
"userStatus" : -373662379
"id" : 2686762499505981440,
"username" : "PK79lYX",
"firstName" : "w82wgRf",
"lastName" : "yoknq",
"email" : "K3jR9N4iCObs",
"password" : "QcsOiD",
"phone" : "lT1uO",
"userStatus" : -278466946
}
},
"loginUser" : {
"username" : "Yr620",
"password" : "B196F",
"response" : "S5I74r9"
"username" : "H5X8E",
"password" : "Om3uRO",
"response" : "VbVld"
},
"updateUser" : {
"username" : "zEoD6E0S",
"username" : "V9H3F",
"body" : {
"id" : -6743258527755587584,
"username" : "Bd3OVY",
"firstName" : "CW6Sc",
"lastName" : "TV8U0",
"email" : "yy7aew",
"password" : "ywud8QR4",
"phone" : "dy886aDKe",
"userStatus" : 1641465856
"id" : 7636501311282368512,
"username" : "pM1hj7n",
"firstName" : "fc71u71",
"lastName" : "KSaUy8",
"email" : "d7Y1LET",
"password" : "MgC4iU8",
"phone" : "AA2l9pS",
"userStatus" : -222193844
}
}
}

View File

@@ -25,7 +25,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/")
@Path("/another-fake/dummy")
@Api(value = "/", description = "")
public interface AnotherFakeApi {
@@ -36,7 +36,7 @@ public interface AnotherFakeApi {
*
*/
@PATCH
@Path("/another-fake/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test special tags", tags={ "$another-fake?" })

View File

@@ -34,7 +34,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/")
@Path("/fake")
@Api(value = "/", description = "")
public interface FakeApi {
@@ -45,7 +45,7 @@ public interface FakeApi {
*
*/
@POST
@Path("/fake/create_xml_item")
@Path("/create_xml_item")
@Consumes({ "application/xml", "application/xml; charset=utf-8", "application/xml; charset=utf-16", "text/xml", "text/xml; charset=utf-8", "text/xml; charset=utf-16" })
@ApiOperation(value = "creates an XmlItem", tags={ "fake", })
@ApiResponses(value = {
@@ -53,7 +53,7 @@ public interface FakeApi {
public void createXmlItem(@Valid XmlItem xmlItem);
@POST
@Path("/fake/outer/boolean")
@Path("/outer/boolean")
@Produces({ "*/*" })
@ApiOperation(value = "", tags={ "fake", })
@ApiResponses(value = {
@@ -61,7 +61,7 @@ public interface FakeApi {
public Boolean fakeOuterBooleanSerialize(@Valid Boolean body);
@POST
@Path("/fake/outer/composite")
@Path("/outer/composite")
@Produces({ "*/*" })
@ApiOperation(value = "", tags={ "fake", })
@ApiResponses(value = {
@@ -69,7 +69,7 @@ public interface FakeApi {
public OuterComposite fakeOuterCompositeSerialize(@Valid OuterComposite body);
@POST
@Path("/fake/outer/number")
@Path("/outer/number")
@Produces({ "*/*" })
@ApiOperation(value = "", tags={ "fake", })
@ApiResponses(value = {
@@ -77,7 +77,7 @@ public interface FakeApi {
public BigDecimal fakeOuterNumberSerialize(@Valid BigDecimal body);
@POST
@Path("/fake/outer/string")
@Path("/outer/string")
@Produces({ "*/*" })
@ApiOperation(value = "", tags={ "fake", })
@ApiResponses(value = {
@@ -85,7 +85,7 @@ public interface FakeApi {
public String fakeOuterStringSerialize(@Valid String body);
@PUT
@Path("/fake/body-with-file-schema")
@Path("/body-with-file-schema")
@Consumes({ "application/json" })
@ApiOperation(value = "", tags={ "fake", })
@ApiResponses(value = {
@@ -93,7 +93,7 @@ public interface FakeApi {
public void testBodyWithFileSchema(@Valid FileSchemaTestClass body);
@PUT
@Path("/fake/body-with-query-params")
@Path("/body-with-query-params")
@Consumes({ "application/json" })
@ApiOperation(value = "", tags={ "fake", })
@ApiResponses(value = {
@@ -107,7 +107,7 @@ public interface FakeApi {
*
*/
@PATCH
@Path("/fake")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test \"client\" model", tags={ "fake", })
@@ -122,7 +122,7 @@ public interface FakeApi {
*
*/
@POST
@Path("/fake")
@Consumes({ "application/x-www-form-urlencoded" })
@ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트", tags={ "fake", })
@ApiResponses(value = {
@@ -137,7 +137,7 @@ public interface FakeApi {
*
*/
@GET
@Path("/fake")
@Consumes({ "application/x-www-form-urlencoded" })
@ApiOperation(value = "To test enum parameters", tags={ "fake", })
@ApiResponses(value = {
@@ -152,7 +152,7 @@ public interface FakeApi {
*
*/
@DELETE
@Path("/fake")
@ApiOperation(value = "Fake endpoint to test group parameters (optional)", tags={ "fake", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Someting wrong") })
@@ -163,7 +163,7 @@ public interface FakeApi {
*
*/
@POST
@Path("/fake/inline-additionalProperties")
@Path("/inline-additionalProperties")
@Consumes({ "application/json" })
@ApiOperation(value = "test inline additionalProperties", tags={ "fake", })
@ApiResponses(value = {
@@ -175,7 +175,7 @@ public interface FakeApi {
*
*/
@GET
@Path("/fake/jsonFormData")
@Path("/jsonFormData")
@Consumes({ "application/x-www-form-urlencoded" })
@ApiOperation(value = "test json serialization of form data", tags={ "fake", })
@ApiResponses(value = {
@@ -183,7 +183,7 @@ public interface FakeApi {
public void testJsonFormData(@Multipart(value = "param") String param, @Multipart(value = "param2") String param2);
@PUT
@Path("/fake/test-query-paramters")
@Path("/test-query-paramters")
@ApiOperation(value = "", tags={ "fake" })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success") })

View File

@@ -25,7 +25,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/")
@Path("/fake_classname_test")
@Api(value = "/", description = "")
public interface FakeClassnameTags123Api {
@@ -36,7 +36,7 @@ public interface FakeClassnameTags123Api {
*
*/
@PATCH
@Path("/fake_classname_test")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test class name in snake case", tags={ "fake_classname_tags 123#$%^" })

View File

@@ -28,7 +28,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/")
@Path("")
@Api(value = "/", description = "")
public interface PetApi {

View File

@@ -26,7 +26,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/")
@Path("/store")
@Api(value = "/", description = "")
public interface StoreApi {
@@ -37,7 +37,7 @@ public interface StoreApi {
*
*/
@DELETE
@Path("/store/order/{order_id}")
@Path("/order/{order_id}")
@ApiOperation(value = "Delete purchase order by ID", tags={ "store", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@@ -51,7 +51,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/inventory")
@Path("/inventory")
@Produces({ "application/json" })
@ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
@ApiResponses(value = {
@@ -65,7 +65,7 @@ public interface StoreApi {
*
*/
@GET
@Path("/store/order/{order_id}")
@Path("/order/{order_id}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find purchase order by ID", tags={ "store", })
@ApiResponses(value = {
@@ -79,7 +79,7 @@ public interface StoreApi {
*
*/
@POST
@Path("/store/order")
@Path("/order")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Place an order for a pet", tags={ "store" })
@ApiResponses(value = {

View File

@@ -26,7 +26,7 @@ import javax.validation.Valid;
* <p>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
*/
@Path("/")
@Path("/user")
@Api(value = "/", description = "")
public interface UserApi {
@@ -37,7 +37,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user")
@ApiOperation(value = "Create user", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -48,7 +48,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithArray")
@Path("/createWithArray")
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -59,7 +59,7 @@ public interface UserApi {
*
*/
@POST
@Path("/user/createWithList")
@Path("/createWithList")
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -72,7 +72,7 @@ public interface UserApi {
*
*/
@DELETE
@Path("/user/{username}")
@Path("/{username}")
@ApiOperation(value = "Delete user", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied"),
@@ -84,7 +84,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/{username}")
@Path("/{username}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get user by user name", tags={ "user", })
@ApiResponses(value = {
@@ -98,7 +98,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/login")
@Path("/login")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Logs user into the system", tags={ "user", })
@ApiResponses(value = {
@@ -111,7 +111,7 @@ public interface UserApi {
*
*/
@GET
@Path("/user/logout")
@Path("/logout")
@ApiOperation(value = "Logs out current logged in user session", tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@@ -124,7 +124,7 @@ public interface UserApi {
*
*/
@PUT
@Path("/user/{username}")
@Path("/{username}")
@ApiOperation(value = "Updated user", tags={ "user" })
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid user supplied"),

View File

@@ -26,7 +26,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/another-fake")
@Path("/another-fake/dummy")
@io.swagger.annotations.Api(description = "the another-fake API")
@@ -56,7 +56,7 @@ public class AnotherFakeApi {
}
@PATCH
@Path("/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", })

View File

@@ -26,7 +26,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/another-fake")
@Path("/another-fake/dummy")
@io.swagger.annotations.Api(description = "the another-fake API")
@@ -56,7 +56,7 @@ public class AnotherFakeApi {
}
@PATCH
@Path("/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", })

View File

@@ -13,12 +13,11 @@ import java.util.List;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/another-fake")
@Path("/another-fake/dummy")
@Api(description = "the another-fake API")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public interface AnotherFakeApi {
@PATCH
@Path("/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", tags={ "$another-fake?" })

View File

@@ -13,12 +13,11 @@ import java.util.List;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/another-fake")
@Path("/another-fake/dummy")
@Api(description = "the another-fake API")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public interface AnotherFakeApi {
@PATCH
@Path("/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", tags={ "$another-fake?" })

View File

@@ -13,12 +13,11 @@ import java.util.List;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/another-fake")
@Path("/another-fake/dummy")
@Api(description = "the another-fake API")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen")public class AnotherFakeApi {
@PATCH
@Path("/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?" })

View File

@@ -25,7 +25,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/AnotherFake")
@Path("/another-fake/dummy")
@io.swagger.annotations.Api(description = "the AnotherFake API")
@@ -34,7 +34,7 @@ public class AnotherFakeApi {
private final AnotherFakeApiService delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi();
@PATCH
@Path("/another-fake/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?" })

View File

@@ -33,7 +33,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/Fake")
@Path("/fake")
@io.swagger.annotations.Api(description = "the Fake API")

View File

@@ -25,7 +25,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/FakeClassnameTags123")
@Path("/fake_classname_test")
@io.swagger.annotations.Api(description = "the FakeClassnameTags123 API")
@@ -34,7 +34,7 @@ public class FakeClassnameTags123Api {
private final FakeClassnameTags123ApiService delegate = FakeClassnameTags123ApiServiceFactory.getFakeClassnameTags123Api();
@PATCH
@Path("/fake_classname_test")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", response = Client.class, authorizations = {

View File

@@ -28,7 +28,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/Pet")
@Path("")
@io.swagger.annotations.Api(description = "the Pet API")
@@ -37,7 +37,7 @@ public class PetApi {
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
@POST
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
@@ -131,7 +131,7 @@ public class PetApi {
return delegate.getPetById(petId,securityContext);
}
@PUT
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = {

View File

@@ -26,7 +26,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/Store")
@Path("/store")
@io.swagger.annotations.Api(description = "the Store API")

View File

@@ -26,7 +26,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/User")
@Path("/user")
@io.swagger.annotations.Api(description = "the User API")

View File

@@ -25,7 +25,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/another-fake")
@Path("/another-fake/dummy")
@io.swagger.annotations.Api(description = "the another-fake API")
@@ -34,7 +34,7 @@ public class AnotherFakeApi {
private final AnotherFakeApiService delegate = AnotherFakeApiServiceFactory.getAnotherFakeApi();
@PATCH
@Path("/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?" })

View File

@@ -26,7 +26,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("")
@Path("/another-fake/dummy")
@io.swagger.annotations.Api(description = "the AnotherFake API")
@@ -56,7 +56,7 @@ public class AnotherFakeApi {
}
@PATCH
@Path("/another-fake/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", })

View File

@@ -26,7 +26,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("")
@Path("/fake_classname_test")
@io.swagger.annotations.Api(description = "the FakeClassnameTags123 API")
@@ -56,7 +56,7 @@ public class FakeClassnameTags123Api {
}
@PATCH
@Path("/fake_classname_test")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", response = Client.class, authorizations = {

View File

@@ -59,7 +59,7 @@ public class PetApi {
}
@POST
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
@@ -154,7 +154,7 @@ public class PetApi {
return delegate.getPetById(petId, securityContext);
}
@PUT
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = {

View File

@@ -26,7 +26,7 @@ import javax.ws.rs.*;
import javax.validation.constraints.*;
import javax.validation.Valid;
@Path("/another-fake")
@Path("/another-fake/dummy")
@io.swagger.annotations.Api(description = "the another-fake API")
@@ -56,7 +56,7 @@ public class AnotherFakeApi {
}
@PATCH
@Path("/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", })