diff --git a/.travis.yml b/.travis.yml index 4f1c563bdce..156a5dbfcdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,6 +47,11 @@ before_install: - sudo apt-get update -qq - sudo apt-get install -qq bats - sudo apt-get install -qq curl + # Add rebar3 build tool and recent Erlang/OTP for Erlang petstore server tests. + # - Travis CI does not support rebar3 [yet](https://github.com/travis-ci/travis-ci/issues/6506#issuecomment-275189490). + # - Rely on `kerl` for [pre-compiled versions available](https://docs.travis-ci.com/user/languages/erlang#Choosing-OTP-releases-to-test-against). Rely on installation path chosen by [`travis-erlang-builder`](https://github.com/travis-ci/travis-erlang-builder/blob/e6d016b1a91ca7ecac5a5a46395bde917ea13d36/bin/compile#L18). + - . ~/otp/18.2.1/activate && erl -version + - curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH" # show host table to confirm petstore.swagger.io is mapped to localhost - cat /etc/hosts diff --git a/README.md b/README.md index c7abdc9a0d2..e27d8b3a2d2 100644 --- a/README.md +++ b/README.md @@ -722,7 +722,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you - [DocRaptor](https://docraptor.com) - [DocuSign](https://www.docusign.com) - [Ergon](http://www.ergon.ch/) -- [EMC](https://www.emc.com/) +- [Dell EMC](https://www.emc.com/) - [eureka](http://eure.jp/) - [everystory.us](http://everystory.us) - [Expected Behavior](http://www.expectedbehavior.com/) @@ -874,6 +874,7 @@ Here is a list of template creators: * Elixir: @niku * Groovy: @victorgit * Go: @wing328 + * Go (rewritten in 2.3.0): @antihax * Java (Feign): @davidkiss * Java (Retrofit): @0legg * Java (Retrofi2): @emilianobonassi diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 943ae1a2927..7faa46aba34 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -6,19 +6,19 @@ set -euo pipefail GEN_DIR=${GEN_DIR:-/opt/swagger-codegen} JAVA_OPTS=${JAVA_OPTS:-"-Xmx1024M -DloggerPath=conf/log4j.properties"} -codegen="${GEN_DIR}/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" +cli="${GEN_DIR}/modules/swagger-codegen-cli" +codegen="${cli}/target/swagger-codegen-cli.jar" +cmdsrc="${cli}/src/main/java/io/swagger/codegen/cmd" -case "$1" in - generate|help|langs|meta|config-help) - # If ${GEN_DIR} has been mapped elsewhere from default, and that location has not been built - if [[ ! -f "${codegen}" ]]; then - (cd ${GEN_DIR} && exec mvn -am -pl "modules/swagger-codegen-cli" package) - fi - command=$1 - shift - exec java ${JAVA_OPTS} -jar ${codegen} ${command} "$@" - ;; - *) # Any other commands, e.g. docker run imagename ls -la or docker run -it imagename /bin/bash - exec "$@" - ;; -esac +pattern="@Command(name = \"$1\"" +if expr "x$1" : 'x[a-z][a-z-]*$' > /dev/null && fgrep -qe "$pattern" "$cmdsrc"/*.java; then + # If ${GEN_DIR} has been mapped elsewhere from default, and that location has not been built + if [[ ! -f "${codegen}" ]]; then + (cd "${GEN_DIR}" && exec mvn -am -pl "modules/swagger-codegen-cli" package) + fi + command=$1 + shift + exec java ${JAVA_OPTS} -jar "${codegen}" "${command}" "$@" +else + exec "$@" +fi diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index b5d83c1e541..d5981410a2d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -1737,7 +1737,11 @@ public class DefaultCodegen { ArrayProperty ap = (ArrayProperty) p; property.maxItems = ap.getMaxItems(); property.minItems = ap.getMinItems(); - CodegenProperty cp = fromProperty(property.name, ap.getItems()); + String itemName = (String) p.getVendorExtensions().get("x-item-name"); + if (itemName == null) { + itemName = property.name; + } + CodegenProperty cp = fromProperty(itemName, ap.getItems()); updatePropertyForArray(property, cp); } else if (p instanceof MapProperty) { MapProperty ap = (MapProperty) p; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index 886f8fdc097..abd4b0d2c97 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -3,6 +3,7 @@ package io.swagger.codegen; import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Template; import io.swagger.codegen.ignore.CodegenIgnoreProcessor; +import io.swagger.codegen.utils.ImplementationVersion; import io.swagger.models.*; import io.swagger.models.auth.OAuth2Definition; import io.swagger.models.auth.SecuritySchemeDefinition; @@ -126,8 +127,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } config.processOpts(); config.preprocessSwagger(swagger); - // TODO need to obtain version from a file instead of hardcoding it - config.additionalProperties().put("generatorVersion", "2.2.3-SNAPSHOT"); + config.additionalProperties().put("generatorVersion", ImplementationVersion.read()); config.additionalProperties().put("generatedDate", DateTime.now().toString()); config.additionalProperties().put("generatorClass", config.getClass().getName()); config.additionalProperties().put("inputSpec", config.getInputSpec()); @@ -581,6 +581,15 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { files.add(ignoreFile); } + final String swaggerVersionMetadata = config.outputFolder() + File.separator + ".swagger-codegen" + File.separator + "VERSION"; + File swaggerVersionMetadataFile = new File(swaggerVersionMetadata); + try { + writeToFile(swaggerVersionMetadata, ImplementationVersion.read()); + files.add(swaggerVersionMetadataFile); + } catch (IOException e) { + throw new RuntimeException("Could not generate supporting file '" + swaggerVersionMetadata + "'", e); + } + /* * The following code adds default LICENSE (Apache-2.0) for all generators * To use license other than Apache2.0, update the following file: diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CppRestClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CppRestClientCodegen.java index 98b6b06e2d0..3c2dac1dca3 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CppRestClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CppRestClientCodegen.java @@ -97,6 +97,7 @@ public class CppRestClientCodegen extends DefaultCodegen implements CodegenConfi supportingFiles.add(new SupportingFile("multipart-source.mustache", "", "MultipartFormData.cpp")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("cmake-lists.mustache", "", "CMakeLists.txt")); languageSpecificPrimitives = new HashSet( Arrays.asList("int", "char", "bool", "long", "float", "double", "int32_t", "int64_t")); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java index 82d5a76a609..73914ea5376 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java @@ -17,16 +17,12 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; -public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements CodegenConfig { +public class CsharpDotNet2ClientCodegen extends AbstractCSharpCodegen { public static final String CLIENT_PACKAGE = "clientPackage"; - protected String packageName = "IO.Swagger"; - protected String packageVersion = "1.0.0"; protected String clientPackage = "IO.Swagger.Client"; - protected String sourceFolder = "src" + File.separator + "main" + File.separator + "CsharpDotNet2"; protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; - public CsharpDotNet2ClientCodegen() { super(); @@ -34,128 +30,74 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege // at the moment importMapping.clear(); - outputFolder = "generated-code" + File.separator + "CsharpDotNet2"; modelTemplateFiles.put("model.mustache", ".cs"); apiTemplateFiles.put("api.mustache", ".cs"); - embeddedTemplateDir = templateDir = "CsharpDotNet2"; - apiPackage = "IO.Swagger.Api"; - modelPackage = "IO.Swagger.Model"; + + setApiPackage("IO.Swagger.Api"); + setModelPackage("IO.Swagger.Model"); + setSourceFolder("src" + File.separator + "main" + File.separator + this.getName()); + modelDocTemplateFiles.put("model_doc.mustache", ".md"); apiDocTemplateFiles.put("api_doc.mustache", ".md"); - setReservedWordsLowerCase( - Arrays.asList( - // local variable names in API methods (endpoints) - "path", "queryParams", "headerParams", "formParams", "fileParams", "postBody", - "authSettings", "response", "StatusCode", - // C# reserved word - "abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "int", "interface", "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "override", "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while") - ); - - - languageSpecificPrimitives = new HashSet( - Arrays.asList( - "String", - "string", - "bool?", - "double?", - "int?", - "long?", - "float?", - "byte[]", - "List", - "Dictionary", - "DateTime?", - "String", - "Boolean", - "Double", - "Integer", - "Long", - "Float", - "Guid?", - "System.IO.Stream", // not really a primitive, we include it to avoid model import - "Object") - ); - instantiationTypes.put("array", "List"); - instantiationTypes.put("map", "Dictionary"); - - typeMapping = new HashMap(); - typeMapping.put("string", "string"); - typeMapping.put("boolean", "bool?"); - typeMapping.put("integer", "int?"); - typeMapping.put("float", "float?"); - typeMapping.put("long", "long?"); - typeMapping.put("double", "double?"); - typeMapping.put("number", "double?"); - typeMapping.put("datetime", "DateTime?"); - typeMapping.put("date", "DateTime?"); - typeMapping.put("file", "System.IO.Stream"); - typeMapping.put("array", "List"); - typeMapping.put("list", "List"); - typeMapping.put("map", "Dictionary"); - typeMapping.put("object", "Object"); - typeMapping.put("uuid", "Guid?"); - cliOptions.clear(); - cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "C# package name (convention: Camel.Case).") - .defaultValue("IO.Swagger")); - cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "C# package version.").defaultValue("1.0.0")); - cliOptions.add(new CliOption(CLIENT_PACKAGE, "C# client package name (convention: Camel.Case).") - .defaultValue("IO.Swagger.Client")); + cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, + "C# package name (convention: Camel.Case).") + .defaultValue(packageName)); + cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, + "C# package version.") + .defaultValue(packageVersion)); + cliOptions.add(new CliOption(CLIENT_PACKAGE, + "C# client package name (convention: Camel.Case).") + .defaultValue(clientPackage)); } @Override public void processOpts() { super.processOpts(); - if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) { - setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION)); - } else { - additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion); - } - - if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { - setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); - apiPackage = packageName + ".Api"; - modelPackage = packageName + ".Model"; - clientPackage = packageName + ".Client"; - } else { - additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); - } - if (additionalProperties.containsKey(CLIENT_PACKAGE)) { this.setClientPackage((String) additionalProperties.get(CLIENT_PACKAGE)); } else { - additionalProperties.put(CLIENT_PACKAGE, clientPackage); + additionalProperties.put(CLIENT_PACKAGE, getClientPackage()); } + final String clientPackage = getClientPackage(); + final String clientPackagePath = clientPackage.replace(".", java.io.File.separator); + additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("modelDocPath", modelDocPath); supportingFiles.add(new SupportingFile("Configuration.mustache", - sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator), "Configuration.cs")); + sourceFolder + File.separator + clientPackagePath, "Configuration.cs")); supportingFiles.add(new SupportingFile("ApiClient.mustache", - sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator), "ApiClient.cs")); + sourceFolder + File.separator + clientPackagePath, "ApiClient.cs")); supportingFiles.add(new SupportingFile("ApiException.mustache", - sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator), "ApiException.cs")); + sourceFolder + File.separator + clientPackagePath, "ApiException.cs")); supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor", "packages.config")); supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); } + @Override + public String apiPackage() { + return packageName + ".Api"; + } + + @Override + public String modelPackage() { + return packageName + ".Model"; + } + + public String getClientPackage(){ + return packageName + ".Client"; + } + public void setClientPackage(String clientPackage) { this.clientPackage = clientPackage; } - public void setPackageName(String packageName) { - this.packageName = packageName; - } - - public void setPackageVersion(String packageVersion) { - this.packageVersion = packageVersion; - } - @Override public CodegenType getTag() { return CodegenType.CLIENT; @@ -171,14 +113,6 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege return "Generates a C# .Net 2.0 client library."; } - @Override - public String escapeReservedWord(String name) { - if(this.reservedWordsMappings().containsKey(name)) { - return this.reservedWordsMappings().get(name); - } - return "_" + name; - } - @Override public String apiFileFolder() { return outputFolder + File.separator + sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar); @@ -189,143 +123,6 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege return outputFolder + File.separator + sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar); } - @Override - public String toVarName(String name) { - // replace - with _ e.g. created-at => created_at - name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. - - // if it's all uppper case, do nothing - if (name.matches("^[A-Z_]*$")) { - return name; - } - - // camelize the variable name - // pet_id => PetId - name = camelize(name); - - // for reserved word or word starting with number, append _ - if (isReservedWord(name) || name.matches("^\\d.*")) { - name = escapeReservedWord(name); - } - - return name; - } - - @Override - public String toParamName(String name) { - // replace - with _ e.g. created-at => created_at - name = name.replaceAll("-", "_"); - - // if it's all uppper case, do nothing - if (name.matches("^[A-Z_]*$")) { - return name; - } - - // camelize(lower) the variable name - // pet_id => petId - name = camelize(name, true); - - // for reserved word or word starting with number, append _ - if (isReservedWord(name) || name.matches("^\\d.*")) { - name = escapeReservedWord(name); - } - - return name; - } - - @Override - public String toModelName(String name) { - if (!StringUtils.isEmpty(modelNamePrefix)) { - name = modelNamePrefix + "_" + name; - } - - if (!StringUtils.isEmpty(modelNameSuffix)) { - name = name + "_" + modelNameSuffix; - } - - name = sanitizeName(name); - - // model name cannot use reserved keyword, e.g. return - if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); - name = "model_" + name; // e.g. return => ModelReturn (after camelize) - } - - // model name starts with number - if (name.matches("^\\d.*")) { - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); - name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) - } - - // camelize the model name - // phone_number => PhoneNumber - return camelize(name); - } - - @Override - public String toModelFilename(String name) { - // should be the same as the model name - return toModelName(name); - } - - - @Override - public String getTypeDeclaration(Property p) { - if (p instanceof ArrayProperty) { - ArrayProperty ap = (ArrayProperty) p; - Property inner = ap.getItems(); - return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">"; - } else if (p instanceof MapProperty) { - MapProperty mp = (MapProperty) p; - Property inner = mp.getAdditionalProperties(); - - return getSwaggerType(p) + ""; - } - return super.getTypeDeclaration(p); - } - - @Override - public String getSwaggerType(Property p) { - String swaggerType = super.getSwaggerType(p); - String type = null; - if (typeMapping.containsKey(swaggerType.toLowerCase())) { - type = typeMapping.get(swaggerType.toLowerCase()); - if (languageSpecificPrimitives.contains(type)) { - return type; - } - } else { - type = swaggerType; - } - return toModelName(type); - } - - @Override - public String toOperationId(String operationId) { - // throw exception if method name is empty (should not occur as an auto-generated method name will be used) - if (StringUtils.isEmpty(operationId)) { - throw new RuntimeException("Empty method name (operationId) not allowed"); - } - - // method name cannot use reserved keyword, e.g. return - if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId))); - operationId = "call_" + operationId; - } - - return camelize(sanitizeName(operationId)); - } - - @Override - public String escapeQuotationMark(String input) { - // remove " to avoid code injection - return input.replace("\"", ""); - } - - @Override - public String escapeUnsafeCharacters(String input) { - return input.replace("*/", "*_/").replace("/*", "/_*"); - } - @Override public String apiDocFileFolder() { return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java index 79db0d1ad25..6aa7ab6ccaa 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java @@ -29,10 +29,13 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod public static final String NPM_VERSION = "npmVersion"; public static final String NPM_REPOSITORY = "npmRepository"; public static final String SNAPSHOT = "snapshot"; + public static final String USE_OPAQUE_TOKEN = "useOpaqueToken"; + public static final String INJECTION_TOKEN = "injectionToken"; protected String npmName = null; protected String npmVersion = "1.0.0"; protected String npmRepository = null; + protected String injectionToken = "InjectionToken"; public TypeScriptAngular2ClientCodegen() { super(); @@ -52,6 +55,7 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); + this.cliOptions.add(new CliOption(USE_OPAQUE_TOKEN, "When setting this property to true, OpaqueToken is used instead of InjectionToken", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); } @Override @@ -86,6 +90,11 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod if(additionalProperties.containsKey(NPM_NAME)) { addNpmPackageGeneration(); } + + if(additionalProperties.containsKey(USE_OPAQUE_TOKEN) && Boolean.valueOf(additionalProperties.get(USE_OPAQUE_TOKEN).toString())) { + this.setOpaqueToken(); + } + additionalProperties.put(INJECTION_TOKEN, this.injectionToken); } private void addNpmPackageGeneration() { @@ -320,4 +329,8 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod String name = filename.substring((modelPackage() + "/").length()); return camelize(name); } + + public void setOpaqueToken() { + this.injectionToken = "OpaqueToken"; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/utils/ImplementationVersion.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/utils/ImplementationVersion.java new file mode 100644 index 00000000000..7c04b065216 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/utils/ImplementationVersion.java @@ -0,0 +1,13 @@ +package io.swagger.codegen.utils; + +public class ImplementationVersion { + public static String read() { + // Assumes this version is required at runtime. This could be modified to use a properties file like the CLI. + String compiledVersion = ImplementationVersion.class.getPackage().getImplementationVersion(); + if(compiledVersion != null) { + return compiledVersion; + } + + return "unset"; + } +} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache index 66b73539ca1..1371e29c5d9 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/api.mustache @@ -16,9 +16,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -{{^useSpringCloudClient}} -import java.io.IOException; -{{/useSpringCloudClient}} import java.util.List; {{#async}} @@ -43,31 +40,20 @@ public interface {{classname}} { }{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} }) @ApiResponses(value = { {{#responses}} @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} }) - {{#implicitHeaders}} - @ApiImplicitParams({ + {{#implicitHeaders}}@ApiImplicitParams({ {{#headerParams}}{{>implicitHeader}}{{/headerParams}} - }) - {{/implicitHeaders}} + }){{/implicitHeaders}} @RequestMapping(value = "{{{path}}}",{{#singleContentTypes}} produces = "{{{vendorExtensions.x-accepts}}}", consumes = "{{{vendorExtensions.x-contentType}}}",{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}} produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}} consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}} method = RequestMethod.{{httpMethod}}) -{{#useSpringCloudClient}} {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} { // do some magic! return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}}; }{{/jdk8}} -{{/useSpringCloudClient}} -{{^useSpringCloudClient}} - {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}} @RequestHeader("Accept") String accept){{#examples}}{{#-first}} throws IOException{{/-first}}{{/examples}}{{^jdk8}};{{/jdk8}}{{#jdk8}} { - // do some magic! - return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}}; - }{{/jdk8}} - -{{/useSpringCloudClient}} {{/operation}} } {{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache index bef1835b9a2..b952cd6f51e 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/apiController.mustache @@ -21,12 +21,7 @@ import org.springframework.web.multipart.MultipartFile; import java.util.List; {{#async}} import java.util.concurrent.Callable; -{{/async}} -{{/jdk8-no-delegate}} -{{^useSpringCloudClient}} -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; -{{/useSpringCloudClient}} +{{/async}}{{/jdk8-no-delegate}} {{#useBeanValidation}} import javax.validation.constraints.*; import javax.validation.Valid; @@ -35,72 +30,27 @@ import javax.validation.Valid; @Controller {{#operations}} public class {{classname}}Controller implements {{classname}} { - private final ObjectMapper objectMapper; - - public {{classname}}Controller(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - {{#isDelegate}} private final {{classname}}Delegate delegate; @org.springframework.beans.factory.annotation.Autowired public {{classname}}Controller({{classname}}Delegate delegate) { this.delegate = delegate; - } + }{{/isDelegate}} -{{/isDelegate}} -{{^jdk8-no-delegate}} -{{#operation}} - public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}, - {{/allParams}}@RequestHeader("Accept") String accept){{#examples}}{{#-first}} throws IOException{{/-first}}{{/examples}} { - // do some magic! -{{#useSpringCloudClient}} - {{^isDelegate}} - {{^async}} - return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); - {{/async}} - {{#async}} +{{^jdk8-no-delegate}}{{#operation}} + public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, + {{/hasMore}}{{/allParams}}) { + // do some magic!{{^isDelegate}}{{^async}} + return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);{{/async}}{{#async}} return new CallablereturnTypes}}>>() { @Override public ResponseEntity<{{>returnTypes}}> call() throws Exception { return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); } - }; - {{/async}} - {{/isDelegate}} - {{#isDelegate}} - return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - {{/isDelegate}} -{{/useSpringCloudClient}} -{{^useSpringCloudClient}} - {{^isDelegate}} - {{^async}} - {{#examples}} - - if (accept != null && accept.contains("{{{contentType}}}")) { - return new ResponseEntity<{{>returnTypes}}>(objectMapper.readValue("{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}", {{>exampleReturnTypes}}.class), HttpStatus.OK); - } - - {{/examples}} - return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); - {{/async}} - {{#async}} - return new CallablereturnTypes}}>>() { - @Override - public ResponseEntity<{{>returnTypes}}> call() throws Exception { - return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK); - } - }; - {{/async}} - {{/isDelegate}} - {{#isDelegate}} - return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - {{/isDelegate}} -{{/useSpringCloudClient}} + };{{/async}}{{/isDelegate}}{{#isDelegate}} + return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{/isDelegate}} } - -{{/operation}} -{{/jdk8-no-delegate}} +{{/operation}}{{/jdk8-no-delegate}} } {{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidation.mustache b/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidation.mustache index f6b013abc98..3e4ef612a4c 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidation.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpring/beanValidation.mustache @@ -1,5 +1,6 @@ {{#required}} @NotNull -{{/required}} +{{/required}}{{#isContainer}}{{^isPrimitiveType}}{{^isEnum}} + @Valid{{/isEnum}}{{/isPrimitiveType}}{{/isContainer}}{{#isNotContainer}}{{^isPrimitiveType}} + @Valid{{/isPrimitiveType}}{{/isNotContainer}} {{>beanValidationCore}} - @Valid diff --git a/modules/swagger-codegen/src/main/resources/cpprest/cmake-lists.mustache b/modules/swagger-codegen/src/main/resources/cpprest/cmake-lists.mustache new file mode 100644 index 00000000000..c0ad03eaf83 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/cpprest/cmake-lists.mustache @@ -0,0 +1,49 @@ +# +# {{{appName}}} +# {{{appDescription}}} +# +# OpenAPI spec version: 1.0.0 +# +# https://github.com/swagger-api/swagger-codegen.git +# +# NOTE: Auto generated by the swagger code generator program. + +cmake_minimum_required (VERSION 2.8) + +#PROJECT's NAME +project(CppRestSwaggerClient) + + +# THE LOCATION OF OUTPUT BINARIES +set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_DIR}) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +# BUILD TYPE +message("A ${CMAKE_BUILD_TYPE} build configuration is detected") + +# Update require components as necessary +#find_package(Boost 1.45.0 REQUIRED COMPONENTS ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) + +# build and set path to cpp rest sdk +#set(CPPREST_ROOT ${PROJECT_SOURCE_DIR}/../../../developmentTools/3rdParty/cpprest) +set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include) +set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib) + +if( NOT DEFINED CPPREST_ROOT ) + message( FATAL_ERROR "Failed to find cpprest SDK (or missing components). Double check that \"CPPREST_ROOT\" is properly set") +endif( NOT DEFINED CPPREST_ROOT ) + +include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR}) + +#SUPPORTING FILES +set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData") +#SOURCE FILES +file(GLOB SOURCE_FILES "api/*" "model/*") + +add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES}) diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache index 8c5279b6c35..875fdcc09da 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache @@ -122,6 +122,10 @@ namespace {{packageName}}.Client String contentType) { var request = new RestRequest(path, method); + {{#netStandard}} + // disable ResetSharp.Portable built-in serialization + request.Serializer = null; + {{/netStandard}} // add path parameter, if any foreach(var param in pathParams) @@ -161,11 +165,21 @@ namespace {{packageName}}.Client { if (postBody.GetType() == typeof(String)) { + {{#netStandard}} + request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = "application/json" }); + {{/netStandard}} + {{^netStandard}} request.AddParameter("application/json", postBody, ParameterType.RequestBody); + {{/netStandard}} } else if (postBody.GetType() == typeof(byte[])) { + {{#netStandard}} + request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = contentType }); + {{/netStandard}} + {{^netStandard}} request.AddParameter(contentType, postBody, ParameterType.RequestBody); + {{/netStandard}} } } diff --git a/modules/swagger-codegen/src/main/resources/csharp/Project.mustache b/modules/swagger-codegen/src/main/resources/csharp/Project.mustache index f238b8059e1..1f3749d5af2 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Project.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Project.mustache @@ -88,7 +88,10 @@ {{/netStandard}} - + + + + {{^netStandard}} diff --git a/modules/swagger-codegen/src/main/resources/erlang-server/rebar.config.mustache b/modules/swagger-codegen/src/main/resources/erlang-server/rebar.config.mustache index 1c7f7d922e9..1d01cefa83b 100644 --- a/modules/swagger-codegen/src/main/resources/erlang-server/rebar.config.mustache +++ b/modules/swagger-codegen/src/main/resources/erlang-server/rebar.config.mustache @@ -1,4 +1,4 @@ {deps, [ - {jsx, {git, "https://github.com/talentdeficit/jsx.git", {branch, "v2.8.0"}}}, + {jsx, {git, "https://github.com/talentdeficit/jsx.git", {tag, "2.8.2"}}}, {jesse, {git, "https://github.com/for-GET/jesse.git", {tag, "1.4.0"}}} ]}. diff --git a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache new file mode 100644 index 00000000000..8f0f1167151 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache @@ -0,0 +1,361 @@ +partial_header}} +/** + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +/** + * ApiClient Class Doc Comment + * + * @category Class + * @package {{invokerPackage}} + * @author Swagger Codegen team + * @link https://github.com/swagger-api/swagger-codegen + */ +class ApiClient +{ + public static $PATCH = "PATCH"; + public static $POST = "POST"; + public static $GET = "GET"; + public static $HEAD = "HEAD"; + public static $OPTIONS = "OPTIONS"; + public static $PUT = "PUT"; + public static $DELETE = "DELETE"; + + /** + * Configuration + * + * @var Configuration + */ + protected $config; + + /** + * Object Serializer + * + * @var ObjectSerializer + */ + protected $serializer; + + /** + * Constructor of the class + * + * @param Configuration $config config for this ApiClient + */ + public function __construct(\{{invokerPackage}}\Configuration $config = null) + { + if ($config === null) { + $config = Configuration::getDefaultConfiguration(); + } + + $this->config = $config; + $this->serializer = new ObjectSerializer(); + } + + /** + * Get the config + * + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Get the serializer + * + * @return ObjectSerializer + */ + public function getSerializer() + { + return $this->serializer; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->config->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->config->getApiKey($apiKeyIdentifier); + + if (!isset($apiKey)) { + return null; + } + + if (isset($prefix)) { + $keyWithPrefix = $prefix." ".$apiKey; + } else { + $keyWithPrefix = $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Make the HTTP call (Sync) + * + * @param string $resourcePath path to method endpoint + * @param string $method method to call + * @param array $queryParams parameters to be place in query URL + * @param array $postData parameters to be placed in POST body + * @param array $headerParams parameters to be place in request header + * @param string $responseType expected response type of the endpoint + * @param string $endpointPath path to method endpoint before expanding parameters + * + * @throws \{{invokerPackage}}\ApiException on a non 2xx response + * @return mixed + */ + public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null) + { + $headers = []; + + // construct the http header + $headerParams = array_merge( + (array)$this->config->getDefaultHeaders(), + (array)$headerParams + ); + + foreach ($headerParams as $key => $val) { + $headers[] = "$key: $val"; + } + + // form data + if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers, true)) { + $postData = http_build_query($postData); + } elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers, true)) { // json model + $postData = json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($postData)); + } + + $url = $this->config->getHost() . $resourcePath; + + $curl = curl_init(); + // set timeout, if needed + if ($this->config->getCurlTimeout() !== 0) { + curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout()); + } + // set connect timeout, if needed + if ($this->config->getCurlConnectTimeout() != 0) { + curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this->config->getCurlConnectTimeout()); + } + + // return the result on success, rather than just true + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + // disable SSL verification, if needed + if ($this->config->getSSLVerification() === false) { + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); + } + + if ($this->config->getCurlProxyHost()) { + curl_setopt($curl, CURLOPT_PROXY, $this->config->getCurlProxyHost()); + } + + if ($this->config->getCurlProxyPort()) { + curl_setopt($curl, CURLOPT_PROXYPORT, $this->config->getCurlProxyPort()); + } + + if ($this->config->getCurlProxyType()) { + curl_setopt($curl, CURLOPT_PROXYTYPE, $this->config->getCurlProxyType()); + } + + if ($this->config->getCurlProxyUser()) { + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->config->getCurlProxyUser() . ':' .$this->config->getCurlProxyPassword()); + } + + if (!empty($queryParams)) { + $url = ($url . '?' . http_build_query($queryParams)); + } + + if ($this->config->getAllowEncoding()) { + curl_setopt($curl, CURLOPT_ENCODING, ''); + } + + if ($method === self::$POST) { + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } elseif ($method === self::$HEAD) { + curl_setopt($curl, CURLOPT_NOBODY, true); + } elseif ($method === self::$OPTIONS) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } elseif ($method === self::$PATCH) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } elseif ($method === self::$PUT) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } elseif ($method === self::$DELETE) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } elseif ($method !== self::$GET) { + throw new ApiException('Method ' . $method . ' is not recognized.'); + } + curl_setopt($curl, CURLOPT_URL, $url); + + // Set user agent + curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent()); + + // debugging for curl + if ($this->config->getDebug()) { + error_log("[DEBUG] HTTP Request body ~BEGIN~".PHP_EOL.print_r($postData, true).PHP_EOL."~END~".PHP_EOL, 3, $this->config->getDebugFile()); + + curl_setopt($curl, CURLOPT_VERBOSE, 1); + curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a')); + } else { + curl_setopt($curl, CURLOPT_VERBOSE, 0); + } + + // obtain the HTTP response headers + curl_setopt($curl, CURLOPT_HEADER, 1); + + // Make the request + $response = curl_exec($curl); + $http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE); + $http_header = $this->httpParseHeaders(substr($response, 0, $http_header_size)); + $http_body = substr($response, $http_header_size); + $response_info = curl_getinfo($curl); + + // debug HTTP response body + if ($this->config->getDebug()) { + error_log("[DEBUG] HTTP Response body ~BEGIN~".PHP_EOL.print_r($http_body, true).PHP_EOL."~END~".PHP_EOL, 3, $this->config->getDebugFile()); + } + + // Handle the response + if ($response_info['http_code'] === 0) { + $curl_error_message = curl_error($curl); + + // curl_exec can sometimes fail but still return a blank message from curl_error(). + if (!empty($curl_error_message)) { + $error_message = "API call to $url failed: $curl_error_message"; + } else { + $error_message = "API call to $url failed, but for an unknown reason. " . + "This could happen if you are disconnected from the network."; + } + + $exception = new ApiException($error_message, 0, null, null); + $exception->setResponseObject($response_info); + throw $exception; + } elseif ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) { + // return raw body if response is a file + if ($responseType === '\SplFileObject' || $responseType === 'string') { + return [$http_body, $response_info['http_code'], $http_header]; + } + + $data = json_decode($http_body); + if (json_last_error() > 0) { // if response is a string + $data = $http_body; + } + } else { + $data = json_decode($http_body); + if (json_last_error() > 0) { // if response is a string + $data = $http_body; + } + + throw new ApiException( + "[".$response_info['http_code']."] Error connecting to the API ($url)", + $response_info['http_code'], + $http_header, + $data + ); + } + return [$data, $response_info['http_code'], $http_header]; + } + + /** + * Return the header 'Accept' based on an array of Accept provided + * + * @param string[] $accept Array of header + * + * @return string Accept (e.g. application/json) + */ + public function selectHeaderAccept($accept) + { + if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) { + return null; + } elseif (preg_grep("/application\/json/i", $accept)) { + return 'application/json'; + } else { + return implode(',', $accept); + } + } + + /** + * Return the content type based on an array of content-type provided + * + * @param string[] $content_type Array fo content-type + * + * @return string Content-Type (e.g. application/json) + */ + public function selectHeaderContentType($content_type) + { + if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $content_type)) { + return 'application/json'; + } else { + return implode(',', $content_type); + } + } + + /** + * Return an array of HTTP response headers + * + * @param string $raw_headers A string of raw HTTP response headers + * + * @return string[] Array of HTTP response heaers + */ + protected function httpParseHeaders($raw_headers) + { + // ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986 + $headers = []; + $key = ''; + + foreach (explode("\n", $raw_headers) as $h) { + $h = explode(':', $h, 2); + + if (isset($h[1])) { + if (!isset($headers[$h[0]])) { + $headers[$h[0]] = trim($h[1]); + } elseif (is_array($headers[$h[0]])) { + $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]); + } else { + $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]); + } + + $key = $h[0]; + } else { + if (substr($h[0], 0, 1) === "\t") { + $headers[$key] .= "\r\n\t".trim($h[0]); + } elseif (!$key) { + $headers[0] = trim($h[0]); + } + trim($h[0]); + } + } + + return $headers; + } +} diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 253b171cefd..a84334989bf 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -88,7 +88,7 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ - public function {{operationId}}({{#allParams}}${{paramName}}{{^required}} = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + public function {{operationId}}({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} return $response;{{/returnType}} @@ -110,7 +110,7 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return array of {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) */ - public function {{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{^required}} = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + public function {{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { {{#allParams}} {{#required}} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache index 63f88d55911..58792c57e3f 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/api-body.mustache @@ -90,7 +90,8 @@ void HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "{{httpMethod}}"); - {{#formParams}}if ({{paramName}} != nullptr) { + {{#formParams}} + if ({{paramName}} != nullptr) { {{^isFile}}input.add_var("{{baseName}}", *{{paramName}});{{/isFile}}{{#isFile}}input.add_file("{{baseName}}", (*{{paramName}}).local_filename, (*{{paramName}}).request_filename, (*{{paramName}}).mime_type);{{/isFile}} } {{/formParams}} @@ -125,6 +126,9 @@ void void {{classname}}::{{nickname}}Callback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -132,7 +136,8 @@ void msg = "Error: " + worker->error_str; } - {{#returnType}}{{#isListContainer}} + {{#returnType}} + {{#isListContainer}} {{{returnType}}} output = {{{defaultResponse}}}; QString json(worker->response); QByteArray array (json.toStdString().c_str()); @@ -148,12 +153,12 @@ void } {{/isListContainer}} - {{^isListContainer}}{{#returnTypeIsPrimitive}} + {{^isListContainer}} + {{#returnTypeIsPrimitive}} {{{returnType}}} output; // TODO add primitive output support {{/returnTypeIsPrimitive}} {{#isMapContainer}} {{{returnType}}} output = {{{defaultResponse}}}; - QString json(worker->response); QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); @@ -164,21 +169,21 @@ void setValue(&val, obj[key], "{{returnBaseType}}", ""); output->insert(key, *val); } - - {{/isMapContainer}} {{^isMapContainer}} - {{^returnTypeIsPrimitive}}QString json(worker->response); + {{^returnTypeIsPrimitive}} + QString json(worker->response); {{{returnType}}} output = static_cast<{{{returnType}}}>(create(json, QString("{{{returnBaseType}}}"))); {{/returnTypeIsPrimitive}} {{/isMapContainer}} - {{/isListContainer}}{{/returnType}} - + {{/isListContainer}} + {{/returnType}} worker->deleteLater(); - {{#returnType}}emit {{nickname}}Signal(output);{{/returnType}} - {{^returnType}}emit {{nickname}}Signal();{{/returnType}} + emit {{nickname}}Signal({{#returnType}}output{{/returnType}}); + emit {{nickname}}SignalE({{#returnType}}output, {{/returnType}}error_type, error_str); } + {{/operation}} {{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache b/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache index 91868201b9e..3eaa7a98112 100644 --- a/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache +++ b/modules/swagger-codegen/src/main/resources/qt5cpp/api-header.mustache @@ -32,6 +32,8 @@ private: signals: {{#operations}}{{#operation}}void {{nickname}}Signal({{#returnType}}{{{returnType}}} summary{{/returnType}}); {{/operation}}{{/operations}} + {{#operations}}{{#operation}}void {{nickname}}SignalE({{#returnType}}{{{returnType}}} summary, {{/returnType}}QNetworkReply::NetworkError error_type, QString& error_str); + {{/operation}}{{/operations}} }; {{#cppNamespaceDeclarations}} diff --git a/modules/swagger-codegen/src/main/resources/swift3/AlamofireImplementations.mustache b/modules/swagger-codegen/src/main/resources/swift3/AlamofireImplementations.mustache index df9256c812b..108eea11c25 100644 --- a/modules/swagger-codegen/src/main/resources/swift3/AlamofireImplementations.mustache +++ b/modules/swagger-codegen/src/main/resources/swift3/AlamofireImplementations.mustache @@ -4,6 +4,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire class AlamofireRequestBuilderFactory: RequestBuilderFactory { diff --git a/modules/swagger-codegen/src/main/resources/swift3/Extensions.mustache b/modules/swagger-codegen/src/main/resources/swift3/Extensions.mustache index a3826ed7d11..df8d6b5581a 100644 --- a/modules/swagger-codegen/src/main/resources/swift3/Extensions.mustache +++ b/modules/swagger-codegen/src/main/resources/swift3/Extensions.mustache @@ -4,6 +4,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire{{#usePromiseKit}} import PromiseKit{{/usePromiseKit}} diff --git a/modules/swagger-codegen/src/main/resources/swift3/api.mustache b/modules/swagger-codegen/src/main/resources/swift3/api.mustache index ace52c29bba..09b65bef561 100644 --- a/modules/swagger-codegen/src/main/resources/swift3/api.mustache +++ b/modules/swagger-codegen/src/main/resources/swift3/api.mustache @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire{{#usePromiseKit}} import PromiseKit{{/usePromiseKit}}{{#useRxSwift}} import RxSwift{{/useRxSwift}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/apis.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/apis.mustache index fc1bce9ae8d..9d3e92349d0 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/apis.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/apis.mustache @@ -5,5 +5,5 @@ export * from './{{ classFilename }}'; import { {{ classname }} } from './{{ classFilename }}'; {{/operations}} {{/apis}} -export const APIS = [{{#apis}}{{#operations}}{{ classname }}, {{/operations}}{{/apis}}]; -{{/apiInfo}} \ No newline at end of file +export const APIS = [{{#apis}}{{#operations}}{{ classname }}{{/operations}}{{^-last}}, {{/-last}}{{/apis}}]; +{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache index 665c258e198..2a13f6049bc 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache @@ -81,7 +81,7 @@ export class {{classname}} { return undefined; } else { {{^isResponseFile}} - return response.json(); + return response.json() || {}; {{/isResponseFile}} {{#isResponseFile}} return response.blob(); diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache index 944e688f1b1..f5cdcf76e94 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache @@ -1,6 +1,6 @@ -import { OpaqueToken } from '@angular/core'; +import { {{{injectionToken}}} } from '@angular/core'; -export const BASE_PATH = new OpaqueToken('basePath'); +export const BASE_PATH = new {{{injectionToken}}}('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaModelTest.java index 7dfd05faca7..ff43379573f 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaModelTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaModelTest.java @@ -274,6 +274,42 @@ public class JavaModelTest { } + @Test(description = "convert a model with an array property with item name") + public void arrayModelWithItemNameTest() { + final Model model = new ModelImpl() + .description("a sample model") + .property("children", new ArrayProperty() + .description("an array property") + .items(new RefProperty("#/definitions/Child")) + .vendorExtension("x-item-name", "child")); + final DefaultCodegen codegen = new JavaClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("List", "Child")).size(), 2); + + final CodegenProperty property = cm.vars.get(0); + Assert.assertEquals(property.baseName, "children"); + Assert.assertEquals(property.complexType, "Child"); + Assert.assertEquals(property.getter, "getChildren"); + Assert.assertEquals(property.setter, "setChildren"); + Assert.assertEquals(property.datatype, "List"); + Assert.assertEquals(property.name, "children"); + Assert.assertEquals(property.defaultValue, "new ArrayList()"); + Assert.assertEquals(property.baseType, "List"); + Assert.assertEquals(property.containerType, "array"); + Assert.assertFalse(property.required); + Assert.assertTrue(property.isContainer); + Assert.assertFalse(property.isNotContainer); + + final CodegenProperty itemsProperty = property.items; + Assert.assertEquals(itemsProperty.baseName,"child"); + Assert.assertEquals(itemsProperty.name,"child"); + } + @Test(description = "convert an array model") public void arrayModelTest() { final Model model = new ArrayModel() diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java index b454130ca74..d8abde864ba 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java @@ -35,6 +35,7 @@ public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider .put(TypeScriptAngular2ClientCodegen.SNAPSHOT, Boolean.FALSE.toString()) .put(TypeScriptAngular2ClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) + .put(TypeScriptAngular2ClientCodegen.USE_OPAQUE_TOKEN, Boolean.FALSE.toString()) .build(); } diff --git a/pom.xml b/pom.xml index ceade9ccc48..1ca28a9ecf7 100644 --- a/pom.xml +++ b/pom.xml @@ -839,6 +839,7 @@ samples/server/petstore/jaxrs-cxf-cdi samples/server/petstore/jaxrs-cxf-non-spring-app + diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs index e9ded41c0a5..63555667e9a 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs @@ -216,7 +216,7 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", + "application/json", "*_/ ' =end - - " }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); @@ -239,7 +239,6 @@ namespace IO.Swagger.Api if (exception != null) throw exception; } - return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), null); @@ -283,7 +282,7 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", + "application/json", "*_/ ' =end - - " }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); @@ -306,7 +305,6 @@ namespace IO.Swagger.Api if (exception != null) throw exception; } - return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), null); diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index c5f0a9ec4ea..191ac9a560e 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -62,7 +62,10 @@ Contact: apiteam@swagger.io *_/ ' \" =end - - \\r\\n \\n \\r - + + + + diff --git a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs index ebb142f3847..e75bd5c3156 100644 --- a/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs +++ b/samples/client/petstore-security-test/csharp/SwaggerClient/src/IO.Swagger/Model/ModelReturn.cs @@ -119,7 +119,7 @@ namespace IO.Swagger.Model /// Validation context /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { + { yield break; } } diff --git a/samples/client/petstore-security-test/go/README.md b/samples/client/petstore-security-test/go/README.md index 4614c5a6cb4..fb06ea21610 100644 --- a/samples/client/petstore-security-test/go/README.md +++ b/samples/client/petstore-security-test/go/README.md @@ -68,5 +68,6 @@ Or via OAuth2 module to automaticly refresh tokens and perform user authenticati ``` ## Author + apiteam@swagger.io *_/ ' \" =end -- \\r\\n \\n \\r diff --git a/samples/client/petstore-security-test/go/configuration.go b/samples/client/petstore-security-test/go/configuration.go index f5eda77c282..a36b57c4b55 100644 --- a/samples/client/petstore-security-test/go/configuration.go +++ b/samples/client/petstore-security-test/go/configuration.go @@ -43,7 +43,6 @@ func NewConfiguration() *Configuration { BasePath: "https://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r", DefaultHeader: make(map[string]string), UserAgent: "Swagger-Codegen/1.0.0/go", - APIClient: &APIClient{}, } return cfg } diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.cpp b/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.cpp index 701dc946610..e7d60bc8ba0 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.cpp +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.cpp @@ -56,6 +56,9 @@ SWGFakeApi::testCodeInject */ ' " =end \r\n \n \r(QString* test_c void SWGFakeApi::testCodeInject */ ' " =end \r\n \n \rCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -63,12 +66,11 @@ SWGFakeApi::testCodeInject */ ' " =end \r\n \n \rCallback(HttpReq msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit testCodeInject */ ' " =end \r\n \n \rSignal(); + emit testCodeInject */ ' " =end \r\n \n \rSignalE(error_type, error_str); } + } diff --git a/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.h b/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.h index e0200dd91f0..5a28a4ce2c9 100644 --- a/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.h +++ b/samples/client/petstore-security-test/qt5cpp/client/SWGFakeApi.h @@ -40,6 +40,8 @@ private: signals: void testCodeInject */ ' " =end \r\n \n \rSignal(); + void testCodeInject */ ' " =end \r\n \n \rSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + }; } diff --git a/samples/client/petstore-security-test/typescript-angular2/api/FakeApi.ts b/samples/client/petstore-security-test/typescript-angular2/api/FakeApi.ts index 2aa8078185c..c7d4d3bc4f0 100644 --- a/samples/client/petstore-security-test/typescript-angular2/api/FakeApi.ts +++ b/samples/client/petstore-security-test/typescript-angular2/api/FakeApi.ts @@ -91,9 +91,9 @@ export class FakeApi { method: RequestMethod.Put, headers: headers, body: formParams.toString(), - search: queryParameters + search: queryParameters, + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); diff --git a/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts b/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts index 48198a4be00..ec12093e92c 100644 --- a/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts +++ b/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts @@ -81,7 +81,7 @@ export class FakeService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -123,10 +123,10 @@ export class FakeService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Put, headers: headers, - body: formParams, - search: queryParameters + body: formParams.toString(), + search: queryParameters, + withCredentials:this.configuration.withCredentials }); - // https://github.com/swagger-api/swagger-codegen/issues/4037 if (extraHttpRequestParams) { requestOptions = (Object).assign(requestOptions, extraHttpRequestParams); diff --git a/samples/client/petstore-security-test/typescript-angular2/configuration.ts b/samples/client/petstore-security-test/typescript-angular2/configuration.ts index df90b4829bb..0eed43fd575 100644 --- a/samples/client/petstore-security-test/typescript-angular2/configuration.ts +++ b/samples/client/petstore-security-test/typescript-angular2/configuration.ts @@ -1,24 +1,26 @@ export interface ConfigurationParameters { - apiKeys?: {[ key: string ]: string}; - username?: string; - password?: string; - accessToken?: string; - basePath?: string; + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + accessToken?: string; + basePath?: string; + withCredentials?: boolean; } export class Configuration { - apiKeys: {[ key: string ]: string}; - username: string; - password: string; - accessToken: string | (() => string); - basePath: string; + apiKeys: {[ key: string ]: string}; + username: string; + password: string; + accessToken: string | (() => string); + basePath: string; + withCredentials: boolean; - - constructor(configurationParameters: ConfigurationParameters = {}) { - this.apiKeys = configurationParameters.apiKeys; - this.username = configurationParameters.username; - this.password = configurationParameters.password; - this.accessToken = configurationParameters.accessToken; - this.basePath = configurationParameters.basePath; - } + constructor(configurationParameters: ConfigurationParameters = {}) { + this.apiKeys = configurationParameters.apiKeys; + this.username = configurationParameters.username; + this.password = configurationParameters.password; + this.accessToken = configurationParameters.accessToken; + this.basePath = configurationParameters.basePath; + this.withCredentials = configurationParameters.withCredentials; + } } diff --git a/samples/client/petstore-security-test/typescript-angular2/variables.ts b/samples/client/petstore-security-test/typescript-angular2/variables.ts index 944e688f1b1..b734b2e5918 100644 --- a/samples/client/petstore-security-test/typescript-angular2/variables.ts +++ b/samples/client/petstore-security-test/typescript-angular2/variables.ts @@ -1,6 +1,6 @@ -import { OpaqueToken } from '@angular/core'; +import { InjectionToken } from '@angular/core'; -export const BASE_PATH = new OpaqueToken('basePath'); +export const BASE_PATH = new InjectionToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', diff --git a/samples/client/petstore/cpprest/CMakeLists.txt b/samples/client/petstore/cpprest/CMakeLists.txt new file mode 100644 index 00000000000..de2e2851960 --- /dev/null +++ b/samples/client/petstore/cpprest/CMakeLists.txt @@ -0,0 +1,49 @@ +# +# Swagger Petstore +# This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. +# +# OpenAPI spec version: 1.0.0 +# +# https://github.com/swagger-api/swagger-codegen.git +# +# NOTE: Auto generated by the swagger code generator program. + +cmake_minimum_required (VERSION 2.8) + +#PROJECT's NAME +project(CppRestSwaggerClient) + + +# THE LOCATION OF OUTPUT BINARIES +set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_DIR}) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +# BUILD TYPE +message("A ${CMAKE_BUILD_TYPE} build configuration is detected") + +# Update require components as necessary +#find_package(Boost 1.45.0 REQUIRED COMPONENTS ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) + +# build and set path to cpp rest sdk +#set(CPPREST_ROOT ${PROJECT_SOURCE_DIR}/../../../developmentTools/3rdParty/cpprest) +set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include) +set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib) + +if( NOT DEFINED CPPREST_ROOT ) + message( FATAL_ERROR "Failed to find cpprest SDK (or missing components). Double check that \"CPPREST_ROOT\" is properly set") +endif( NOT DEFINED CPPREST_ROOT ) + +include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR}) + +#SUPPORTING FILES +set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData") +#SOURCE FILES +file(GLOB SOURCE_FILES "api/*" "model/*") + +add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES}) diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md index 6da90f0a55d..3e4b4c5e9cb 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md @@ -3,9 +3,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Code** | **int?** | | [optional] [default to null] -**Type** | **string** | | [optional] [default to null] -**Message** | **string** | | [optional] [default to null] +**Code** | **int?** | | [optional] +**Type** | **string** | | [optional] +**Message** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md index 14f99345925..20b56b1728c 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md @@ -3,8 +3,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long?** | | [optional] [default to null] -**Name** | **string** | | [optional] [default to null] +**Id** | **long?** | | [optional] +**Name** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md index 029b93a4fcf..32aeab388e5 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md @@ -3,12 +3,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long?** | | [optional] [default to null] -**PetId** | **long?** | | [optional] [default to null] -**Quantity** | **int?** | | [optional] [default to null] -**ShipDate** | **DateTime?** | | [optional] [default to null] -**Status** | **string** | Order Status | [optional] [default to null] -**Complete** | **bool?** | | [optional] [default to null] +**Id** | **long?** | | [optional] +**PetId** | **long?** | | [optional] +**Quantity** | **int?** | | [optional] +**ShipDate** | **DateTime?** | | [optional] +**Status** | **string** | Order Status | [optional] +**Complete** | **bool?** | | [optional] [default to false] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md index 0cfae6a3776..e83933d1c60 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md @@ -3,12 +3,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long?** | | [optional] [default to null] -**Category** | [**Category**](Category.md) | | [optional] [default to null] -**Name** | **string** | | [default to null] -**PhotoUrls** | **List<string>** | | [default to null] -**Tags** | [**List<Tag>**](Tag.md) | | [optional] [default to null] -**Status** | **string** | pet status in the store | [optional] [default to null] +**Id** | **long?** | | [optional] +**Category** | [**Category**](Category.md) | | [optional] +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | +**Tags** | [**List<Tag>**](Tag.md) | | [optional] +**Status** | **string** | pet status in the store | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md index bed83b157f1..256e46f5f15 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md @@ -73,7 +73,7 @@ No authorization required # **GetInventory** -> Dictionary GetInventory () +> Dictionary GetInventory () Returns pet inventories by status @@ -104,7 +104,7 @@ namespace Example try { // Returns pet inventories by status - Dictionary<String, int?> result = apiInstance.GetInventory(); + Dictionary<string, int?> result = apiInstance.GetInventory(); Debug.WriteLine(result); } catch (Exception e) @@ -121,7 +121,7 @@ This endpoint does not need any parameter. ### Return type -**Dictionary** +**Dictionary** ### Authorization diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md index f5ebda46b8c..64c5e6bdc72 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md @@ -3,8 +3,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long?** | | [optional] [default to null] -**Name** | **string** | | [optional] [default to null] +**Id** | **long?** | | [optional] +**Name** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md index fdf2b4020dc..fbea33c48b9 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md @@ -3,14 +3,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long?** | | [optional] [default to null] -**Username** | **string** | | [optional] [default to null] -**FirstName** | **string** | | [optional] [default to null] -**LastName** | **string** | | [optional] [default to null] -**Email** | **string** | | [optional] [default to null] -**Password** | **string** | | [optional] [default to null] -**Phone** | **string** | | [optional] [default to null] -**UserStatus** | **int?** | User Status | [optional] [default to null] +**Id** | **long?** | | [optional] +**Username** | **string** | | [optional] +**FirstName** | **string** | | [optional] +**LastName** | **string** | | [optional] +**Email** | **string** | | [optional] +**Password** | **string** | | [optional] +**Phone** | **string** | | [optional] +**UserStatus** | **int?** | User Status | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs index 0f9cb2339be..beda97853b1 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs @@ -20,8 +20,8 @@ namespace IO.Swagger.Api /// /// Returns pet inventories by status Returns a map of status codes to quantities /// - /// Dictionary<String, int?> - Dictionary GetInventory (); + /// Dictionary<string, int?> + Dictionary GetInventory (); /// /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions /// @@ -129,8 +129,8 @@ namespace IO.Swagger.Api /// /// Returns pet inventories by status Returns a map of status codes to quantities /// - /// Dictionary<String, int?> - public Dictionary GetInventory () + /// Dictionary<string, int?> + public Dictionary GetInventory () { @@ -155,7 +155,7 @@ namespace IO.Swagger.Api else if (((int)response.StatusCode) == 0) throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.ErrorMessage, response.ErrorMessage); - return (Dictionary) ApiClient.Deserialize(response.Content, typeof(Dictionary), response.Headers); + return (Dictionary) ApiClient.Deserialize(response.Content, typeof(Dictionary), response.Headers); } /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj index 6f55d545b7a..df95d7cfb58 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/IO.Swagger.csproj @@ -62,7 +62,10 @@ Contact: apiteam@swagger.io - + + + + diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/ApiClient.cs index 94356fb227f..ef2952a6f70 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/Client/ApiClient.cs @@ -115,6 +115,8 @@ namespace IO.Swagger.Client String contentType) { var request = new RestRequest(path, method); + // disable ResetSharp.Portable built-in serialization + request.Serializer = null; // add path parameter, if any foreach(var param in pathParams) @@ -142,11 +144,11 @@ namespace IO.Swagger.Client { if (postBody.GetType() == typeof(String)) { - request.AddParameter("application/json", postBody, ParameterType.RequestBody); + request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = "application/json" }); } else if (postBody.GetType() == typeof(byte[])) { - request.AddParameter(contentType, postBody, ParameterType.RequestBody); + request.AddParameter(new Parameter { Value = postBody, Type = ParameterType.RequestBody, ContentType = contentType }); } } diff --git a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/IO.Swagger.csproj index 2429b4217d1..bfbb352b574 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClientNetStandard/src/IO.Swagger/IO.Swagger.csproj @@ -43,7 +43,10 @@ Contact: apiteam@swagger.io - + + + + diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj index 27f887c6aa9..3c33414c2c8 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.csproj @@ -64,7 +64,10 @@ Contact: apiteam@swagger.io - + + + + diff --git a/samples/client/petstore/go/go-petstore/pom.xml b/samples/client/petstore/go/go-petstore/pom.xml deleted file mode 100644 index 7680ed95cff..00000000000 --- a/samples/client/petstore/go/go-petstore/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - 4.0.0 - com.wordnik - Gopetstore - pom - 1.0.0 - Gopetstore - - - - maven-dependency-plugin - - - package - - copy-dependencies - - - ${project.build.directory} - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - go-get-testify - pre-integration-test - - exec - - - go - - get - github.com/stretchr/testify/assert - - - - - go-get-sling - pre-integration-test - - exec - - - go - - get - github.com/dghubble/sling - - - - - go-test - integration-test - - exec - - - go - - test - -v - - - - - - - - \ No newline at end of file diff --git a/samples/client/petstore/go/pom.xml b/samples/client/petstore/go/pom.xml index 2e72ae80068..b041afa0710 100644 --- a/samples/client/petstore/go/pom.xml +++ b/samples/client/petstore/go/pom.xml @@ -78,7 +78,7 @@ go get - github.com/go-resty/resty + gopkg.in/go-resty/resty.v0 diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index d7323321d98..9a983f958b5 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AdditionalPropertiesClass @@ -78,6 +79,7 @@ public class AdditionalPropertiesClass { * Get mapOfMapProperty * @return mapOfMapProperty **/ + @Valid @ApiModelProperty(value = "") public Map> getMapOfMapProperty() { return mapOfMapProperty; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Animal.java index ca33a257d33..af7c2daf669 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Animal.java @@ -22,6 +22,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Animal diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/AnimalFarm.java index 21032adf0b1..9c8a3a7fdb0 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -18,6 +18,7 @@ import io.swagger.client.model.Animal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AnimalFarm diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java index 75bd0164dcd..e51d17e3c56 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java @@ -23,6 +23,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfArrayOfNumberOnly @@ -49,6 +50,7 @@ public class ArrayOfArrayOfNumberOnly { * Get arrayArrayNumber * @return arrayArrayNumber **/ + @Valid @ApiModelProperty(value = "") public List> getArrayArrayNumber() { return arrayArrayNumber; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java index d037399a96d..7b0448e17a2 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java @@ -23,6 +23,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfNumberOnly @@ -49,6 +50,7 @@ public class ArrayOfNumberOnly { * Get arrayNumber * @return arrayNumber **/ + @Valid @ApiModelProperty(value = "") public List getArrayNumber() { return arrayNumber; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayTest.java index 534508a0835..c8e6c34fad4 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ArrayTest.java @@ -23,6 +23,7 @@ import io.swagger.client.model.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayTest @@ -81,6 +82,7 @@ public class ArrayTest { * Get arrayArrayOfInteger * @return arrayArrayOfInteger **/ + @Valid @ApiModelProperty(value = "") public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; @@ -107,6 +109,7 @@ public class ArrayTest { * Get arrayArrayOfModel * @return arrayArrayOfModel **/ + @Valid @ApiModelProperty(value = "") public List> getArrayArrayOfModel() { return arrayArrayOfModel; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Capitalization.java index b03ebaed250..b7c0586ae69 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Capitalization.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Capitalization diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Cat.java index 971388af39f..d2d8ad07529 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Cat.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Cat diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Category.java index b7da89545fc..838968d352d 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Category.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Category diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ClassModel.java index 0915926c744..a2ea2c32692 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ClassModel.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model with \"_class\" property diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Client.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Client.java index cc44c6d501c..e046f364f08 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Client.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Client.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Client diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Dog.java index c9a63bca370..414aa6a1327 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Dog.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Dog diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumArrays.java index 3a9974545c9..72cd250d347 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumArrays.java @@ -22,6 +22,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumArrays diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumClass.java index 91f1219cd1b..7f37782ca24 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumClass.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumClass.java @@ -15,6 +15,7 @@ package io.swagger.client.model; import java.util.Objects; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumTest.java index 385ae403e14..3861da7eca4 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/EnumTest.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.OuterEnum; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumTest @@ -197,6 +198,7 @@ public class EnumTest { * Get outerEnum * @return outerEnum **/ + @Valid @ApiModelProperty(value = "") public OuterEnum getOuterEnum() { return outerEnum; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/FormatTest.java index 3c78c6c336a..b5ba3dfb4c4 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/FormatTest.java @@ -24,6 +24,7 @@ import java.util.UUID; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FormatTest @@ -139,6 +140,7 @@ public class FormatTest { * @return number **/ @NotNull + @Valid @DecimalMin("32.1") @DecimalMax("543.2") @ApiModelProperty(required = true, value = "") public BigDecimal getNumber() { return number; @@ -253,6 +255,7 @@ public class FormatTest { * @return date **/ @NotNull + @Valid @ApiModelProperty(required = true, value = "") public LocalDate getDate() { return date; @@ -271,6 +274,7 @@ public class FormatTest { * Get dateTime * @return dateTime **/ + @Valid @ApiModelProperty(value = "") public OffsetDateTime getDateTime() { return dateTime; @@ -289,6 +293,7 @@ public class FormatTest { * Get uuid * @return uuid **/ + @Valid @ApiModelProperty(value = "") public UUID getUuid() { return uuid; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java index f9439425f59..b1988c06f2c 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * HasOnlyReadOnly diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/MapTest.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/MapTest.java index 129391addac..a521e3d57b4 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/MapTest.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MapTest @@ -83,6 +84,7 @@ public class MapTest { * Get mapMapOfString * @return mapMapOfString **/ + @Valid @ApiModelProperty(value = "") public Map> getMapMapOfString() { return mapMapOfString; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 9c4ab41f16a..d4d344023cb 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.UUID; import org.threeten.bp.OffsetDateTime; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MixedPropertiesAndAdditionalPropertiesClass @@ -50,6 +51,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * Get uuid * @return uuid **/ + @Valid @ApiModelProperty(value = "") public UUID getUuid() { return uuid; @@ -68,6 +70,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * Get dateTime * @return dateTime **/ + @Valid @ApiModelProperty(value = "") public OffsetDateTime getDateTime() { return dateTime; @@ -94,6 +97,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * Get map * @return map **/ + @Valid @ApiModelProperty(value = "") public Map getMap() { return map; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Model200Response.java index 90131c365db..05d5391c0da 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Model200Response.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name starting with number diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ModelApiResponse.java index d9625bfb628..fa0a45515c6 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ModelApiResponse diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ModelReturn.java index 6ad5207dddb..16c2823e2ae 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ModelReturn.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing reserved words diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Name.java index 877d20aaf54..da596d304f4 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Name.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name same as property name diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/NumberOnly.java index 8f447249e1d..76c50d3d9aa 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/NumberOnly.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * NumberOnly @@ -39,6 +40,7 @@ public class NumberOnly { * Get justNumber * @return justNumber **/ + @Valid @ApiModelProperty(value = "") public BigDecimal getJustNumber() { return justNumber; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Order.java index dafa6243f09..d5f57a15690 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Order.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.threeten.bp.OffsetDateTime; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Order @@ -141,6 +142,7 @@ public class Order { * Get shipDate * @return shipDate **/ + @Valid @ApiModelProperty(value = "") public OffsetDateTime getShipDate() { return shipDate; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/OuterEnum.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/OuterEnum.java index 75dd96ff168..12249b4b51d 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/OuterEnum.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/OuterEnum.java @@ -15,6 +15,7 @@ package io.swagger.client.model; import java.util.Objects; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Pet.java index 9d97d0e13fa..57ece972227 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Pet.java @@ -24,6 +24,7 @@ import io.swagger.client.model.Tag; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Pet @@ -108,6 +109,7 @@ public class Pet { * Get category * @return category **/ + @Valid @ApiModelProperty(value = "") public Category getCategory() { return category; @@ -177,6 +179,7 @@ public class Pet { * Get tags * @return tags **/ + @Valid @ApiModelProperty(value = "") public List getTags() { return tags; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index 8b6568795cb..22983092858 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ReadOnlyFirst diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/SpecialModelName.java index 8684e45fe91..28dff843680 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * SpecialModelName diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Tag.java index af2902fa877..1d15abd5a1e 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/Tag.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Tag diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/User.java index f34053f501e..72ea3a8e7fc 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/User.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * User diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 3d556753f47..2e938dc22fd 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -521,7 +521,7 @@ class FakeApi * @throws \InvalidArgumentException * @return void */ - public function testEnumParameters($enum_form_string_array = null, $enum_form_string = null, $enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null) + public function testEnumParameters($enum_form_string_array = null, $enum_form_string = '-efg', $enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null) { $this->testEnumParametersWithHttpInfo($enum_form_string_array, $enum_form_string, $enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double); } @@ -543,7 +543,7 @@ class FakeApi * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function testEnumParametersWithHttpInfo($enum_form_string_array = null, $enum_form_string = null, $enum_header_string_array = null, $enum_header_string = null, $enum_query_string_array = null, $enum_query_string = null, $enum_query_integer = null, $enum_query_double = null) + public function testEnumParametersWithHttpInfo($enum_form_string_array = null, $enum_form_string = '-efg', $enum_header_string_array = null, $enum_header_string = '-efg', $enum_query_string_array = null, $enum_query_string = '-efg', $enum_query_integer = null, $enum_query_double = null) { $resourcePath = '/fake'; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php new file mode 100644 index 00000000000..ce025591447 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php @@ -0,0 +1,371 @@ +config = $config; + $this->serializer = new ObjectSerializer(); + } + + /** + * Get the config + * + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Get the serializer + * + * @return ObjectSerializer + */ + public function getSerializer() + { + return $this->serializer; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->config->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->config->getApiKey($apiKeyIdentifier); + + if (!isset($apiKey)) { + return null; + } + + if (isset($prefix)) { + $keyWithPrefix = $prefix." ".$apiKey; + } else { + $keyWithPrefix = $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Make the HTTP call (Sync) + * + * @param string $resourcePath path to method endpoint + * @param string $method method to call + * @param array $queryParams parameters to be place in query URL + * @param array $postData parameters to be placed in POST body + * @param array $headerParams parameters to be place in request header + * @param string $responseType expected response type of the endpoint + * @param string $endpointPath path to method endpoint before expanding parameters + * + * @throws \Swagger\Client\ApiException on a non 2xx response + * @return mixed + */ + public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams, $responseType = null, $endpointPath = null) + { + $headers = []; + + // construct the http header + $headerParams = array_merge( + (array)$this->config->getDefaultHeaders(), + (array)$headerParams + ); + + foreach ($headerParams as $key => $val) { + $headers[] = "$key: $val"; + } + + // form data + if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers, true)) { + $postData = http_build_query($postData); + } elseif ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers, true)) { // json model + $postData = json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($postData)); + } + + $url = $this->config->getHost() . $resourcePath; + + $curl = curl_init(); + // set timeout, if needed + if ($this->config->getCurlTimeout() !== 0) { + curl_setopt($curl, CURLOPT_TIMEOUT, $this->config->getCurlTimeout()); + } + // set connect timeout, if needed + if ($this->config->getCurlConnectTimeout() != 0) { + curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $this->config->getCurlConnectTimeout()); + } + + // return the result on success, rather than just true + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + // disable SSL verification, if needed + if ($this->config->getSSLVerification() === false) { + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); + } + + if ($this->config->getCurlProxyHost()) { + curl_setopt($curl, CURLOPT_PROXY, $this->config->getCurlProxyHost()); + } + + if ($this->config->getCurlProxyPort()) { + curl_setopt($curl, CURLOPT_PROXYPORT, $this->config->getCurlProxyPort()); + } + + if ($this->config->getCurlProxyType()) { + curl_setopt($curl, CURLOPT_PROXYTYPE, $this->config->getCurlProxyType()); + } + + if ($this->config->getCurlProxyUser()) { + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->config->getCurlProxyUser() . ':' .$this->config->getCurlProxyPassword()); + } + + if (!empty($queryParams)) { + $url = ($url . '?' . http_build_query($queryParams)); + } + + if ($this->config->getAllowEncoding()) { + curl_setopt($curl, CURLOPT_ENCODING, ''); + } + + if ($method === self::$POST) { + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } elseif ($method === self::$HEAD) { + curl_setopt($curl, CURLOPT_NOBODY, true); + } elseif ($method === self::$OPTIONS) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "OPTIONS"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } elseif ($method === self::$PATCH) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } elseif ($method === self::$PUT) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } elseif ($method === self::$DELETE) { + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE"); + curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); + } elseif ($method !== self::$GET) { + throw new ApiException('Method ' . $method . ' is not recognized.'); + } + curl_setopt($curl, CURLOPT_URL, $url); + + // Set user agent + curl_setopt($curl, CURLOPT_USERAGENT, $this->config->getUserAgent()); + + // debugging for curl + if ($this->config->getDebug()) { + error_log("[DEBUG] HTTP Request body ~BEGIN~".PHP_EOL.print_r($postData, true).PHP_EOL."~END~".PHP_EOL, 3, $this->config->getDebugFile()); + + curl_setopt($curl, CURLOPT_VERBOSE, 1); + curl_setopt($curl, CURLOPT_STDERR, fopen($this->config->getDebugFile(), 'a')); + } else { + curl_setopt($curl, CURLOPT_VERBOSE, 0); + } + + // obtain the HTTP response headers + curl_setopt($curl, CURLOPT_HEADER, 1); + + // Make the request + $response = curl_exec($curl); + $http_header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE); + $http_header = $this->httpParseHeaders(substr($response, 0, $http_header_size)); + $http_body = substr($response, $http_header_size); + $response_info = curl_getinfo($curl); + + // debug HTTP response body + if ($this->config->getDebug()) { + error_log("[DEBUG] HTTP Response body ~BEGIN~".PHP_EOL.print_r($http_body, true).PHP_EOL."~END~".PHP_EOL, 3, $this->config->getDebugFile()); + } + + // Handle the response + if ($response_info['http_code'] === 0) { + $curl_error_message = curl_error($curl); + + // curl_exec can sometimes fail but still return a blank message from curl_error(). + if (!empty($curl_error_message)) { + $error_message = "API call to $url failed: $curl_error_message"; + } else { + $error_message = "API call to $url failed, but for an unknown reason. " . + "This could happen if you are disconnected from the network."; + } + + $exception = new ApiException($error_message, 0, null, null); + $exception->setResponseObject($response_info); + throw $exception; + } elseif ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) { + // return raw body if response is a file + if ($responseType === '\SplFileObject' || $responseType === 'string') { + return [$http_body, $response_info['http_code'], $http_header]; + } + + $data = json_decode($http_body); + if (json_last_error() > 0) { // if response is a string + $data = $http_body; + } + } else { + $data = json_decode($http_body); + if (json_last_error() > 0) { // if response is a string + $data = $http_body; + } + + throw new ApiException( + "[".$response_info['http_code']."] Error connecting to the API ($url)", + $response_info['http_code'], + $http_header, + $data + ); + } + return [$data, $response_info['http_code'], $http_header]; + } + + /** + * Return the header 'Accept' based on an array of Accept provided + * + * @param string[] $accept Array of header + * + * @return string Accept (e.g. application/json) + */ + public function selectHeaderAccept($accept) + { + if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) { + return null; + } elseif (preg_grep("/application\/json/i", $accept)) { + return 'application/json'; + } else { + return implode(',', $accept); + } + } + + /** + * Return the content type based on an array of content-type provided + * + * @param string[] $content_type Array fo content-type + * + * @return string Content-Type (e.g. application/json) + */ + public function selectHeaderContentType($content_type) + { + if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $content_type)) { + return 'application/json'; + } else { + return implode(',', $content_type); + } + } + + /** + * Return an array of HTTP response headers + * + * @param string $raw_headers A string of raw HTTP response headers + * + * @return string[] Array of HTTP response heaers + */ + protected function httpParseHeaders($raw_headers) + { + // ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986 + $headers = []; + $key = ''; + + foreach (explode("\n", $raw_headers) as $h) { + $h = explode(':', $h, 2); + + if (isset($h[1])) { + if (!isset($headers[$h[0]])) { + $headers[$h[0]] = trim($h[1]); + } elseif (is_array($headers[$h[0]])) { + $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]); + } else { + $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]); + } + + $key = $h[0]; + } else { + if (substr($h[0], 0, 1) === "\t") { + $headers[$key] .= "\r\n\t".trim($h[0]); + } elseif (!$key) { + $headers[0] = trim($h[0]); + } + trim($h[0]); + } + } + + return $headers; + } +} diff --git a/samples/client/petstore/powershell/PowerShellClient/.gitignore b/samples/client/petstore/powershell/PowerShellClient/.gitignore new file mode 100644 index 00000000000..d3f4f7b6f55 --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/.gitignore @@ -0,0 +1,185 @@ +# Ref: https://gist.github.com/kmorcinek/2710267 +# Download this file using PowerShell v3 under Windows with the following comand +# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# OS generated files # +.DS_Store* +ehthumbs.db +Icon? +Thumbs.db + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings +modulesbin/ +tempbin/ + +# EPiServer Site file (VPP) +AppData/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# vim +*.txt~ +*.swp +*.swo + +# svn +.svn + +# SQL Server files +**/App_Data/*.mdf +**/App_Data/*.ldf +**/App_Data/*.sdf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store + +# SASS Compiler cache +.sass-cache + +# Visual Studio 2014 CTP +**/*.sln.ide diff --git a/samples/client/petstore/powershell/PowerShellClient/Build.ps1 b/samples/client/petstore/powershell/PowerShellClient/Build.ps1 new file mode 100644 index 00000000000..814f5cfe872 --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/Build.ps1 @@ -0,0 +1,49 @@ +$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path +$ClientPath = "$ScriptDir\..\..\csharp\SwaggerClient" +$PublicPath = "$ScriptDir\src\IO.Swagger\Public" +$BinPath = "$ScriptDir\src\IO.Swagger\Bin" + +Start-Process -FilePath "$ClientPath\build.bat" -WorkingDirectory $ClientPath -Wait -NoNewWindow + +if (!(Test-Path "$ScriptDir\src\IO.Swagger\Bin" -PathType Container)) { + New-Item "$ScriptDir\src\IO.Swagger\Bin" -ItemType Directory > $null +} + +Copy-Item "$ClientPath\bin\*.dll" $BinPath + +$Manifest = @{ + Path = "$ScriptDir\src\IO.Swagger\IO.Swagger.psd1" + + Author = 'apiteam@swagger.io' + CompanyName = 'swagger.io' + Description = 'IO.Swagger - the PowerShell module for the Swagger Petstore' + + RootModule = 'IO.Swagger.psm1' + Guid = 'a27b908d-2a20-467f-bc32-af6f3a654ac5' # Has to be static, otherwise each new build will be considered different module + + PowerShellVersion = '3.0' + + RequiredAssemblies = Get-ChildItem "$BinPath\*.dll" | ForEach-Object { + Join-Path $_.Directory.Name $_.Name + } + + FunctionsToExport = Get-ChildItem "$PublicPath\*.ps1" | ForEach-Object { + $_.BaseName + } + + VariablesToExport = @() + AliasesToExport = @() + CmdletsToExport = @() + + # Should we use prefix to prevent command name collisions? + # https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/ + # + # Kirk Munro recommends against it: + # https://www.sapien.com/blog/2016/02/15/use-prefixes-to-prevent-command-name-collision/#comment-20820 + # + # If not, we'd need to generate functions name with prefix. + # + # DefaultCommandPrefix = 'PetStore' +} + +New-ModuleManifest @Manifest \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/README.md b/samples/client/petstore/powershell/PowerShellClient/README.md new file mode 100644 index 00000000000..89687fe9cf2 --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/README.md @@ -0,0 +1,148 @@ +# IO.Swagger - the PowerShell module for the Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +This PowerShell module is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: 1.0.0 +- SDK version: 1.0.0 +- Build package: io.swagger.codegen.languages.CSharpClientCodegen + + +## Frameworks supported +- PowerShell 3.0 or later +- .NET 4.0 or later + + +## Dependencies +- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later + +The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: +``` +Install-Package RestSharp +Install-Package Newtonsoft.Json +``` + +NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) + + +## Installation +Run the following command to generate the DLL +- [Windows] `build.ps1` + +Then import module from the `.\src\IO.Swagger` folder: +```posh +Import-Module -Name '.\src\IO.Swagger' +``` + +## Getting Started + +```posh +Set-ApiCredential -AccessToken 'YOUR_ACCESS_TOKEN' + +New-Pet -Id 1 -Name 'foo' -Category ( + New-Category -Id 2 -Name 'bar' +) -PhotoUrls @( + 'http://example.com/foo', + 'http://example.com/bar' +) -Tags ( + New-Tag -Id 3 -Name 'baz' +) -Status Available | Update-Pet + +Get-PetById -Id 1 +``` + + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user +*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + + +## Documentation for Models + + - [Model.AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [Model.Animal](docs/Animal.md) + - [Model.AnimalFarm](docs/AnimalFarm.md) + - [Model.ApiResponse](docs/ApiResponse.md) + - [Model.ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [Model.ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [Model.ArrayTest](docs/ArrayTest.md) + - [Model.Capitalization](docs/Capitalization.md) + - [Model.Cat](docs/Cat.md) + - [Model.Category](docs/Category.md) + - [Model.ClassModel](docs/ClassModel.md) + - [Model.Dog](docs/Dog.md) + - [Model.EnumArrays](docs/EnumArrays.md) + - [Model.EnumClass](docs/EnumClass.md) + - [Model.EnumTest](docs/EnumTest.md) + - [Model.FormatTest](docs/FormatTest.md) + - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [Model.List](docs/List.md) + - [Model.MapTest](docs/MapTest.md) + - [Model.MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model.Model200Response](docs/Model200Response.md) + - [Model.ModelClient](docs/ModelClient.md) + - [Model.ModelReturn](docs/ModelReturn.md) + - [Model.Name](docs/Name.md) + - [Model.NumberOnly](docs/NumberOnly.md) + - [Model.Order](docs/Order.md) + - [Model.OuterEnum](docs/OuterEnum.md) + - [Model.Pet](docs/Pet.md) + - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.Tag](docs/Tag.md) + - [Model.User](docs/User.md) + + + +## Documentation for Authorization + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/.gitignore b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/.gitignore new file mode 100644 index 00000000000..ba0782775ba --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/.gitignore @@ -0,0 +1,2 @@ +# Ignore module manifests +*.psd1 diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/IO.Swagger.psm1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/IO.Swagger.psm1 new file mode 100644 index 00000000000..e332eda7945 --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/IO.Swagger.psm1 @@ -0,0 +1,36 @@ +#region Import functions + +$FunctionsToExport = @() +$Folders = 'Public', 'Private' + +foreach ($Scope in $Folders) { + Get-ChildItem -LiteralPath ( + Join-Path -Path $PSScriptRoot -ChildPath $Scope + ) -File -Filter '*.ps1' | ForEach-Object { + $File = $_ + try { + Write-Verbose "Dotsourcing file: $File" + . $File.FullName + + switch ($Scope) { + 'Public' { + $FunctionsToExport += $File.BaseName + } + } + } catch { + throw "Can't import functions from file: $File" + } + } +} + +Export-ModuleMember -Function $FunctionsToExport + +#endregion + + +#region Initialize APIs + +'Creating object: IO.Swagger.Api.PetApi' | Write-Verbose +$Script:PetApi = New-Object -TypeName IO.Swagger.Api.PetApi -ArgumentList @($null) + +#endregion diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Private/Get-CommonParameters.ps1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Private/Get-CommonParameters.ps1 new file mode 100644 index 00000000000..6a047142f72 --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Private/Get-CommonParameters.ps1 @@ -0,0 +1,15 @@ +<# +.Synopsis + Helper function to get common parameters (Verbose, Debug, etc.) + +.Example + Get-CommonParameters +#> +function Get-CommonParameters { + function tmp { + [CmdletBinding()] + Param () + } + + (Get-Command -Name tmp -CommandType Function).Parameters.Keys +} \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Private/Out-DebugParameter.ps1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Private/Out-DebugParameter.ps1 new file mode 100644 index 00000000000..dd15a9e61ff --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Private/Out-DebugParameter.ps1 @@ -0,0 +1,38 @@ +<# +.Synopsis + Helper function to format debug parameter output. + +.Example + $PSBoundParameters | Out-DebugParameter | Write-Debug +#> +function Out-DebugParameter { + [CmdletBinding()] + Param ( + [Parameter(ValueFromPipeline = $true, Mandatory = $true)] + [AllowEmptyCollection()] + $InputObject + ) + + Begin { + $CommonParameters = Get-CommonParameters + } + + Process { + $InputObject.GetEnumerator() | Where-Object { + $CommonParameters -notcontains $_.Key + } | Format-Table -AutoSize -Property ( + @{ + Name = 'Parameter' + Expression = {$_.Key} + }, + @{ + Name = 'Value' + Expression = {$_.Value} + } + ) | Out-String -Stream | ForEach-Object { + if ($_.Trim()) { + $_ + } + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Get-PetById.ps1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Get-PetById.ps1 new file mode 100644 index 00000000000..5ab6422daba --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Get-PetById.ps1 @@ -0,0 +1,45 @@ +<# +.Synopsis + Find pet by ID. + +.Description + Find pet by ID. Returns a single pet. + +.Parameter Id + ID of pet to return. + +.Example + Get-PetById -Id 1 + +.Example + 1 | Get-PetById + +.Inputs + long + +.Outputs + IO.Swagger.Model.Pet + +.Notes + This function is automatically generated by the Swagger Codegen. + +.Link + https://github.com/swagger-api/swagger-codegen +#> +function Get-PetById { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [long] + ${Id} + ) + + Process { + 'Calling method: GetPetById' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.GetPetById( + ${Id} + ) + } +} \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Category.ps1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Category.ps1 new file mode 100644 index 00000000000..ebef2db528c --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Category.ps1 @@ -0,0 +1,52 @@ +<# +.Synopsis + Creates new IO.Swagger.Model.Category object. + +.Description + Creates new IO.Swagger.Model.Category object. + +.Parameter Id + ID. + +.Parameter Name + Name + +.Example + New-Category -Id 1 -Name 'foo' + +.Inputs + System.Nullable[long] + + System.String + +.Outputs + IO.Swagger.Model.Category + +.Notes + This function is automatically generated by the Swagger Codegen. + +.Link + https://github.com/swagger-api/swagger-codegen +#> +function New-Category { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[long]] + ${Id}, + + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [string] + ${Name} + ) + + Process { + 'Creating object: IO.Swagger.Model.Category' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Category -ArgumentList @( + ${Id}, + ${Name} + ) + } +} \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Pet.ps1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Pet.ps1 new file mode 100644 index 00000000000..3d34c49c7f0 --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Pet.ps1 @@ -0,0 +1,98 @@ +<# +.Synopsis + Creates new IO.Swagger.Model.Pet object. + +.Description + Creates new IO.Swagger.Model.Pet object. + +.Parameter Id + ID of pet. + +.Parameter Category + Category of pet. + +.Parameter Name + Name of pet. + +.Parameter PhotoUrls + PhotoUrls. + +.Parameter Tags + Tags + +.Parameter Status + Status. + +.Example + New-Pet -Id 1 -Name 'foo' -Category ( + New-Category -Id 2 -Name 'bar' + ) -PhotoUrls @( + 'http://example.com/foo', + 'http://example.com/bar' + ) -Tags ( + New-Tag -Id 3 -Name 'baz' + ) -Status 'Available' + +.Inputs + System.Nullable[long] + + IO.Swagger.Model.Category + + System.String + + System.Collections.Generic.List[string] + + System.Collections.Generic.List[IO.Swagger.Model.Tag] + + System.Nullable[IO.Swagger.Model.Pet+StatusEnum] + +.Outputs + +.Notes + This function is automatically generated by the Swagger Codegen. + +.Link + https://github.com/swagger-api/swagger-codegen +#> +function New-Pet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[long]] + ${Id}, + + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [IO.Swagger.Model.Category] + ${Category}, + + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [string] + ${Name}, + + [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [System.Collections.Generic.List[string]] + ${PhotoUrls}, + + [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)] + [System.Collections.Generic.List[IO.Swagger.Model.Tag]] + ${Tags}, + + [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[IO.Swagger.Model.Pet+StatusEnum]] + ${Status} + ) + + Process { + 'Creating object: IO.Swagger.Model.Pet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Pet -ArgumentList @( + ${Id}, + ${Category}, + ${Name}, + ${PhotoUrls}, + ${Tags}, + ${Status} + ) + } +} \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Tag.ps1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Tag.ps1 new file mode 100644 index 00000000000..9bb9b9ce657 --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Tag.ps1 @@ -0,0 +1,52 @@ +<# +.Synopsis + Creates new IO.Swagger.Model.Tag object. + +.Description + Creates new IO.Swagger.Model.Tag object. + +.Parameter Id + ID. + +.Parameter Name + Name + +.Example + New-Tag -Id 1 -Name 'foo' + +.Inputs + System.Nullable[long] + + System.String + +.Outputs + IO.Swagger.Model.Tag + +.Notes + This function is automatically generated by the Swagger Codegen. + +.Link + https://github.com/swagger-api/swagger-codegen +#> +function New-Tag { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] + [System.Nullable[long]] + ${Id}, + + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [string] + ${Name} + ) + + Process { + 'Creating object: IO.Swagger.Model.Tag' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + New-Object -TypeName IO.Swagger.Model.Tag -ArgumentList @( + ${Id}, + ${Name} + ) + } +} \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Set-ApiCredential.ps1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Set-ApiCredential.ps1 new file mode 100644 index 00000000000..4ce6880d72b --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Set-ApiCredential.ps1 @@ -0,0 +1,64 @@ +<# +.Synopsis + Set PetStore Authorization data. + +.Description + Set PetStore Authorization data. + +.Parameter ApiKey + API key. + +.Parameter ApiKeyPrefix + API Key prefix. + +.Parameter AccessToken + Access Token. + +.Example + Set-ApiCredential -ApiKey 'foo' + +.Example + Set-ApiCredential -ApiKey 'foo' -ApiPrefix 'Bearer' + +.Example + Set-ApiCredential -ApiKey 'foo' -ApiPrefix 'Bearer' + +.Example + Set-ApiCredential -AccessToken 'YOUR_ACCESS_TOKEN' +#> +function Set-ApiCredential { + [CmdletBinding(DefaultParameterSetName = 'ApiKey')] + Param ( + [Parameter(Position = 0, ParameterSetName = 'ApiKey')] + [string] + ${ApiKey}, + + [Parameter(Position = 1, ParameterSetName = 'ApiKey')] + [string] + ${ApiKeyPrefix}, + + [Parameter(Position = 2, ParameterSetName = 'AccessToken')] + [string] + ${AccessToken} + ) + + End { + if (${ApiKey}) { + ([IO.Swagger.Client.Configuration]::Default).ApiKey.Add( + 'api_key', + ${ApiKey} + ) + } + + if ($ApiKeyPrefix) { + ([IO.Swagger.Client.Configuration]::Default).ApiKeyPrefix.Add( + 'api_key', + ${ApiKeyPrefix} + ) + } + + if (${AccessToken}) { + ([IO.Swagger.Client.Configuration]::Default).AccessToken = ${AccessToken} + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-Pet.ps1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-Pet.ps1 new file mode 100644 index 00000000000..418e695741e --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-Pet.ps1 @@ -0,0 +1,44 @@ +<# +.Synopsis + Updates a pet in the store. + +.Description + Updates a pet in the store. + +.Parameter Pet + Pet. + +.Example + Update-Pet -Pet $Pet + +.Example + $Pet | Update-Pet + +.Inputs + IO.Swagger.Model.Pet + +.Outputs + +.Notes + This function is automatically generated by the Swagger Codegen. + +.Link + https://github.com/swagger-api/swagger-codegen +#> +function Update-Pet { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [IO.Swagger.Model.Pet] + ${Pet} + ) + + Process { + 'Calling method: UpdatePet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.UpdatePet( + ${Pet} + ) + } +} \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-PetUsingParameterSet.ps1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-PetUsingParameterSet.ps1 new file mode 100644 index 00000000000..143a4e5cfca --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-PetUsingParameterSet.ps1 @@ -0,0 +1,90 @@ +<# +.Synopsis + Updates a pet in the store. + +.Description + Updates a pet in the store. + +.Parameter Id + ID of pet to return. + +.Example + Update-PetUsingParameterSet -Id 1 -Name 'foo' -Status 'Available' + +.Example + Update-PetUsingParameterSet -Id 1 -Name 'foo' -Status 'Available' + +.Example + Update-PetUsingParameterSet -Pet $Pet + +.Example + $Pet | Update-PetUsingParameterSet + +.Inputs + System.Nullable[long] + + System.String + + System.String + + IO.Swagger.Model.Pet + +.Outputs + +.Notes + This function is automatically generated by the Swagger Codegen. + +.Link + https://github.com/swagger-api/swagger-codegen +#> + +function Update-PetUsingParameterSet { + [CmdletBinding(DefaultParameterSetName = 'UpdatePetWithForm')] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true, ParameterSetName = 'UpdatePetWithForm')] + [System.Nullable[long]] + ${Id}, + + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'UpdatePetWithForm')] + [string] + ${Name}, + + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'UpdatePetWithForm')] + [string] + ${Status}, + + [Parameter(Position = 0, ValueFromPipeline = $true, Mandatory = $true, ParameterSetName = 'UpdatePet')] + [IO.Swagger.Model.Pet] + ${Pet} + ) + + Process { + switch ($PSCmdlet.ParameterSetName) { + 'UpdatePetWithForm' { + 'Calling method: UpdatePetWithForm' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.UpdatePetWithForm( + ${Id}, + ${Name}, + ${Status} + ) + break + } + + 'UpdatePet' { + 'Calling method: UpdatePet' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.UpdatePet( + ${Pet} + ) + break + } + + default { + throw 'Invalid ParameterSet!' + } + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-PetWithForm.ps1 b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-PetWithForm.ps1 new file mode 100644 index 00000000000..0d79883b42e --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-PetWithForm.ps1 @@ -0,0 +1,55 @@ +<# +.Synopsis + Updates a pet in the store with form data. + +.Description + Updates a pet in the store with form data. + +.Parameter Id + ID of pet to return. + +.Example + Update-PetWithForm -Id 1 -Name 'foo' -Status 'Available' + +.Inputs + System.Nullable[long] + + System.String + + System.String + +.Outputs + +.Notes + This function is automatically generated by the Swagger Codegen. + +.Link + https://github.com/swagger-api/swagger-codegen +#> +function Update-PetWithForm { + [CmdletBinding()] + Param ( + [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [System.Nullable[long]] + ${Id}, + + [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] + [string] + ${Name}, + + [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] + [string] + ${Status} + ) + + Process { + 'Calling method: UpdatePetWithForm' | Write-Verbose + $PSBoundParameters | Out-DebugParameter | Write-Debug + + $Script:PetApi.UpdatePetWithForm( + ${Id}, + ${Name}, + ${Status} + ) + } +} \ No newline at end of file diff --git a/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/en-US/about_IO.Swagger.help.txt b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/en-US/about_IO.Swagger.help.txt new file mode 100644 index 00000000000..1a3e1fc2beb --- /dev/null +++ b/samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/en-US/about_IO.Swagger.help.txt @@ -0,0 +1,19 @@ +PSTOPIC + about_IO.Swagger + +SHORT DESCRIPTION + IO.Swagger - the PowerShell module for the Swagger Petstore + +LONG DESCRIPTION + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \ + + This PowerShell module is automatically generated by the Swagger Codegen project. + + * API version: 1.0.0 + * SDK version: 1.0.0 + * Build package: io.swagger.codegen.languages.CSharpClientCodegen + + Frameworks supported: + + * PowerShell 3.0+ + * .NET 4.0 or later \ No newline at end of file diff --git a/samples/client/petstore/qt5cpp/client/ApiResponse.cpp b/samples/client/petstore/qt5cpp/client/ApiResponse.cpp index 575a7bec9e9..2b152e06cfa 100644 --- a/samples/client/petstore/qt5cpp/client/ApiResponse.cpp +++ b/samples/client/petstore/qt5cpp/client/ApiResponse.cpp @@ -22,12 +22,7 @@ namespace Swagger { -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/ApiResponse.cpp - ApiResponse::ApiResponse(QString* json) { -======= -SWGApiResponse::SWGApiResponse(QString* json) { ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGApiResponse.cpp init(); this->fromJson(*json); } diff --git a/samples/client/petstore/qt5cpp/client/Category.cpp b/samples/client/petstore/qt5cpp/client/Category.cpp index 95a78e0bfdf..93f45934fca 100644 --- a/samples/client/petstore/qt5cpp/client/Category.cpp +++ b/samples/client/petstore/qt5cpp/client/Category.cpp @@ -22,12 +22,7 @@ namespace Swagger { -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Category.cpp - Category::Category(QString* json) { -======= -SWGCategory::SWGCategory(QString* json) { ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGCategory.cpp init(); this->fromJson(*json); } diff --git a/samples/client/petstore/qt5cpp/client/Category.h b/samples/client/petstore/qt5cpp/client/Category.h index c230d286911..1c1ef71b7da 100644 --- a/samples/client/petstore/qt5cpp/client/Category.h +++ b/samples/client/petstore/qt5cpp/client/Category.h @@ -11,11 +11,7 @@ */ /* -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Category.h * Category.h -======= - * SWGCategory.h ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGCategory.h * * A category for a pet */ diff --git a/samples/client/petstore/qt5cpp/client/Order.cpp b/samples/client/petstore/qt5cpp/client/Order.cpp index 4d7467bc608..c975c8529a6 100644 --- a/samples/client/petstore/qt5cpp/client/Order.cpp +++ b/samples/client/petstore/qt5cpp/client/Order.cpp @@ -22,12 +22,7 @@ namespace Swagger { -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Order.cpp - Order::Order(QString* json) { -======= -SWGOrder::SWGOrder(QString* json) { ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGOrder.cpp init(); this->fromJson(*json); } diff --git a/samples/client/petstore/qt5cpp/client/Order.h b/samples/client/petstore/qt5cpp/client/Order.h index be4951e9005..e4a1a0564bc 100644 --- a/samples/client/petstore/qt5cpp/client/Order.h +++ b/samples/client/petstore/qt5cpp/client/Order.h @@ -11,11 +11,7 @@ */ /* -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Order.h * Order.h -======= - * SWGOrder.h ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGOrder.h * * An order for a pets from the pet store */ diff --git a/samples/client/petstore/qt5cpp/client/Pet.cpp b/samples/client/petstore/qt5cpp/client/Pet.cpp index 33d35b09f9f..1fd9677ed97 100644 --- a/samples/client/petstore/qt5cpp/client/Pet.cpp +++ b/samples/client/petstore/qt5cpp/client/Pet.cpp @@ -22,12 +22,7 @@ namespace Swagger { -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Pet.cpp - Pet::Pet(QString* json) { -======= -SWGPet::SWGPet(QString* json) { ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGPet.cpp init(); this->fromJson(*json); } diff --git a/samples/client/petstore/qt5cpp/client/Pet.h b/samples/client/petstore/qt5cpp/client/Pet.h index 24f001e1bdc..514d6751cbe 100644 --- a/samples/client/petstore/qt5cpp/client/Pet.h +++ b/samples/client/petstore/qt5cpp/client/Pet.h @@ -11,11 +11,7 @@ */ /* -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Pet.h * Pet.h -======= - * SWGPet.h ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGPet.h * * A pet for sale in the pet store */ diff --git a/samples/client/petstore/qt5cpp/client/SWGModelFactory.h b/samples/client/petstore/qt5cpp/client/SWGModelFactory.h index 78908af68ea..71821a59919 100644 --- a/samples/client/petstore/qt5cpp/client/SWGModelFactory.h +++ b/samples/client/petstore/qt5cpp/client/SWGModelFactory.h @@ -14,35 +14,18 @@ #define ModelFactory_H_ -<<<<<<< HEAD #include "ApiResponse.h" #include "Category.h" #include "Order.h" #include "Pet.h" #include "Tag.h" #include "User.h" -======= -#include "SWGApiResponse.h" -#include "SWGCategory.h" -#include "SWGOrder.h" -#include "SWGPet.h" -#include "SWGTag.h" -#include "SWGUser.h" ->>>>>>> origin/master namespace Swagger { inline void* create(QString type) { -<<<<<<< HEAD if(QString("ApiResponse").compare(type) == 0) { return new ApiResponse(); -======= - if(QString("SWGApiResponse").compare(type) == 0) { - return new SWGApiResponse(); - } - if(QString("SWGCategory").compare(type) == 0) { - return new SWGCategory(); ->>>>>>> origin/master } if(QString("Category").compare(type) == 0) { return new Category(); diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp index b62bc3105f8..61618433f8a 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp @@ -38,7 +38,7 @@ SWGPetApi::addPet(Pet body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - + QString output = body.asJson(); input.request_body.append(output); @@ -55,6 +55,9 @@ SWGPetApi::addPet(Pet body) { void SWGPetApi::addPetCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -62,13 +65,12 @@ SWGPetApi::addPetCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit addPetSignal(); + emit addPetSignalE(error_type, error_str); } + void SWGPetApi::deletePet(qint64 pet_id, QString* api_key) { QString fullPath; @@ -81,7 +83,7 @@ SWGPetApi::deletePet(qint64 pet_id, QString* api_key) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "DELETE"); - + // TODO: add header support @@ -97,6 +99,9 @@ SWGPetApi::deletePet(qint64 pet_id, QString* api_key) { void SWGPetApi::deletePetCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -104,13 +109,12 @@ SWGPetApi::deletePetCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit deletePetSignal(); + emit deletePetSignalE(error_type, error_str); } + void SWGPetApi::findPetsByStatus(QList* status) { QString fullPath; @@ -163,7 +167,7 @@ SWGPetApi::findPetsByStatus(QList* status) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); - + @@ -178,6 +182,9 @@ SWGPetApi::findPetsByStatus(QList* status) { void SWGPetApi::findPetsByStatusCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -185,7 +192,6 @@ SWGPetApi::findPetsByStatusCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - QList* output = new QList(); QString json(worker->response); QByteArray array (json.toStdString().c_str()); @@ -200,13 +206,12 @@ SWGPetApi::findPetsByStatusCallback(HttpRequestWorker * worker) { output->append(o); } - - worker->deleteLater(); emit findPetsByStatusSignal(output); - + emit findPetsByStatusSignalE(output, error_type, error_str); } + void SWGPetApi::findPetsByTags(QList* tags) { QString fullPath; @@ -259,7 +264,7 @@ SWGPetApi::findPetsByTags(QList* tags) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); - + @@ -274,6 +279,9 @@ SWGPetApi::findPetsByTags(QList* tags) { void SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -281,7 +289,6 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - QList* output = new QList(); QString json(worker->response); QByteArray array (json.toStdString().c_str()); @@ -296,13 +303,12 @@ SWGPetApi::findPetsByTagsCallback(HttpRequestWorker * worker) { output->append(o); } - - worker->deleteLater(); emit findPetsByTagsSignal(output); - + emit findPetsByTagsSignalE(output, error_type, error_str); } + void SWGPetApi::getPetById(qint64 pet_id) { QString fullPath; @@ -315,7 +321,7 @@ SWGPetApi::getPetById(qint64 pet_id) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); - + @@ -330,6 +336,9 @@ SWGPetApi::getPetById(qint64 pet_id) { void SWGPetApi::getPetByIdCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -337,16 +346,15 @@ SWGPetApi::getPetByIdCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - QString json(worker->response); - Pet* output = static_cast(create(json, QString("Pet"))); - + QString json(worker->response); + Pet* output = static_cast(create(json, QString("Pet"))); worker->deleteLater(); emit getPetByIdSignal(output); - + emit getPetByIdSignalE(output, error_type, error_str); } + void SWGPetApi::updatePet(Pet body) { QString fullPath; @@ -357,7 +365,7 @@ SWGPetApi::updatePet(Pet body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "PUT"); - + QString output = body.asJson(); input.request_body.append(output); @@ -374,6 +382,9 @@ SWGPetApi::updatePet(Pet body) { void SWGPetApi::updatePetCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -381,13 +392,12 @@ SWGPetApi::updatePetCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit updatePetSignal(); + emit updatePetSignalE(error_type, error_str); } + void SWGPetApi::updatePetWithForm(qint64 pet_id, QString* name, QString* status) { QString fullPath; @@ -403,7 +413,7 @@ SWGPetApi::updatePetWithForm(qint64 pet_id, QString* name, QString* status) { if (name != nullptr) { input.add_var("name", *name); } -if (status != nullptr) { + if (status != nullptr) { input.add_var("status", *status); } @@ -421,6 +431,9 @@ if (status != nullptr) { void SWGPetApi::updatePetWithFormCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -428,13 +441,12 @@ SWGPetApi::updatePetWithFormCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit updatePetWithFormSignal(); + emit updatePetWithFormSignalE(error_type, error_str); } + void SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file) { QString fullPath; @@ -450,7 +462,7 @@ SWGPetApi::uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpReques if (additional_metadata != nullptr) { input.add_var("additionalMetadata", *additional_metadata); } -if (file != nullptr) { + if (file != nullptr) { input.add_file("file", (*file).local_filename, (*file).request_filename, (*file).mime_type); } @@ -468,6 +480,9 @@ if (file != nullptr) { void SWGPetApi::uploadFileCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -475,19 +490,14 @@ SWGPetApi::uploadFileCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - QString json(worker->response); -<<<<<<< HEAD - ApiResponse* output = static_cast(create(json, QString("ApiResponse"))); -======= - SWGApiResponse* output = static_cast(create(json, QString("SWGApiResponse"))); ->>>>>>> origin/master - + QString json(worker->response); + ApiResponse* output = static_cast(create(json, QString("ApiResponse"))); worker->deleteLater(); emit uploadFileSignal(output); - + emit uploadFileSignalE(output, error_type, error_str); } + } diff --git a/samples/client/petstore/qt5cpp/client/SWGPetApi.h b/samples/client/petstore/qt5cpp/client/SWGPetApi.h index 42dcaaa3bc9..13a18d2e78c 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.h @@ -18,7 +18,6 @@ #include "ApiResponse.h" #include "Pet.h" #include -#include "SWGApiResponse.h" #include "SWGHttpRequest.h" #include @@ -41,11 +40,7 @@ public: void findPetsByStatus(QList* status); void findPetsByTags(QList* tags); void getPetById(qint64 pet_id); -<<<<<<< HEAD void updatePet(Pet body); -======= - void updatePet(SWGPet body); ->>>>>>> origin/master void updatePetWithForm(qint64 pet_id, QString* name, QString* status); void uploadFile(qint64 pet_id, QString* additional_metadata, SWGHttpRequestInputFileElement* file); @@ -67,11 +62,16 @@ signals: void getPetByIdSignal(Pet* summary); void updatePetSignal(); void updatePetWithFormSignal(); -<<<<<<< HEAD void uploadFileSignal(ApiResponse* summary); -======= - void uploadFileSignal(SWGApiResponse* summary); ->>>>>>> origin/master + + void addPetSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void deletePetSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void findPetsByStatusSignalE(QList* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void findPetsByTagsSignalE(QList* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void getPetByIdSignalE(Pet* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void updatePetSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void updatePetWithFormSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void uploadFileSignalE(ApiResponse* summary, QNetworkReply::NetworkError error_type, QString& error_str); }; diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp index b89e5fc552c..ceb964425aa 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.cpp @@ -40,7 +40,7 @@ SWGStoreApi::deleteOrder(QString* order_id) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "DELETE"); - + @@ -55,6 +55,9 @@ SWGStoreApi::deleteOrder(QString* order_id) { void SWGStoreApi::deleteOrderCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -62,13 +65,12 @@ SWGStoreApi::deleteOrderCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit deleteOrderSignal(); + emit deleteOrderSignalE(error_type, error_str); } + void SWGStoreApi::getInventory() { QString fullPath; @@ -79,7 +81,7 @@ SWGStoreApi::getInventory() { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); - + @@ -94,6 +96,9 @@ SWGStoreApi::getInventory() { void SWGStoreApi::getInventoryCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -101,9 +106,8 @@ SWGStoreApi::getInventoryCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - QMap* output = new QMap(); + QMap* output = new QMap(); QString json(worker->response); QByteArray array (json.toStdString().c_str()); QJsonDocument doc = QJsonDocument::fromJson(array); @@ -114,15 +118,12 @@ SWGStoreApi::getInventoryCallback(HttpRequestWorker * worker) { setValue(&val, obj[key], "QMap", ""); output->insert(key, *val); } - - - - worker->deleteLater(); emit getInventorySignal(output); - + emit getInventorySignalE(output, error_type, error_str); } + void SWGStoreApi::getOrderById(qint64 order_id) { QString fullPath; @@ -135,7 +136,7 @@ SWGStoreApi::getOrderById(qint64 order_id) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); - + @@ -150,6 +151,9 @@ SWGStoreApi::getOrderById(qint64 order_id) { void SWGStoreApi::getOrderByIdCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -157,16 +161,15 @@ SWGStoreApi::getOrderByIdCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - QString json(worker->response); - Order* output = static_cast(create(json, QString("Order"))); - + QString json(worker->response); + Order* output = static_cast(create(json, QString("Order"))); worker->deleteLater(); emit getOrderByIdSignal(output); - + emit getOrderByIdSignalE(output, error_type, error_str); } + void SWGStoreApi::placeOrder(Order body) { QString fullPath; @@ -177,7 +180,7 @@ SWGStoreApi::placeOrder(Order body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - + QString output = body.asJson(); input.request_body.append(output); @@ -194,6 +197,9 @@ SWGStoreApi::placeOrder(Order body) { void SWGStoreApi::placeOrderCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -201,15 +207,14 @@ SWGStoreApi::placeOrderCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - QString json(worker->response); - Order* output = static_cast(create(json, QString("Order"))); - + QString json(worker->response); + Order* output = static_cast(create(json, QString("Order"))); worker->deleteLater(); emit placeOrderSignal(output); - + emit placeOrderSignalE(output, error_type, error_str); } + } diff --git a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h index c755695f57d..d42fa5730b1 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h @@ -37,11 +37,7 @@ public: void deleteOrder(QString* order_id); void getInventory(); void getOrderById(qint64 order_id); -<<<<<<< HEAD void placeOrder(Order body); -======= - void placeOrder(SWGOrder body); ->>>>>>> origin/master private: void deleteOrderCallback (HttpRequestWorker * worker); @@ -55,6 +51,11 @@ signals: void getOrderByIdSignal(Order* summary); void placeOrderSignal(Order* summary); + void deleteOrderSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void getInventorySignalE(QMap* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void getOrderByIdSignalE(Order* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void placeOrderSignalE(Order* summary, QNetworkReply::NetworkError error_type, QString& error_str); + }; } diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp index 0f550a2e146..35081b395b7 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp @@ -38,7 +38,7 @@ SWGUserApi::createUser(User body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - + QString output = body.asJson(); input.request_body.append(output); @@ -55,6 +55,9 @@ SWGUserApi::createUser(User body) { void SWGUserApi::createUserCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -62,13 +65,12 @@ SWGUserApi::createUserCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit createUserSignal(); + emit createUserSignalE(error_type, error_str); } + void SWGUserApi::createUsersWithArrayInput(QList* body) { QString fullPath; @@ -79,7 +81,7 @@ SWGUserApi::createUsersWithArrayInput(QList* body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - + QJsonArray* bodyArray = new QJsonArray(); toJsonArray((QList*)body, bodyArray, QString("body"), QString("SWGUser*")); @@ -101,6 +103,9 @@ SWGUserApi::createUsersWithArrayInput(QList* body) { void SWGUserApi::createUsersWithArrayInputCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -108,13 +113,12 @@ SWGUserApi::createUsersWithArrayInputCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit createUsersWithArrayInputSignal(); + emit createUsersWithArrayInputSignalE(error_type, error_str); } + void SWGUserApi::createUsersWithListInput(QList* body) { QString fullPath; @@ -125,7 +129,7 @@ SWGUserApi::createUsersWithListInput(QList* body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - + QJsonArray* bodyArray = new QJsonArray(); toJsonArray((QList*)body, bodyArray, QString("body"), QString("SWGUser*")); @@ -147,6 +151,9 @@ SWGUserApi::createUsersWithListInput(QList* body) { void SWGUserApi::createUsersWithListInputCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -154,13 +161,12 @@ SWGUserApi::createUsersWithListInputCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit createUsersWithListInputSignal(); + emit createUsersWithListInputSignalE(error_type, error_str); } + void SWGUserApi::deleteUser(QString* username) { QString fullPath; @@ -173,7 +179,7 @@ SWGUserApi::deleteUser(QString* username) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "DELETE"); - + @@ -188,6 +194,9 @@ SWGUserApi::deleteUser(QString* username) { void SWGUserApi::deleteUserCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -195,13 +204,12 @@ SWGUserApi::deleteUserCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit deleteUserSignal(); + emit deleteUserSignalE(error_type, error_str); } + void SWGUserApi::getUserByName(QString* username) { QString fullPath; @@ -214,7 +222,7 @@ SWGUserApi::getUserByName(QString* username) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); - + @@ -229,6 +237,9 @@ SWGUserApi::getUserByName(QString* username) { void SWGUserApi::getUserByNameCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -236,16 +247,15 @@ SWGUserApi::getUserByNameCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - QString json(worker->response); - User* output = static_cast(create(json, QString("User"))); - + QString json(worker->response); + User* output = static_cast(create(json, QString("User"))); worker->deleteLater(); emit getUserByNameSignal(output); - + emit getUserByNameSignalE(output, error_type, error_str); } + void SWGUserApi::loginUser(QString* username, QString* password) { QString fullPath; @@ -272,7 +282,7 @@ SWGUserApi::loginUser(QString* username, QString* password) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); - + @@ -287,6 +297,9 @@ SWGUserApi::loginUser(QString* username, QString* password) { void SWGUserApi::loginUserCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -294,16 +307,15 @@ SWGUserApi::loginUserCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - QString json(worker->response); - QString* output = static_cast(create(json, QString("QString"))); - + QString json(worker->response); + QString* output = static_cast(create(json, QString("QString"))); worker->deleteLater(); emit loginUserSignal(output); - + emit loginUserSignalE(output, error_type, error_str); } + void SWGUserApi::logoutUser() { QString fullPath; @@ -314,7 +326,7 @@ SWGUserApi::logoutUser() { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "GET"); - + @@ -329,6 +341,9 @@ SWGUserApi::logoutUser() { void SWGUserApi::logoutUserCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -336,13 +351,12 @@ SWGUserApi::logoutUserCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit logoutUserSignal(); + emit logoutUserSignalE(error_type, error_str); } + void SWGUserApi::updateUser(QString* username, User body) { QString fullPath; @@ -355,7 +369,7 @@ SWGUserApi::updateUser(QString* username, User body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "PUT"); - + QString output = body.asJson(); input.request_body.append(output); @@ -372,6 +386,9 @@ SWGUserApi::updateUser(QString* username, User body) { void SWGUserApi::updateUserCallback(HttpRequestWorker * worker) { QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + if (worker->error_type == QNetworkReply::NoError) { msg = QString("Success! %1 bytes").arg(worker->response.length()); } @@ -379,12 +396,11 @@ SWGUserApi::updateUserCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - worker->deleteLater(); - emit updateUserSignal(); + emit updateUserSignalE(error_type, error_str); } + } diff --git a/samples/client/petstore/qt5cpp/client/SWGUserApi.h b/samples/client/petstore/qt5cpp/client/SWGUserApi.h index 58f85e09957..5b72570dae2 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.h @@ -63,6 +63,15 @@ signals: void logoutUserSignal(); void updateUserSignal(); + void createUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void createUsersWithArrayInputSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void createUsersWithListInputSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void deleteUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void getUserByNameSignalE(User* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void loginUserSignalE(QString* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void logoutUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void updateUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + }; } diff --git a/samples/client/petstore/qt5cpp/client/Tag.cpp b/samples/client/petstore/qt5cpp/client/Tag.cpp index c10f379d049..4cdf68d70a4 100644 --- a/samples/client/petstore/qt5cpp/client/Tag.cpp +++ b/samples/client/petstore/qt5cpp/client/Tag.cpp @@ -22,12 +22,7 @@ namespace Swagger { -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Tag.cpp - Tag::Tag(QString* json) { -======= -SWGTag::SWGTag(QString* json) { ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGTag.cpp init(); this->fromJson(*json); } diff --git a/samples/client/petstore/qt5cpp/client/Tag.h b/samples/client/petstore/qt5cpp/client/Tag.h index 762cc31aca0..0b34e420699 100644 --- a/samples/client/petstore/qt5cpp/client/Tag.h +++ b/samples/client/petstore/qt5cpp/client/Tag.h @@ -11,11 +11,7 @@ */ /* -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/Tag.h * Tag.h -======= - * SWGTag.h ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGTag.h * * A tag for a pet */ diff --git a/samples/client/petstore/qt5cpp/client/User.cpp b/samples/client/petstore/qt5cpp/client/User.cpp index 811902a776c..e0a2dd7abb3 100644 --- a/samples/client/petstore/qt5cpp/client/User.cpp +++ b/samples/client/petstore/qt5cpp/client/User.cpp @@ -22,12 +22,7 @@ namespace Swagger { -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/User.cpp - User::User(QString* json) { -======= -SWGUser::SWGUser(QString* json) { ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGUser.cpp init(); this->fromJson(*json); } diff --git a/samples/client/petstore/qt5cpp/client/User.h b/samples/client/petstore/qt5cpp/client/User.h index b9ccc017d2f..844869d14ae 100644 --- a/samples/client/petstore/qt5cpp/client/User.h +++ b/samples/client/petstore/qt5cpp/client/User.h @@ -11,11 +11,7 @@ */ /* -<<<<<<< HEAD:samples/client/petstore/qt5cpp/client/User.h * User.h -======= - * SWGUser.h ->>>>>>> origin/master:samples/client/petstore/qt5cpp/client/SWGUser.h * * A User who is purchasing from the pet store */ diff --git a/samples/client/petstore/ruby/.swagger-codegen/VERSION b/samples/client/petstore/ruby/.swagger-codegen/VERSION new file mode 100644 index 00000000000..7fea99011a6 --- /dev/null +++ b/samples/client/petstore/ruby/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java index ad9c5c2929b..c155dfa0537 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/PetApi.java @@ -30,6 +30,7 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", @@ -45,6 +46,7 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", @@ -61,6 +63,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = "application/json", consumes = "application/json", @@ -77,6 +80,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = "application/json", consumes = "application/json", @@ -91,6 +95,7 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", @@ -108,6 +113,7 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", @@ -123,6 +129,7 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/x-www-form-urlencoded", @@ -138,6 +145,7 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = "application/json", consumes = "multipart/form-data", diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/StoreApi.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/StoreApi.java index c8a7cace4d5..fc5d6b4889e 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/StoreApi.java @@ -25,6 +25,7 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", @@ -37,6 +38,7 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = "application/json", consumes = "application/json", @@ -49,6 +51,7 @@ public interface StoreApi { @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) }) + @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", @@ -60,6 +63,7 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = "application/json", consumes = "application/json", diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java index b01bae3dc37..5014c4cc7cf 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/api/UserApi.java @@ -24,6 +24,7 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user", produces = "application/json", consumes = "application/json", @@ -34,6 +35,7 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/createWithArray", produces = "application/json", consumes = "application/json", @@ -44,6 +46,7 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/createWithList", produces = "application/json", consumes = "application/json", @@ -55,6 +58,7 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", @@ -67,6 +71,7 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", @@ -78,6 +83,7 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = "application/json", consumes = "application/json", @@ -88,6 +94,7 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/logout", produces = "application/json", consumes = "application/json", @@ -99,6 +106,7 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java index 7289c191a9c..55a5d0ec28c 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Category.java @@ -31,7 +31,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -51,7 +51,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java index d9a1123d082..f06b378a524 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/ModelApiResponse.java @@ -34,7 +34,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -54,7 +54,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -74,7 +74,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java index e417cc17e61..b7b849100ef 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Order.java @@ -78,7 +78,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -98,7 +98,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -118,7 +118,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -139,6 +139,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getShipDate() { return shipDate; } @@ -158,7 +159,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -178,7 +179,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java index f79e9ae56d4..367ec151b73 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Pet.java @@ -81,7 +81,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -102,6 +102,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -122,7 +123,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -148,7 +149,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -177,6 +178,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -196,7 +198,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java index e9ad7e51654..b44f2ac0bff 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/Tag.java @@ -31,7 +31,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -51,7 +51,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java index b3b24907d97..e2abb60d07a 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java +++ b/samples/client/petstore/spring-cloud/src/main/java/io/swagger/model/User.java @@ -49,7 +49,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -69,7 +69,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -89,7 +89,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -109,7 +109,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -129,7 +129,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -149,7 +149,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -169,7 +169,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -189,7 +189,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java index 45f86ff8cbf..db67d11eeb6 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/PetApi.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -31,11 +30,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -46,11 +46,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -62,11 +63,12 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status); @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 = { @@ -78,11 +80,12 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -92,11 +95,12 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -109,11 +113,12 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet", produces = "application/json", consumes = "application/json", method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -124,11 +129,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = "application/json", consumes = "application/x-www-form-urlencoded", method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -139,10 +145,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = "application/json", consumes = "multipart/form-data", method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java index 5f8f31dffe2..2e3319c5b1f 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/StoreApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -26,11 +25,12 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -38,11 +38,12 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @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", }) @@ -50,21 +51,23 @@ public interface StoreApi { @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) }) + @RequestMapping(value = "/store/order/{orderId}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId); @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) }) + @RequestMapping(value = "/store/order", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java index 5a4cef2892d..ceab49231a5 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/api/UserApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -25,42 +24,46 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @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) }) + @RequestMapping(value = "/user/createWithArray", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @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) }) + @RequestMapping(value = "/user/createWithList", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @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) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -68,42 +71,46 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @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) }) + @RequestMapping(value = "/user/login", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); @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) }) + @RequestMapping(value = "/user/logout", produces = "application/json", consumes = "application/json", method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @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) }) + @RequestMapping(value = "/user/{username}", produces = "application/json", consumes = "application/json", method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java index 7289c191a9c..55a5d0ec28c 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Category.java @@ -31,7 +31,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -51,7 +51,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java index d9a1123d082..f06b378a524 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/ModelApiResponse.java @@ -34,7 +34,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -54,7 +54,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -74,7 +74,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java index e417cc17e61..b7b849100ef 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Order.java @@ -78,7 +78,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -98,7 +98,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -118,7 +118,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -139,6 +139,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getShipDate() { return shipDate; } @@ -158,7 +159,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -178,7 +179,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java index f79e9ae56d4..367ec151b73 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Pet.java @@ -81,7 +81,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -102,6 +102,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -122,7 +123,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -148,7 +149,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -177,6 +178,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -196,7 +198,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java index e9ad7e51654..b44f2ac0bff 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/Tag.java @@ -31,7 +31,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -51,7 +51,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java index b3b24907d97..e2abb60d07a 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java +++ b/samples/client/petstore/spring-stubs/src/main/java/io/swagger/model/User.java @@ -49,7 +49,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -69,7 +69,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -89,7 +89,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -109,7 +109,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -129,7 +129,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -149,7 +149,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -169,7 +169,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -189,7 +189,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift index dbe5b5a379e..2fabe3edd84 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift index ba69fb2a513..1d726049156 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 091e0d45664..22db9a77a20 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index 91734ecbb02..f29384cdf0d 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index c21366cce7d..32f99789135 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift index df9256c812b..108eea11c25 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift @@ -4,6 +4,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire class AlamofireRequestBuilderFactory: RequestBuilderFactory { diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Extensions.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Extensions.swift index 2c5c9192768..db5466651e1 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Extensions.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Extensions.swift @@ -4,6 +4,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire extension Bool: JSONEncodable { diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift index e4243744c6c..3d6ea3e10a1 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import PromiseKit diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift index e578e04ba23..d81098da831 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import PromiseKit diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 1b4f331fc1d..590e20152bf 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import PromiseKit diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index f2bd2f0c387..492eef75f52 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import PromiseKit diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index 02bd372ac49..e61a6077b90 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import PromiseKit diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift index df9256c812b..108eea11c25 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift @@ -4,6 +4,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire class AlamofireRequestBuilderFactory: RequestBuilderFactory { diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Extensions.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Extensions.swift index f7a731999c8..af50f1486a7 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Extensions.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Extensions.swift @@ -4,6 +4,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import PromiseKit diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift index 58e2f2b7b8b..bd7d3abdd96 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import RxSwift diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift index dda46ead7f0..58815a634a9 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/Fake_classname_tags123API.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import RxSwift diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 5c457e4eb02..28245aa3deb 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import RxSwift diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index 045661cc371..4ac0c31e178 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import RxSwift diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index a2a0cd23970..7436317df9f 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -5,6 +5,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire import RxSwift diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift index df9256c812b..108eea11c25 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/AlamofireImplementations.swift @@ -4,6 +4,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire class AlamofireRequestBuilderFactory: RequestBuilderFactory { diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Extensions.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Extensions.swift index 2c5c9192768..db5466651e1 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Extensions.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Extensions.swift @@ -4,6 +4,7 @@ // https://github.com/swagger-api/swagger-codegen // +import Foundation import Alamofire extension Bool: JSONEncodable { diff --git a/samples/client/petstore/typescript-angular/api/api.ts b/samples/client/petstore/typescript-angular/api/api.ts index 02423026327..4ddd9e29663 100644 --- a/samples/client/petstore/typescript-angular/api/api.ts +++ b/samples/client/petstore/typescript-angular/api/api.ts @@ -4,4 +4,4 @@ export * from './StoreApi'; import { StoreApi } from './StoreApi'; export * from './UserApi'; import { UserApi } from './UserApi'; -export const APIS = [PetApi, StoreApi, UserApi, ]; +export const APIS = [PetApi, StoreApi, UserApi]; diff --git a/samples/client/petstore/typescript-angular2/default/api/pet.service.ts b/samples/client/petstore/typescript-angular2/default/api/pet.service.ts index 5992daeeba0..90b931e7bfe 100644 --- a/samples/client/petstore/typescript-angular2/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular2/default/api/pet.service.ts @@ -82,7 +82,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -99,7 +99,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -115,7 +115,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -131,7 +131,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -147,7 +147,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -163,7 +163,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -181,7 +181,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -199,7 +199,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } diff --git a/samples/client/petstore/typescript-angular2/default/api/store.service.ts b/samples/client/petstore/typescript-angular2/default/api/store.service.ts index 89753a51efe..764ffb9d7bd 100644 --- a/samples/client/petstore/typescript-angular2/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular2/default/api/store.service.ts @@ -82,7 +82,7 @@ export class StoreService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -97,7 +97,7 @@ export class StoreService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -113,7 +113,7 @@ export class StoreService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -129,7 +129,7 @@ export class StoreService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } diff --git a/samples/client/petstore/typescript-angular2/default/api/user.service.ts b/samples/client/petstore/typescript-angular2/default/api/user.service.ts index a5aa4962399..9359c9ea040 100644 --- a/samples/client/petstore/typescript-angular2/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular2/default/api/user.service.ts @@ -82,7 +82,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -98,7 +98,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -114,7 +114,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -130,7 +130,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -146,7 +146,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -163,7 +163,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -178,7 +178,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -195,7 +195,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } diff --git a/samples/client/petstore/typescript-angular2/default/model/ApiResponse.ts b/samples/client/petstore/typescript-angular2/default/model/ApiResponse.ts new file mode 100644 index 00000000000..f86e84f93a3 --- /dev/null +++ b/samples/client/petstore/typescript-angular2/default/model/ApiResponse.ts @@ -0,0 +1,25 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import * as models from './models'; + +/** + * Describes the result of uploading an image resource + */ +export interface ApiResponse { + code?: number; + + type?: string; + + message?: string; + +} diff --git a/samples/client/petstore/typescript-angular2/default/variables.ts b/samples/client/petstore/typescript-angular2/default/variables.ts index 944e688f1b1..b734b2e5918 100644 --- a/samples/client/petstore/typescript-angular2/default/variables.ts +++ b/samples/client/petstore/typescript-angular2/default/variables.ts @@ -1,6 +1,6 @@ -import { OpaqueToken } from '@angular/core'; +import { InjectionToken } from '@angular/core'; -export const BASE_PATH = new OpaqueToken('basePath'); +export const BASE_PATH = new InjectionToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', diff --git a/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts index 5992daeeba0..90b931e7bfe 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts @@ -82,7 +82,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -99,7 +99,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -115,7 +115,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -131,7 +131,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -147,7 +147,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -163,7 +163,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -181,7 +181,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -199,7 +199,7 @@ export class PetService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } diff --git a/samples/client/petstore/typescript-angular2/npm/api/store.service.ts b/samples/client/petstore/typescript-angular2/npm/api/store.service.ts index 89753a51efe..764ffb9d7bd 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/store.service.ts @@ -82,7 +82,7 @@ export class StoreService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -97,7 +97,7 @@ export class StoreService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -113,7 +113,7 @@ export class StoreService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -129,7 +129,7 @@ export class StoreService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } diff --git a/samples/client/petstore/typescript-angular2/npm/api/user.service.ts b/samples/client/petstore/typescript-angular2/npm/api/user.service.ts index a5aa4962399..9359c9ea040 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/user.service.ts @@ -82,7 +82,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -98,7 +98,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -114,7 +114,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -130,7 +130,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -146,7 +146,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -163,7 +163,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -178,7 +178,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -195,7 +195,7 @@ export class UserService { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } diff --git a/samples/client/petstore/typescript-angular2/npm/model/ApiResponse.ts b/samples/client/petstore/typescript-angular2/npm/model/ApiResponse.ts new file mode 100644 index 00000000000..f86e84f93a3 --- /dev/null +++ b/samples/client/petstore/typescript-angular2/npm/model/ApiResponse.ts @@ -0,0 +1,25 @@ +/** + * Swagger Petstore + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +import * as models from './models'; + +/** + * Describes the result of uploading an image resource + */ +export interface ApiResponse { + code?: number; + + type?: string; + + message?: string; + +} diff --git a/samples/client/petstore/typescript-angular2/npm/variables.ts b/samples/client/petstore/typescript-angular2/npm/variables.ts index 944e688f1b1..b734b2e5918 100644 --- a/samples/client/petstore/typescript-angular2/npm/variables.ts +++ b/samples/client/petstore/typescript-angular2/npm/variables.ts @@ -1,6 +1,6 @@ -import { OpaqueToken } from '@angular/core'; +import { InjectionToken } from '@angular/core'; -export const BASE_PATH = new OpaqueToken('basePath'); +export const BASE_PATH = new InjectionToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', diff --git a/samples/server/petstore/erlang-server/pom.xml b/samples/server/petstore/erlang-server/pom.xml new file mode 100644 index 00000000000..3318e967cf4 --- /dev/null +++ b/samples/server/petstore/erlang-server/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + io.swagger + ErlangServerTests + pom + 1.0-SNAPSHOT + Erlang Petstore Server + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + Erlang Test + integration-test + + exec + + + rebar3 + + compile + + + + + + + + diff --git a/samples/server/petstore/erlang-server/priv/swagger.json b/samples/server/petstore/erlang-server/priv/swagger.json index 3eef6c58413..708a71c0c0f 100644 --- a/samples/server/petstore/erlang-server/priv/swagger.json +++ b/samples/server/petstore/erlang-server/priv/swagger.json @@ -108,8 +108,8 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "available", "pending", "sold" ], - "default" : "available" + "default" : "available", + "enum" : [ "available", "pending", "sold" ] }, "collectionFormat" : "csv" } ], diff --git a/samples/server/petstore/erlang-server/rebar.config b/samples/server/petstore/erlang-server/rebar.config index 1c7f7d922e9..1d01cefa83b 100644 --- a/samples/server/petstore/erlang-server/rebar.config +++ b/samples/server/petstore/erlang-server/rebar.config @@ -1,4 +1,4 @@ {deps, [ - {jsx, {git, "https://github.com/talentdeficit/jsx.git", {branch, "v2.8.0"}}}, + {jsx, {git, "https://github.com/talentdeficit/jsx.git", {tag, "2.8.2"}}}, {jesse, {git, "https://github.com/for-GET/jesse.git", {tag, "1.4.0"}}} ]}. diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java index 9ccc8581e6d..8903031c0cd 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java @@ -28,11 +28,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - default CompletableFuture> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -44,11 +45,12 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - default CompletableFuture> testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept) { + default CompletableFuture> testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -58,11 +60,12 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - default CompletableFuture> testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { + default CompletableFuture> testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApiController.java index c9bf94efe6a..c3ae70f89c6 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApiController.java @@ -1,17 +1,13 @@ package io.swagger.api; import org.springframework.stereotype.Controller; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeClassnameTestApi.java index 39e2d71b996..02a3891f922 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeClassnameTestApi.java @@ -25,11 +25,12 @@ public interface FakeClassnameTestApi { @ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake_classname_test", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - default CompletableFuture> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeClassnameTestApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeClassnameTestApiController.java index 1c310fd7eaa..0bbb109069d 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeClassnameTestApiController.java @@ -7,10 +7,7 @@ import javax.validation.Valid; @Controller public class FakeClassnameTestApiController implements FakeClassnameTestApi { - private final ObjectMapper objectMapper; - public FakeClassnameTestApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index a8972da9948..541cf279034 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java @@ -32,11 +32,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - default CompletableFuture> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { + default CompletableFuture> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -50,10 +51,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default CompletableFuture> deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept) { + default CompletableFuture> deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -68,10 +70,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture>> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture>> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity>(HttpStatus.OK)); } @@ -86,10 +89,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture>> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture>> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity>(HttpStatus.OK)); } @@ -102,10 +106,11 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -121,11 +126,12 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - default CompletableFuture> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { + default CompletableFuture> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -139,11 +145,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default CompletableFuture> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept) { + default CompletableFuture> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -157,11 +164,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default CompletableFuture> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApiController.java index 5dd78a0e768..dc21c5e352f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApiController.java @@ -1,17 +1,13 @@ package io.swagger.api; import org.springframework.stereotype.Controller; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java index e9423183f52..8a1056032ba 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java @@ -27,10 +27,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default CompletableFuture> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept) { + default CompletableFuture> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -41,10 +42,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - default CompletableFuture>> getInventory( @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture>> getInventory() { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity>(HttpStatus.OK)); } @@ -55,10 +57,11 @@ public interface StoreApi { @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) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -68,10 +71,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default CompletableFuture> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApiController.java index 652923c800b..341bd1184af 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApiController.java @@ -1,17 +1,13 @@ package io.swagger.api; import org.springframework.stereotype.Controller; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java index aae5ecf1d0f..97cf9be47e9 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java @@ -26,10 +26,11 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default CompletableFuture> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { + default CompletableFuture> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -38,10 +39,11 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default CompletableFuture> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept) { + default CompletableFuture> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -50,10 +52,11 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default CompletableFuture> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept) { + default CompletableFuture> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -63,10 +66,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default CompletableFuture> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) { + default CompletableFuture> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -77,10 +81,11 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -90,10 +95,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { + default CompletableFuture> loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -102,10 +108,11 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture> logoutUser( @RequestHeader("Accept") String accept) { + default CompletableFuture> logoutUser() { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } @@ -115,10 +122,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - default CompletableFuture> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { + default CompletableFuture> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApiController.java index 5afeac776dd..f33d583cd75 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApiController.java @@ -1,17 +1,13 @@ package io.swagger.api; import org.springframework.stereotype.Controller; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0d..532576aad86 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java index bc957d1c803..a59dc766c51 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b5..ecff36e416a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be0..a08ff749ee1 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63a..e9022fd0285 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java index 93533c28822..d59005adf17 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java index edcbc354be6..28016fa5ad6 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2ad..e2a67cf25d8 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b60..a5ef34a2331 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java index 3b8d16cabf2..aaa03c570f2 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java index 513131a9fa7..8ebd0f46a62 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e9..4d79aa66c54 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf7..a072f992671 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java index f63a8de2c15..b5d0c2e2505 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e261..dc59cf9c78c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java index 1530a53f53f..f179e8e4233 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index eafbcb4ecb8..8848aaab327 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java index 97349fef05c..c00e48ea6c7 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e2..1df487b3539 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09c..3b05293b830 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java index 46069fdd14b..a9835f910ac 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429b..a990653f20d 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java index e1a5d94cc8f..1b5522ac6a2 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java index c84687b699f..38d92a5b917 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008d..1ff292f1851 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353c..9eabbe3eca4 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java index 9f8f3a25234..b3d49a2dc6a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java index 501c556de27..ef3270b7aff 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java index f6093ba101c..2bf46ca2d47 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -27,11 +26,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @@ -40,21 +40,23 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback); @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java index 4199a81f8e1..03822df3547 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java @@ -18,27 +18,17 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } @@ -55,8 +45,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -68,8 +57,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeClassnameTestApi.java index bd3568f20e1..bee707d7989 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeClassnameTestApi.java @@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -24,10 +23,11 @@ public interface FakeClassnameTestApi { @ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake_classname_test", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeClassnameTestApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeClassnameTestApiController.java index cfeb3390d9a..f708c48b302 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeClassnameTestApiController.java @@ -15,27 +15,17 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeClassnameTestApiController implements FakeClassnameTestApi { - private final ObjectMapper objectMapper; - public FakeClassnameTestApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index 1227aedbbd7..9e5bad2b5a2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -31,11 +30,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -46,10 +46,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -61,10 +62,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status); @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 = { @@ -76,10 +78,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -89,10 +92,11 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -105,11 +109,12 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -120,11 +125,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -135,10 +141,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java index 66e1dbda18d..6ad4390e166 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApiController.java @@ -17,104 +17,57 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 doggie aeiou aeiou", Pet.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java index fb8f3d706f5..8b080a440dd 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -26,10 +25,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -37,10 +37,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @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", }) @@ -48,19 +49,21 @@ public interface StoreApi { @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) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId); @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) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApiController.java index 6154d9c2639..472bda2ada0 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApiController.java @@ -16,64 +16,32 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java index adc0d21d30b..55fe9faf684 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -25,38 +24,42 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @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) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @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) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -64,38 +67,42 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @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) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); @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) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java index 24b7e18b995..e751209da25 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApiController.java @@ -16,84 +16,53 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123", User.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, - @RequestHeader("Accept") String accept) throws IOException { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue("aeiou", String.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0d..532576aad86 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Animal.java index bc957d1c803..a59dc766c51 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b5..ecff36e416a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be0..a08ff749ee1 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63a..e9022fd0285 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Capitalization.java index 93533c28822..d59005adf17 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Cat.java index edcbc354be6..28016fa5ad6 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2ad..e2a67cf25d8 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b60..a5ef34a2331 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Client.java index 3b8d16cabf2..aaa03c570f2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Dog.java index 513131a9fa7..8ebd0f46a62 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e9..4d79aa66c54 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf7..a072f992671 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/FormatTest.java index 2aaa5179f61..66baac16d0d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e261..dc59cf9c78c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MapTest.java index 1530a53f53f..f179e8e4233 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 21cb67378eb..a10376d49b7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Model200Response.java index 97349fef05c..c00e48ea6c7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e2..1df487b3539 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09c..3b05293b830 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java index 46069fdd14b..a9835f910ac 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429b..a990653f20d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java index 3ba7e5a0a85..e686203d0e1 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java index c84687b699f..38d92a5b917 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008d..1ff292f1851 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353c..9eabbe3eca4 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java index 9f8f3a25234..b3d49a2dc6a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java index 501c556de27..ef3270b7aff 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java index f6093ba101c..2bf46ca2d47 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -27,11 +26,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @@ -40,21 +40,23 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback); @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java index 4199a81f8e1..03822df3547 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java @@ -18,27 +18,17 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } @@ -55,8 +45,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -68,8 +57,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApi.java index bd3568f20e1..bee707d7989 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApi.java @@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -24,10 +23,11 @@ public interface FakeClassnameTestApi { @ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake_classname_test", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApiController.java index 4c37c7a71de..f708c48b302 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeClassnameTestApiController.java @@ -13,8 +13,6 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; @@ -23,16 +21,11 @@ import javax.validation.Valid; @Controller public class FakeClassnameTestApiController implements FakeClassnameTestApi { - public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + + + public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java index 1227aedbbd7..9e5bad2b5a2 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApi.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -31,11 +30,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -46,10 +46,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -61,10 +62,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status); @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 = { @@ -76,10 +78,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -89,10 +92,11 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -105,11 +109,12 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -120,11 +125,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -135,10 +141,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java index 66e1dbda18d..6ad4390e166 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/PetApiController.java @@ -17,104 +17,57 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 doggie aeiou aeiou", Pet.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApi.java index fb8f3d706f5..8b080a440dd 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -26,10 +25,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -37,10 +37,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @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", }) @@ -48,19 +49,21 @@ public interface StoreApi { @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) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId); @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) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java index 6154d9c2639..472bda2ada0 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/StoreApiController.java @@ -16,64 +16,32 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java index adc0d21d30b..55fe9faf684 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -25,38 +24,42 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @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) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @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) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -64,38 +67,42 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @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) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); @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) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java index 24b7e18b995..e751209da25 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/UserApiController.java @@ -16,84 +16,53 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123", User.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, - @RequestHeader("Accept") String accept) throws IOException { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue("aeiou", String.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0d..532576aad86 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java index bc957d1c803..a59dc766c51 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b5..ecff36e416a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be0..a08ff749ee1 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63a..e9022fd0285 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java index 93533c28822..d59005adf17 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java index edcbc354be6..28016fa5ad6 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2ad..e2a67cf25d8 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b60..a5ef34a2331 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java index 3b8d16cabf2..aaa03c570f2 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java index 513131a9fa7..8ebd0f46a62 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e9..4d79aa66c54 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf7..a072f992671 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java index 2aaa5179f61..66baac16d0d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e261..dc59cf9c78c 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java index 1530a53f53f..f179e8e4233 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 21cb67378eb..a10376d49b7 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java index 97349fef05c..c00e48ea6c7 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e2..1df487b3539 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09c..3b05293b830 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java index 46069fdd14b..a9835f910ac 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429b..a990653f20d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java index 3ba7e5a0a85..e686203d0e1 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java index c84687b699f..38d92a5b917 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008d..1ff292f1851 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353c..9eabbe3eca4 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java index 9f8f3a25234..b3d49a2dc6a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java index 501c556de27..ef3270b7aff 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java index 332c9b1101f..eecc3dd4f39 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java @@ -16,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -28,11 +27,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - default ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -44,11 +44,12 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept) { + default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -58,11 +59,12 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept) { + default ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java index 487414784ae..72de87558b6 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java @@ -18,19 +18,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final FakeApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -38,8 +31,8 @@ public class FakeApiController implements FakeApi { this.delegate = delegate; } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return delegate.testClientModel(body); } @@ -57,8 +50,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } @@ -70,8 +62,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return delegate.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApi.java index c9eeae046b5..1d03880e656 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -25,11 +24,12 @@ public interface FakeClassnameTestApi { @ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake_classname_test", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - default ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApiController.java index 639ff90c1e5..a66d2df9175 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApiController.java @@ -15,19 +15,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeClassnameTestApiController implements FakeClassnameTestApi { - private final ObjectMapper objectMapper; - - public FakeClassnameTestApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final FakeClassnameTestApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -35,8 +28,8 @@ public class FakeClassnameTestApiController implements FakeClassnameTestApi { this.delegate = delegate; } - public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return delegate.testClassname(body); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java index d9dc4d87b26..d9b7399573d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApi.java @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -32,11 +31,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - default ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { + default ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -50,10 +50,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept) { + default ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -68,10 +69,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! return new ResponseEntity>(HttpStatus.OK); } @@ -86,10 +88,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! return new ResponseEntity>(HttpStatus.OK); } @@ -102,10 +105,11 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -121,11 +125,12 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - default ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept) { + default ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -139,11 +144,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept) { + default ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -157,11 +163,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java index 7adec37e9ba..e8c28faa9be 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/PetApiController.java @@ -17,19 +17,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final PetApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -37,55 +30,48 @@ public class PetApiController implements PetApi { this.delegate = delegate; } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return delegate.addPet(body); } public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return delegate.deletePet(petId, apiKey); } - public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! return delegate.findPetsByStatus(status); } - public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! return delegate.findPetsByTags(tags); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! return delegate.getPetById(petId); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return delegate.updatePet(body); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return delegate.updatePetWithForm(petId, name, status); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! return delegate.uploadFile(petId, additionalMetadata, file); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java index c10166a33fc..c3745d9ec54 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApi.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -27,10 +26,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept) { + default ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -41,10 +41,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - default ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity> getInventory() { // do some magic! return new ResponseEntity>(HttpStatus.OK); } @@ -55,10 +56,11 @@ public interface StoreApi { @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) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -68,10 +70,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java index 4d0ff13f995..9ca8e80b316 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/StoreApiController.java @@ -16,19 +16,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final StoreApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -36,25 +29,23 @@ public class StoreApiController implements StoreApi { this.delegate = delegate; } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return delegate.deleteOrder(orderId); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! return delegate.getInventory(); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! return delegate.getOrderById(orderId); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! return delegate.placeOrder(body); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java index 6642dec5ecf..0b8c3e31073 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApi.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -26,10 +25,11 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { + default ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -38,10 +38,11 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept) { + default ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -50,10 +51,11 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept) { + default ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -63,10 +65,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - default ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) { + default ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -77,10 +80,11 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -90,10 +94,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException { + default ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -102,10 +107,11 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity logoutUser( @RequestHeader("Accept") String accept) { + default ResponseEntity logoutUser() { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -115,10 +121,11 @@ public interface UserApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - default ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept) { + default ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java index 0264f9026a4..468a1cee150 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/UserApiController.java @@ -16,19 +16,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final UserApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -36,51 +29,45 @@ public class UserApiController implements UserApi { this.delegate = delegate; } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return delegate.createUser(body); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return delegate.createUsersWithArrayInput(body); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return delegate.createUsersWithListInput(body); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return delegate.deleteUser(username); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! return delegate.getUserByName(username); } public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, - @RequestHeader("Accept") String accept) throws IOException { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! return delegate.loginUser(username, password); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return delegate.logoutUser(); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return delegate.updateUser(username, body); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0d..532576aad86 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java index bc957d1c803..a59dc766c51 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b5..ecff36e416a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be0..a08ff749ee1 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63a..e9022fd0285 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java index 93533c28822..d59005adf17 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java index edcbc354be6..28016fa5ad6 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2ad..e2a67cf25d8 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b60..a5ef34a2331 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java index 3b8d16cabf2..aaa03c570f2 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java index 513131a9fa7..8ebd0f46a62 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e9..4d79aa66c54 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf7..a072f992671 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java index f63a8de2c15..b5d0c2e2505 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e261..dc59cf9c78c 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java index 1530a53f53f..f179e8e4233 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index eafbcb4ecb8..8848aaab327 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java index 97349fef05c..c00e48ea6c7 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e2..1df487b3539 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09c..3b05293b830 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java index 46069fdd14b..a9835f910ac 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429b..a990653f20d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java index e1a5d94cc8f..1b5522ac6a2 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java index c84687b699f..38d92a5b917 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008d..1ff292f1851 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353c..9eabbe3eca4 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java index 9f8f3a25234..b3d49a2dc6a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java index 501c556de27..ef3270b7aff 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java index f6093ba101c..2bf46ca2d47 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -27,11 +26,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @@ -40,21 +40,23 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback); @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java index cad2976330f..77e60eece4c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java @@ -18,19 +18,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final FakeApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -38,8 +31,8 @@ public class FakeApiController implements FakeApi { this.delegate = delegate; } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return delegate.testClientModel(body); } @@ -57,8 +50,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } @@ -70,8 +62,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return delegate.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApi.java index bd3568f20e1..bee707d7989 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApi.java @@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -24,10 +23,11 @@ public interface FakeClassnameTestApi { @ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake_classname_test", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApiController.java index 639ff90c1e5..a66d2df9175 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApiController.java @@ -15,19 +15,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeClassnameTestApiController implements FakeClassnameTestApi { - private final ObjectMapper objectMapper; - - public FakeClassnameTestApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final FakeClassnameTestApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -35,8 +28,8 @@ public class FakeClassnameTestApiController implements FakeClassnameTestApi { this.delegate = delegate; } - public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return delegate.testClassname(body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java index 1227aedbbd7..9e5bad2b5a2 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApi.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -31,11 +30,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -46,10 +46,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -61,10 +62,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status); @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 = { @@ -76,10 +78,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -89,10 +92,11 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -105,11 +109,12 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -120,11 +125,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -135,10 +141,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java index 7adec37e9ba..e8c28faa9be 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/PetApiController.java @@ -17,19 +17,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final PetApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -37,55 +30,48 @@ public class PetApiController implements PetApi { this.delegate = delegate; } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return delegate.addPet(body); } public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return delegate.deletePet(petId, apiKey); } - public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! return delegate.findPetsByStatus(status); } - public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! return delegate.findPetsByTags(tags); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! return delegate.getPetById(petId); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return delegate.updatePet(body); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return delegate.updatePetWithForm(petId, name, status); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! return delegate.uploadFile(petId, additionalMetadata, file); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java index fb8f3d706f5..8b080a440dd 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -26,10 +25,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -37,10 +37,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @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", }) @@ -48,19 +49,21 @@ public interface StoreApi { @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) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId); @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) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java index 4d0ff13f995..9ca8e80b316 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/StoreApiController.java @@ -16,19 +16,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final StoreApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -36,25 +29,23 @@ public class StoreApiController implements StoreApi { this.delegate = delegate; } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return delegate.deleteOrder(orderId); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! return delegate.getInventory(); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! return delegate.getOrderById(orderId); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! return delegate.placeOrder(body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java index adc0d21d30b..55fe9faf684 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -25,38 +24,42 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @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) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @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) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -64,38 +67,42 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @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) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); @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) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java index 0264f9026a4..468a1cee150 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/UserApiController.java @@ -16,19 +16,12 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - private final UserApiDelegate delegate; @org.springframework.beans.factory.annotation.Autowired @@ -36,51 +29,45 @@ public class UserApiController implements UserApi { this.delegate = delegate; } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return delegate.createUser(body); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return delegate.createUsersWithArrayInput(body); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return delegate.createUsersWithListInput(body); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return delegate.deleteUser(username); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! return delegate.getUserByName(username); } public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, - @RequestHeader("Accept") String accept) throws IOException { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! return delegate.loginUser(username, password); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return delegate.logoutUser(); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return delegate.updateUser(username, body); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0d..532576aad86 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java index bc957d1c803..a59dc766c51 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b5..ecff36e416a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be0..a08ff749ee1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63a..e9022fd0285 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java index 93533c28822..d59005adf17 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java index edcbc354be6..28016fa5ad6 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2ad..e2a67cf25d8 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b60..a5ef34a2331 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java index 3b8d16cabf2..aaa03c570f2 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java index 513131a9fa7..8ebd0f46a62 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e9..4d79aa66c54 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf7..a072f992671 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java index 2aaa5179f61..66baac16d0d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e261..dc59cf9c78c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java index 1530a53f53f..f179e8e4233 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 21cb67378eb..a10376d49b7 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java index 97349fef05c..c00e48ea6c7 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e2..1df487b3539 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09c..3b05293b830 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java index 46069fdd14b..a9835f910ac 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429b..a990653f20d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java index 3ba7e5a0a85..e686203d0e1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java index c84687b699f..38d92a5b917 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008d..1ff292f1851 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353c..9eabbe3eca4 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java index 9f8f3a25234..b3d49a2dc6a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java index 501c556de27..ef3270b7aff 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java index f6093ba101c..2bf46ca2d47 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -27,11 +26,12 @@ public interface FakeApi { @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @@ -40,21 +40,23 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback); @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) + @RequestMapping(value = "/fake", produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java index 4199a81f8e1..03822df3547 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java @@ -18,27 +18,17 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } @@ -55,8 +45,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) OffsetDateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -68,8 +57,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeClassnameTestApi.java index bd3568f20e1..bee707d7989 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeClassnameTestApi.java @@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -24,10 +23,11 @@ public interface FakeClassnameTestApi { @ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake_classname_test", produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeClassnameTestApiController.java index 4c37c7a71de..f708c48b302 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeClassnameTestApiController.java @@ -13,8 +13,6 @@ import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; import java.util.List; @@ -23,16 +21,11 @@ import javax.validation.Valid; @Controller public class FakeClassnameTestApiController implements FakeClassnameTestApi { - public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + + + + public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! - - ObjectMapper objectMapper = new ObjectMapper(); - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java index 1227aedbbd7..9e5bad2b5a2 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApi.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -31,11 +30,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -46,10 +46,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -61,10 +62,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status); @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 = { @@ -76,10 +78,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -89,10 +92,11 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -105,11 +109,12 @@ public interface PetApi { @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) }) + @RequestMapping(value = "/pet", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -120,11 +125,12 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -135,10 +141,11 @@ public interface PetApi { }, tags={ "pet", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/pet/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java index 66e1dbda18d..6ad4390e166 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/PetApiController.java @@ -17,104 +17,57 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 doggie aeiou aeiou", Pet.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java index fb8f3d706f5..8b080a440dd 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -26,10 +25,11 @@ public interface StoreApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -37,10 +37,11 @@ public interface StoreApi { }, tags={ "store", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @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", }) @@ -48,19 +49,21 @@ public interface StoreApi { @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) }) + @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId); @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) }) + @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java index 6154d9c2639..472bda2ada0 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/StoreApiController.java @@ -16,64 +16,32 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java index adc0d21d30b..55fe9faf684 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -25,38 +24,42 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @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) }) + @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @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) }) + @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -64,38 +67,42 @@ public interface UserApi { @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @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) }) + @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); @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) }) + @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @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) }) + @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java index 24b7e18b995..e751209da25 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/UserApiController.java @@ -16,84 +16,53 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123", User.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, - @RequestHeader("Accept") String accept) throws IOException { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue("aeiou", String.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0d..532576aad86 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java index bc957d1c803..a59dc766c51 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b5..ecff36e416a 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be0..a08ff749ee1 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63a..e9022fd0285 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java index 93533c28822..d59005adf17 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java index edcbc354be6..28016fa5ad6 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2ad..e2a67cf25d8 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b60..a5ef34a2331 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java index 3b8d16cabf2..aaa03c570f2 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java index 513131a9fa7..8ebd0f46a62 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e9..4d79aa66c54 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf7..a072f992671 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java index 2aaa5179f61..66baac16d0d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e261..dc59cf9c78c 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java index 1530a53f53f..f179e8e4233 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 21cb67378eb..a10376d49b7 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java index 97349fef05c..c00e48ea6c7 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e2..1df487b3539 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09c..3b05293b830 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java index 46069fdd14b..a9835f910ac 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429b..a990653f20d 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java index 3ba7e5a0a85..e686203d0e1 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public OffsetDateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java index c84687b699f..38d92a5b917 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008d..1ff292f1851 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353c..9eabbe3eca4 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java index 9f8f3a25234..b3d49a2dc6a 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java index 501c556de27..ef3270b7aff 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; }