mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
[Jaxrs] Add beanvalidation annotations and fix outer Enums (#4492)
* add beanvalidation to jaxrs and add support for outer Enums #4091 * cleanup Codegen #4091 * cleanup samples #4091 * cleanup tabs * updated samples to petstore.yaml (before petstore.json) * add support for DecimalMin/DecimalMax/Min/Max #4091 * add check for hideGenerationTimestamp #4091 * replace tabs * correct line endings to lf
This commit is contained in:
parent
c7ecb3c445
commit
ee7f9fc56c
@ -357,7 +357,7 @@ public class DefaultCodegen {
|
||||
// override with any special handling of the JMustache compiler
|
||||
@SuppressWarnings("unused")
|
||||
public Compiler processCompiler(Compiler compiler) {
|
||||
return compiler;
|
||||
return compiler;
|
||||
}
|
||||
|
||||
// override with any special text escaping logic
|
||||
@ -1708,7 +1708,7 @@ public class DefaultCodegen {
|
||||
|
||||
property.baseType = getSwaggerType(p);
|
||||
|
||||
if (p instanceof ArrayProperty) {
|
||||
if (p instanceof ArrayProperty) {
|
||||
property.isContainer = true;
|
||||
property.isListContainer = true;
|
||||
property.containerType = "array";
|
||||
@ -1719,7 +1719,7 @@ public class DefaultCodegen {
|
||||
property.minItems = ap.getMinItems();
|
||||
CodegenProperty cp = fromProperty(property.name, ap.getItems());
|
||||
updatePropertyForArray(property, cp);
|
||||
} else if (p instanceof MapProperty) {
|
||||
} else if (p instanceof MapProperty) {
|
||||
property.isContainer = true;
|
||||
property.isMapContainer = true;
|
||||
property.containerType = "map";
|
||||
@ -1906,7 +1906,7 @@ public class DefaultCodegen {
|
||||
* @return Codegen Operation object
|
||||
*/
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, Map<String, Model> definitions) {
|
||||
return fromOperation(path, httpMethod, operation, definitions, null);
|
||||
return fromOperation(path, httpMethod, operation, definitions, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2562,7 +2562,7 @@ public class DefaultCodegen {
|
||||
@SuppressWarnings("static-method")
|
||||
public List<CodegenSecurity> fromSecurity(Map<String, SecuritySchemeDefinition> schemes) {
|
||||
if (schemes == null) {
|
||||
return Collections.emptyList();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<CodegenSecurity> secs = new ArrayList<CodegenSecurity>(schemes.size());
|
||||
@ -2586,8 +2586,8 @@ public class DefaultCodegen {
|
||||
sec.isKeyInHeader = sec.isKeyInQuery = sec.isApiKey = sec.isOAuth = false;
|
||||
sec.isBasic = true;
|
||||
} else {
|
||||
final OAuth2Definition oauth2Definition = (OAuth2Definition) schemeDefinition;
|
||||
sec.isKeyInHeader = sec.isKeyInQuery = sec.isApiKey = sec.isBasic = false;
|
||||
final OAuth2Definition oauth2Definition = (OAuth2Definition) schemeDefinition;
|
||||
sec.isKeyInHeader = sec.isKeyInQuery = sec.isApiKey = sec.isBasic = false;
|
||||
sec.isOAuth = true;
|
||||
sec.flow = oauth2Definition.getFlow();
|
||||
if (sec.flow == null) {
|
||||
@ -3222,11 +3222,11 @@ public class DefaultCodegen {
|
||||
// encountered so far and hopefully make it easier for others to add more special
|
||||
// cases in the future.
|
||||
|
||||
// better error handling when map/array type is invalid
|
||||
if (name == null) {
|
||||
LOGGER.error("String to be sanitized is null. Default to ERROR_UNKNOWN");
|
||||
return "ERROR_UNKNOWN";
|
||||
}
|
||||
// better error handling when map/array type is invalid
|
||||
if (name == null) {
|
||||
LOGGER.error("String to be sanitized is null. Default to ERROR_UNKNOWN");
|
||||
return "ERROR_UNKNOWN";
|
||||
}
|
||||
|
||||
// if the name is just '$', map it to 'value' for the time being.
|
||||
if ("$".equals(name)) {
|
||||
@ -3447,11 +3447,25 @@ public class DefaultCodegen {
|
||||
public boolean convertPropertyToBooleanAndWriteBack(String propertyKey) {
|
||||
boolean booleanValue = false;
|
||||
if (additionalProperties.containsKey(propertyKey)) {
|
||||
booleanValue = Boolean.valueOf(additionalProperties.get(propertyKey).toString());
|
||||
booleanValue = convertPropertyToBoolean(propertyKey);
|
||||
// write back as boolean
|
||||
additionalProperties.put(propertyKey, booleanValue);
|
||||
writePropertyBack(propertyKey, booleanValue);
|
||||
}
|
||||
|
||||
return booleanValue;
|
||||
}
|
||||
|
||||
|
||||
public boolean convertPropertyToBoolean(String propertyKey) {
|
||||
boolean booleanValue = false;
|
||||
if (additionalProperties.containsKey(propertyKey)) {
|
||||
booleanValue = Boolean.valueOf(additionalProperties.get(propertyKey).toString());
|
||||
}
|
||||
|
||||
return booleanValue;
|
||||
}
|
||||
|
||||
public void writePropertyBack(String propertyKey, boolean value) {
|
||||
additionalProperties.put(propertyKey, value);
|
||||
}
|
||||
}
|
||||
|
@ -2,27 +2,31 @@ package io.swagger.codegen.languages;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenModel;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.codegen.languages.features.BeanValidationFeatures;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.Property;
|
||||
import io.swagger.util.Json;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
{
|
||||
public JavaJAXRSSpecServerCodegen()
|
||||
{
|
||||
public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen implements BeanValidationFeatures
|
||||
{
|
||||
protected boolean useBeanValidation = true;
|
||||
|
||||
public JavaJAXRSSpecServerCodegen()
|
||||
{
|
||||
super();
|
||||
invokerPackage = "io.swagger.api";
|
||||
artifactId = "swagger-jaxrs-server";
|
||||
@ -67,26 +71,37 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
library.setEnum(supportedLibraries);
|
||||
|
||||
cliOptions.add(library);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts()
|
||||
{
|
||||
super.processOpts();
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts()
|
||||
{
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
|
||||
this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION));
|
||||
}
|
||||
|
||||
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
|
||||
if (useBeanValidation) {
|
||||
writePropertyBack(USE_BEANVALIDATION, useBeanValidation);
|
||||
}
|
||||
|
||||
supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen
|
||||
writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
|
||||
writeOptional(outputFolder, new SupportingFile("RestApplication.mustache",
|
||||
(sourceFolder + '/' + invokerPackage).replace(".", "/"), "RestApplication.java"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "jaxrs-spec";
|
||||
}
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "jaxrs-spec";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
|
||||
@ -127,16 +142,16 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
model.imports.remove("JsonProperty");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void preprocessSwagger(Swagger swagger) {
|
||||
//copy input swagger to output folder
|
||||
try {
|
||||
String swaggerJson = Json.pretty(swagger);
|
||||
//copy input swagger to output folder
|
||||
try {
|
||||
String swaggerJson = Json.pretty(swagger);
|
||||
FileUtils.writeStringToFile(new File(outputFolder + File.separator + "swagger.json"), swaggerJson);
|
||||
} catch (IOException e) {
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e.getMessage(), e.getCause());
|
||||
}
|
||||
super.preprocessSwagger(swagger);
|
||||
}
|
||||
super.preprocessSwagger(swagger);
|
||||
|
||||
}
|
||||
@Override
|
||||
@ -144,4 +159,9 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen
|
||||
{
|
||||
return "Generates a Java JAXRS Server according to JAXRS 2.0 specification.";
|
||||
}
|
||||
|
||||
public void setUseBeanValidation(boolean useBeanValidation) {
|
||||
this.useBeanValidation = useBeanValidation;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,9 @@ import javax.ws.rs.core.Response;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
{{#useBeanValidation}}
|
||||
import javax.validation.constraints.*;
|
||||
{{/useBeanValidation}}
|
||||
|
||||
@Path("/{{baseName}}")
|
||||
|
||||
|
@ -0,0 +1,53 @@
|
||||
{{#required}}
|
||||
@NotNull
|
||||
{{/required}}
|
||||
{{#pattern}}
|
||||
@Pattern(regexp="{{pattern}}")
|
||||
{{/pattern}}
|
||||
{{#minLength}}
|
||||
{{#maxLength}}
|
||||
@Size(min={{minLength}},max={{maxLength}})
|
||||
{{/maxLength}}
|
||||
{{/minLength}}
|
||||
{{#minLength}}
|
||||
{{^maxLength}}
|
||||
@Size(min={{minLength}})
|
||||
{{/maxLength}}
|
||||
{{/minLength}}
|
||||
{{^minLength}}
|
||||
{{#maxLength}}
|
||||
@Size(max={{maxLength}})
|
||||
{{/maxLength}}
|
||||
{{/minLength}}
|
||||
{{#minItems}}
|
||||
{{#maxItems}}
|
||||
@Size(min={{minItems}},max={{maxItems}})
|
||||
{{/maxItems}}
|
||||
{{/minItems}}
|
||||
{{#minItems}}
|
||||
{{^maxItems}}
|
||||
@Size(min={{minItems}})
|
||||
{{/maxItems}}
|
||||
{{/minItems}}
|
||||
{{^minItems}}
|
||||
{{#maxItems}}
|
||||
@Size(max={{maxItems}})
|
||||
{{/maxItems}}
|
||||
{{/minItems}}
|
||||
{{! check for integer / number=decimal type}}
|
||||
{{#isInteger}}
|
||||
{{#minimum}}
|
||||
@Min({{minimum}})
|
||||
{{/minimum}}
|
||||
{{#maximum}}
|
||||
@Max({{maximum}})
|
||||
{{/maximum}}
|
||||
{{/isInteger}}
|
||||
{{^isInteger}}
|
||||
{{#minimum}}
|
||||
@DecimalMin("{{minimum}}")
|
||||
{{/minimum}}
|
||||
{{#maximum}}
|
||||
@DecimalMax("{{maximum}}")
|
||||
{{/maximum}}
|
||||
{{/isInteger}}
|
@ -0,0 +1 @@
|
||||
{{! PathParam is always required, no @NotNull necessary }}{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}
|
@ -0,0 +1 @@
|
||||
{{#required}} @NotNull{{/required}}{{#pattern}} @Pattern(regexp="{{pattern}}"){{/pattern}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} @Size(min={{minLength}}){{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} @Size(max={{maxLength}}){{/maxLength}}{{/minLength}}{{#minItems}}{{#maxItems}} @Size(min={{minItems}},max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minItems}}{{^maxItems}} @Size(min={{minItems}}){{/maxItems}}{{/minItems}}{{^minItems}}{{#maxItems}} @Size(max={{maxItems}}){{/maxItems}}{{/minItems}}{{#minimum}} @Min({{minimum}}){{/minimum}}{{#maximum}} @Max({{maximum}}){{/maximum}}
|
@ -1,16 +1,31 @@
|
||||
import javax.xml.bind.annotation.XmlEnum;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
public enum {{datatypeWithEnum}} {
|
||||
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}{{name}}({{datatype}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
|
||||
|
||||
private {{datatype}} value;
|
||||
|
||||
{{datatypeWithEnum}} ({{datatype}} v) {
|
||||
value = v;
|
||||
}
|
||||
|
||||
@XmlType(name="{{classname}}")
|
||||
@XmlEnum
|
||||
public enum {{classname}} {
|
||||
{{#allowableValues}}{{.}}{{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/allowableValues}}
|
||||
|
||||
public String value() {
|
||||
return name();
|
||||
return value;
|
||||
}
|
||||
|
||||
public static {{classname}} fromValue(String v) {
|
||||
return valueOf(v);
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static {{datatypeWithEnum}} fromValue(String v) {
|
||||
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (String.valueOf(b.value).equals(v)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
{{#jackson}}
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
{{/jackson}}
|
||||
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
{{/gson}}
|
||||
{{^gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
{{/gson}}
|
||||
|
||||
private {{{dataType}}} value;
|
||||
|
||||
{{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) {
|
||||
for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,2 +1,2 @@
|
||||
{{#isFormParam}}{{#notFile}}@FormParam(value = "{{paramName}}"{{^required}}, required = false{{/required}}) {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} @FormParam(value = "{{paramName}}"{{^required}}, required = false{{/required}}) InputStream {{paramName}}InputStream,
|
||||
@FormParam(value = "{{paramName}}" {{^required}}, required = false{{/required}}) Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
||||
{{#isFormParam}}{{#notFile}}@FormParam(value = "{{paramName}}") {{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}} @FormParam(value = "{{paramName}}") InputStream {{paramName}}InputStream,
|
||||
@FormParam(value = "{{paramName}}") Attachment {{paramName}}Detail{{/isFile}}{{/isFormParam}}
|
@ -1 +1,3 @@
|
||||
@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}")
|
||||
{{^hideGenerationTimestamp}}
|
||||
@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}")
|
||||
{{/hideGenerationTimestamp}}
|
@ -2,13 +2,18 @@ package {{package}};
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
{{#useBeanValidation}}
|
||||
import javax.validation.constraints.*;
|
||||
{{/useBeanValidation}}
|
||||
|
||||
{{#models}}
|
||||
{{#model}}{{#description}}
|
||||
/**
|
||||
* {{description}}
|
||||
**/{{/description}}
|
||||
{{#isEnum}}{{>enumClass}}{{/isEnum}}
|
||||
{{#isEnum}}
|
||||
{{>enumOuterClass}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}{{>pojo}}{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
|
@ -1 +1 @@
|
||||
{{#isPathParam}}@PathParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isPathParam}}
|
||||
{{#isPathParam}}@PathParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{#description}} @ApiParam("{{description}}"){{/description}} {{{dataType}}} {{paramName}}{{/isPathParam}}
|
@ -23,7 +23,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
|
||||
|
||||
{{#vendorExtensions.extraAnnotation}}{{{vendorExtensions.extraAnnotation}}}{{/vendorExtensions.extraAnnotation}}
|
||||
@ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||
public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
return {{name}};
|
||||
}
|
||||
public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
|
||||
|
@ -69,6 +69,15 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
{{#useBeanValidation}}
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.1.0.Final</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
{{/useBeanValidation}}
|
||||
</dependencies>
|
||||
<properties>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
|
@ -1 +1 @@
|
||||
{{#isQueryParam}}@QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
|
||||
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}} {{{dataType}}} {{paramName}}{{/isQueryParam}}
|
23
samples/server/petstore/jaxrs-spec/.swagger-codegen-ignore
Normal file
23
samples/server/petstore/jaxrs-spec/.swagger-codegen-ignore
Normal file
@ -0,0 +1,23 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
@ -1,9 +1,9 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>wasdev</groupId>
|
||||
<artifactId>autogen-server</artifactId>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-jaxrs-server</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>autogen-server</name>
|
||||
<name>swagger-jaxrs-server</name>
|
||||
<version>1.0.0</version>
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
@ -69,6 +69,13 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Bean Validation API support -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.1.0.Final</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<junit-version>4.8.1</junit-version>
|
||||
|
@ -1,140 +1,156 @@
|
||||
package com.ibm.ws.petstoresample.api;
|
||||
|
||||
import com.ibm.ws.petstoresample.model.Pet;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Path("/pets")
|
||||
|
||||
@Api(description = "the pets API")
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJAXRSSpecServerCodegen", date = "2016-06-06T11:04:02.369-04:00")
|
||||
|
||||
public class PetsApi {
|
||||
|
||||
@POST
|
||||
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Add a new pet to the store", notes = "", response = void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write_pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read_pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
||||
public Response addPet(Pet body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("/{petId}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Deletes a pet", notes = "", response = void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write_pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read_pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid pet value", response = void.class) })
|
||||
public Response deletePet(@HeaderParam("api_key") String apiKey,@PathParam("petId") Long petId) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/findByStatus")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write_pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read_pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
@ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") })
|
||||
public Response findPetsByStatus(@QueryParam("status") List<String> status) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/findByTags")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write_pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read_pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
@ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "List") })
|
||||
public Response findPetsByTags(@QueryParam("tags") List<String> tags) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{petId}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write_pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read_pets", description = "read your pets")
|
||||
}),
|
||||
@Authorization(value = "api_key")
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
|
||||
@ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
|
||||
public Response getPetById(@PathParam("petId") Long petId) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Update an existing pet", notes = "", response = void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write_pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read_pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||
@ApiResponse(code = 404, message = "Pet not found", response = void.class),
|
||||
@ApiResponse(code = 405, message = "Validation exception", response = void.class) })
|
||||
public Response updatePet(Pet body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{petId}")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write_pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read_pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
||||
public Response updatePetWithForm(@PathParam("petId") String petId,@FormParam(value = "name") String name,@FormParam(value = "status") String status) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
}
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import java.io.File;
|
||||
import io.swagger.model.ModelApiResponse;
|
||||
import io.swagger.model.Pet;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Path("/pet")
|
||||
|
||||
@Api(description = "the pet API")
|
||||
|
||||
|
||||
|
||||
|
||||
public class PetApi {
|
||||
|
||||
@POST
|
||||
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Add a new pet to the store", notes = "", response = void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
||||
public Response addPet(Pet body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("/{petId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Deletes a pet", notes = "", response = void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid pet value", response = void.class) })
|
||||
public Response deletePet(@PathParam("petId") @ApiParam("Pet id to delete") Long petId,@HeaderParam("api_key") String apiKey) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/findByStatus")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
@ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") })
|
||||
public Response findPetsByStatus(@QueryParam("status") @NotNull List<String> status) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/findByTags")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"),
|
||||
@ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "List") })
|
||||
public Response findPetsByTags(@QueryParam("tags") @NotNull List<String> tags) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{petId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
|
||||
@Authorization(value = "api_key")
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
|
||||
@ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
|
||||
public Response getPetById(@PathParam("petId") @ApiParam("ID of pet to return") Long petId) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Update an existing pet", notes = "", response = void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||
@ApiResponse(code = 404, message = "Pet not found", response = void.class),
|
||||
@ApiResponse(code = 405, message = "Validation exception", response = void.class) })
|
||||
public Response updatePet(Pet body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{petId}")
|
||||
@Consumes({ "application/x-www-form-urlencoded" })
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = void.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Invalid input", response = void.class) })
|
||||
public Response updatePetWithForm(@PathParam("petId") @ApiParam("ID of pet that needs to be updated") Long petId,@FormParam(value = "name") String name,@FormParam(value = "status") String status) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{petId}/uploadImage")
|
||||
@Consumes({ "multipart/form-data" })
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public Response uploadFile(@PathParam("petId") @ApiParam("ID of pet to update") Long petId,@FormParam(value = "additionalMetadata") String additionalMetadata, @FormParam(value = "file") InputStream fileInputStream,
|
||||
@FormParam(value = "file") Attachment fileDetail) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.ibm.ws.petstoresample;
|
||||
package io.swagger.api;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import javax.ws.rs.core.Application;
|
@ -1,58 +1,73 @@
|
||||
package com.ibm.ws.petstoresample.api;
|
||||
|
||||
import com.ibm.ws.petstoresample.model.Order;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Path("/stores")
|
||||
|
||||
@Api(description = "the stores API")
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJAXRSSpecServerCodegen", date = "2016-06-06T11:04:02.369-04:00")
|
||||
|
||||
public class StoresApi {
|
||||
|
||||
@DELETE
|
||||
@Path("/order/{orderId}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = void.class, tags={ "store", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||
@ApiResponse(code = 404, message = "Order not found", response = void.class) })
|
||||
public Response deleteOrder(@PathParam("orderId") String orderId) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/order/{orderId}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
|
||||
@ApiResponse(code = 404, message = "Order not found", response = Order.class) })
|
||||
public Response getOrderById(@PathParam("orderId") String orderId) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/order")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||
@ApiResponse(code = 400, message = "Invalid Order", response = Order.class) })
|
||||
public Response placeOrder(Order body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
}
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import java.util.Map;
|
||||
import io.swagger.model.Order;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Path("/store")
|
||||
|
||||
@Api(description = "the store API")
|
||||
|
||||
|
||||
|
||||
|
||||
public class StoreApi {
|
||||
|
||||
@DELETE
|
||||
@Path("/order/{orderId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = void.class, tags={ "store", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class),
|
||||
@ApiResponse(code = 404, message = "Order not found", response = void.class) })
|
||||
public Response deleteOrder(@PathParam("orderId") @Min(1) @ApiParam("ID of the order that needs to be deleted") String orderId) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/inventory")
|
||||
|
||||
@Produces({ "application/json" })
|
||||
@ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
|
||||
@Authorization(value = "api_key")
|
||||
}, tags={ "store", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Integer.class, responseContainer = "Map") })
|
||||
public Response getInventory() {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/order/{orderId}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
|
||||
@ApiResponse(code = 404, message = "Order not found", response = Order.class) })
|
||||
public Response getOrderById(@PathParam("orderId") @Min(1) @Max(5) @ApiParam("ID of pet that needs to be fetched") Long orderId) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/order")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||
@ApiResponse(code = 400, message = "Invalid Order", response = Order.class) })
|
||||
public Response placeOrder(Order body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
}
|
||||
|
@ -1,115 +1,116 @@
|
||||
package com.ibm.ws.petstoresample.api;
|
||||
|
||||
import com.ibm.ws.petstoresample.model.User;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Path("/users")
|
||||
|
||||
@Api(description = "the users API")
|
||||
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJAXRSSpecServerCodegen", date = "2016-06-06T11:04:02.369-04:00")
|
||||
|
||||
public class UsersApi {
|
||||
|
||||
@POST
|
||||
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||
public Response createUser(User body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/createWithArray")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||
public Response createUsersWithArrayInput(List<User> body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/createWithList")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||
public Response createUsersWithListInput(List<User> body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied", response = void.class),
|
||||
@ApiResponse(code = 404, message = "User not found", response = void.class) })
|
||||
public Response deleteUser(@PathParam("username") String username) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = User.class),
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied", response = User.class),
|
||||
@ApiResponse(code = 404, message = "User not found", response = User.class) })
|
||||
public Response getUserByName(@PathParam("username") String username) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/login")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = String.class),
|
||||
@ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) })
|
||||
public Response loginUser(@QueryParam("username") String username,@QueryParam("password") String password) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/logout")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Logs out current logged in user session", notes = "", response = void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||
public Response logoutUser() {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid user supplied", response = void.class),
|
||||
@ApiResponse(code = 404, message = "User not found", response = void.class) })
|
||||
public Response updateUser(@PathParam("username") String username,User body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
}
|
||||
|
||||
package io.swagger.api;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.model.User;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Path("/user")
|
||||
|
||||
@Api(description = "the user API")
|
||||
|
||||
|
||||
|
||||
|
||||
public class UserApi {
|
||||
|
||||
@POST
|
||||
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||
public Response createUser(User body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/createWithArray")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||
public Response createUsersWithArrayInput(List<User> body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/createWithList")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||
public Response createUsersWithListInput(List<User> body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied", response = void.class),
|
||||
@ApiResponse(code = 404, message = "User not found", response = void.class) })
|
||||
public Response deleteUser(@PathParam("username") @ApiParam("The name that needs to be deleted") String username) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = User.class),
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied", response = User.class),
|
||||
@ApiResponse(code = 404, message = "User not found", response = User.class) })
|
||||
public Response getUserByName(@PathParam("username") @ApiParam("The name that needs to be fetched. Use user1 for testing. ") String username) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/login")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = String.class),
|
||||
@ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) })
|
||||
public Response loginUser(@QueryParam("username") @NotNull String username,@QueryParam("password") @NotNull String password) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/logout")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Logs out current logged in user session", notes = "", response = void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = void.class) })
|
||||
public Response logoutUser() {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
|
||||
@PUT
|
||||
@Path("/{username}")
|
||||
|
||||
@Produces({ "application/xml", "application/json" })
|
||||
@ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid user supplied", response = void.class),
|
||||
@ApiResponse(code = 404, message = "User not found", response = void.class) })
|
||||
public Response updateUser(@PathParam("username") @ApiParam("name that need to be deleted") String username,User body) {
|
||||
return Response.ok().entity("magic!").build();
|
||||
}
|
||||
}
|
||||
|
@ -1,87 +1,91 @@
|
||||
package com.ibm.ws.petstoresample.model;
|
||||
|
||||
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
public Category id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Category name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Category category = (Category) o;
|
||||
return Objects.equals(id, category.id) &&
|
||||
Objects.equals(name, category.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Category {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* A category for a pet
|
||||
**/
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
@ApiModel(description = "A category for a pet")
|
||||
|
||||
public class Category {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
public Category id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Category name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Category category = (Category) o;
|
||||
return Objects.equals(id, category.id) &&
|
||||
Objects.equals(name, category.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Category {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
**/
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
@ApiModel(description = "Describes the result of uploading an image resource")
|
||||
|
||||
public class ModelApiResponse {
|
||||
|
||||
private Integer code = null;
|
||||
private String type = null;
|
||||
private String message = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
public ModelApiResponse code(Integer code) {
|
||||
this.code = code;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public ModelApiResponse type(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public ModelApiResponse message(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ModelApiResponse _apiResponse = (ModelApiResponse) o;
|
||||
return Objects.equals(code, _apiResponse.code) &&
|
||||
Objects.equals(type, _apiResponse.type) &&
|
||||
Objects.equals(message, _apiResponse.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(code, type, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class ModelApiResponse {\n");
|
||||
|
||||
sb.append(" code: ").append(toIndentedString(code)).append("\n");
|
||||
sb.append(" type: ").append(toIndentedString(type)).append("\n");
|
||||
sb.append(" message: ").append(toIndentedString(message)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
@ -1,164 +1,199 @@
|
||||
package com.ibm.ws.petstoresample.model;
|
||||
|
||||
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
private Long petId = null;
|
||||
private Integer quantity = null;
|
||||
private javax.xml.datatype.XMLGregorianCalendar shipDate = null;
|
||||
private String status = null;
|
||||
private Boolean complete = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order petId(Long petId) {
|
||||
this.petId = petId;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getPetId() {
|
||||
return petId;
|
||||
}
|
||||
public void setPetId(Long petId) {
|
||||
this.petId = petId;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order quantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order shipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) {
|
||||
this.shipDate = shipDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public javax.xml.datatype.XMLGregorianCalendar getShipDate() {
|
||||
return shipDate;
|
||||
}
|
||||
public void setShipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) {
|
||||
this.shipDate = shipDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
**/
|
||||
public Order status(String status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Order Status")
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order complete(Boolean complete) {
|
||||
this.complete = complete;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Boolean getComplete() {
|
||||
return complete;
|
||||
}
|
||||
public void setComplete(Boolean complete) {
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Order order = (Order) o;
|
||||
return Objects.equals(id, order.id) &&
|
||||
Objects.equals(petId, order.petId) &&
|
||||
Objects.equals(quantity, order.quantity) &&
|
||||
Objects.equals(shipDate, order.shipDate) &&
|
||||
Objects.equals(status, order.status) &&
|
||||
Objects.equals(complete, order.complete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, petId, quantity, shipDate, status, complete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Order {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
|
||||
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
|
||||
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* An order for a pets from the pet store
|
||||
**/
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
@ApiModel(description = "An order for a pets from the pet store")
|
||||
|
||||
public class Order {
|
||||
|
||||
private Long id = null;
|
||||
private Long petId = null;
|
||||
private Integer quantity = null;
|
||||
private javax.xml.datatype.XMLGregorianCalendar shipDate = null;
|
||||
|
||||
public enum StatusEnum {
|
||||
|
||||
PLACED(String.valueOf("placed")), APPROVED(String.valueOf("approved")), DELIVERED(String.valueOf("delivered"));
|
||||
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum (String v) {
|
||||
value = v;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static StatusEnum fromValue(String v) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(v)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status = null;
|
||||
private Boolean complete = false;
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order petId(Long petId) {
|
||||
this.petId = petId;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getPetId() {
|
||||
return petId;
|
||||
}
|
||||
public void setPetId(Long petId) {
|
||||
this.petId = petId;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order quantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
public void setQuantity(Integer quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order shipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) {
|
||||
this.shipDate = shipDate;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public javax.xml.datatype.XMLGregorianCalendar getShipDate() {
|
||||
return shipDate;
|
||||
}
|
||||
public void setShipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) {
|
||||
this.shipDate = shipDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
**/
|
||||
public Order status(StatusEnum status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "Order Status")
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Order complete(Boolean complete) {
|
||||
this.complete = complete;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Boolean getComplete() {
|
||||
return complete;
|
||||
}
|
||||
public void setComplete(Boolean complete) {
|
||||
this.complete = complete;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Order order = (Order) o;
|
||||
return Objects.equals(id, order.id) &&
|
||||
Objects.equals(petId, order.petId) &&
|
||||
Objects.equals(quantity, order.quantity) &&
|
||||
Objects.equals(shipDate, order.shipDate) &&
|
||||
Objects.equals(status, order.status) &&
|
||||
Objects.equals(complete, order.complete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, petId, quantity, shipDate, status, complete);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Order {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" petId: ").append(toIndentedString(petId)).append("\n");
|
||||
sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n");
|
||||
sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append(" complete: ").append(toIndentedString(complete)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
@ -1,168 +1,205 @@
|
||||
package com.ibm.ws.petstoresample.model;
|
||||
|
||||
import com.ibm.ws.petstoresample.model.Category;
|
||||
import com.ibm.ws.petstoresample.model.Tag;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
private Category category = null;
|
||||
private String name = null;
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
private String status = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet category(Category category) {
|
||||
this.category = category;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Category getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet photoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", required = true, value = "")
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet tags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
public Pet status(String status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "pet status in the store")
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Pet pet = (Pet) o;
|
||||
return Objects.equals(id, pet.id) &&
|
||||
Objects.equals(category, pet.category) &&
|
||||
Objects.equals(name, pet.name) &&
|
||||
Objects.equals(photoUrls, pet.photoUrls) &&
|
||||
Objects.equals(tags, pet.tags) &&
|
||||
Objects.equals(status, pet.status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, category, name, photoUrls, tags, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Pet {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" category: ").append(toIndentedString(category)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
|
||||
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.model.Category;
|
||||
import io.swagger.model.Tag;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
**/
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
@ApiModel(description = "A pet for sale in the pet store")
|
||||
|
||||
public class Pet {
|
||||
|
||||
private Long id = null;
|
||||
private Category category = null;
|
||||
private String name = null;
|
||||
private List<String> photoUrls = new ArrayList<String>();
|
||||
private List<Tag> tags = new ArrayList<Tag>();
|
||||
|
||||
public enum StatusEnum {
|
||||
|
||||
AVAILABLE(String.valueOf("available")), PENDING(String.valueOf("pending")), SOLD(String.valueOf("sold"));
|
||||
|
||||
|
||||
private String value;
|
||||
|
||||
StatusEnum (String v) {
|
||||
value = v;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public static StatusEnum fromValue(String v) {
|
||||
for (StatusEnum b : StatusEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(v)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private StatusEnum status = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet category(Category category) {
|
||||
this.category = category;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Category getCategory() {
|
||||
return category;
|
||||
}
|
||||
public void setCategory(Category category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
@NotNull
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet photoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", required = true, value = "")
|
||||
@NotNull
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
public void setPhotoUrls(List<String> photoUrls) {
|
||||
this.photoUrls = photoUrls;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Pet tags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
public void setTags(List<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
**/
|
||||
public Pet status(StatusEnum status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "pet status in the store")
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(StatusEnum status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Pet pet = (Pet) o;
|
||||
return Objects.equals(id, pet.id) &&
|
||||
Objects.equals(category, pet.category) &&
|
||||
Objects.equals(name, pet.name) &&
|
||||
Objects.equals(photoUrls, pet.photoUrls) &&
|
||||
Objects.equals(tags, pet.tags) &&
|
||||
Objects.equals(status, pet.status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, category, name, photoUrls, tags, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Pet {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" category: ").append(toIndentedString(category)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
|
||||
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
|
||||
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
@ -1,87 +1,91 @@
|
||||
package com.ibm.ws.petstoresample.model;
|
||||
|
||||
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
public Tag id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Tag name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Tag tag = (Tag) o;
|
||||
return Objects.equals(id, tag.id) &&
|
||||
Objects.equals(name, tag.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Tag {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
**/
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
@ApiModel(description = "A tag for a pet")
|
||||
|
||||
public class Tag {
|
||||
|
||||
private Long id = null;
|
||||
private String name = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
public Tag id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public Tag name(String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Tag tag = (Tag) o;
|
||||
return Objects.equals(id, tag.id) &&
|
||||
Objects.equals(name, tag.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class Tag {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
@ -1,202 +1,206 @@
|
||||
package com.ibm.ws.petstoresample.model;
|
||||
|
||||
|
||||
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
private String username = null;
|
||||
private String firstName = null;
|
||||
private String lastName = null;
|
||||
private String email = null;
|
||||
private String password = null;
|
||||
private String phone = null;
|
||||
private Integer userStatus = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
public User id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User username(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User firstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User lastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User email(String email) {
|
||||
this.email = email;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User password(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User phone(String phone) {
|
||||
this.phone = phone;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* User Status
|
||||
**/
|
||||
public User userStatus(Integer userStatus) {
|
||||
this.userStatus = userStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "User Status")
|
||||
public Integer getUserStatus() {
|
||||
return userStatus;
|
||||
}
|
||||
public void setUserStatus(Integer userStatus) {
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
User user = (User) o;
|
||||
return Objects.equals(id, user.id) &&
|
||||
Objects.equals(username, user.username) &&
|
||||
Objects.equals(firstName, user.firstName) &&
|
||||
Objects.equals(lastName, user.lastName) &&
|
||||
Objects.equals(email, user.email) &&
|
||||
Objects.equals(password, user.password) &&
|
||||
Objects.equals(phone, user.phone) &&
|
||||
Objects.equals(userStatus, user.userStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class User {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" username: ").append(toIndentedString(username)).append("\n");
|
||||
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
|
||||
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
|
||||
sb.append(" email: ").append(toIndentedString(email)).append("\n");
|
||||
sb.append(" password: ").append(toIndentedString(password)).append("\n");
|
||||
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
|
||||
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
||||
package io.swagger.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* A User who is purchasing from the pet store
|
||||
**/
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Objects;
|
||||
@ApiModel(description = "A User who is purchasing from the pet store")
|
||||
|
||||
public class User {
|
||||
|
||||
private Long id = null;
|
||||
private String username = null;
|
||||
private String firstName = null;
|
||||
private String lastName = null;
|
||||
private String email = null;
|
||||
private String password = null;
|
||||
private String phone = null;
|
||||
private Integer userStatus = null;
|
||||
|
||||
/**
|
||||
**/
|
||||
public User id(Long id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User username(String username) {
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User firstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User lastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User email(String email) {
|
||||
this.email = email;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User password(String password) {
|
||||
this.password = password;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
public User phone(String phone) {
|
||||
this.phone = phone;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "")
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* User Status
|
||||
**/
|
||||
public User userStatus(Integer userStatus) {
|
||||
this.userStatus = userStatus;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ApiModelProperty(example = "null", value = "User Status")
|
||||
public Integer getUserStatus() {
|
||||
return userStatus;
|
||||
}
|
||||
public void setUserStatus(Integer userStatus) {
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
User user = (User) o;
|
||||
return Objects.equals(id, user.id) &&
|
||||
Objects.equals(username, user.username) &&
|
||||
Objects.equals(firstName, user.firstName) &&
|
||||
Objects.equals(lastName, user.lastName) &&
|
||||
Objects.equals(email, user.email) &&
|
||||
Objects.equals(password, user.password) &&
|
||||
Objects.equals(phone, user.phone) &&
|
||||
Objects.equals(userStatus, user.userStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class User {\n");
|
||||
|
||||
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||
sb.append(" username: ").append(toIndentedString(username)).append("\n");
|
||||
sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n");
|
||||
sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n");
|
||||
sb.append(" email: ").append(toIndentedString(email)).append("\n");
|
||||
sb.append(" password: ").append(toIndentedString(password)).append("\n");
|
||||
sb.append(" phone: ").append(toIndentedString(phone)).append("\n");
|
||||
sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given object to string with each line indented by 4 spaces
|
||||
* (except the first line).
|
||||
*/
|
||||
private String toIndentedString(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user