From f101a43b9e3c51cce5e657c56b861794bffea2cd Mon Sep 17 00:00:00 2001 From: Ravi Date: Fri, 5 May 2017 02:47:39 -0500 Subject: [PATCH 01/22] [C++][CppRest] Add CMake file template to generate CMakeLists build file (#5561) * Add operationId in exception message * add number data type mapping * removing mergetool lines * first draft of cmake file * compiles generated source files with 64 bit cpprest and boost * using glob recurs to add source files * using glob recurse for source files * cmake to build statuc library * add cmake style comments, use project source dir and lib * fix_issue5488: Add supporting files and source files separately * fix_issue5488: Add supporting files and source files separately * fix_issue5488: Add supporting files and source files separately * fix_issue5488 - updated header comments * updated samples --- .../languages/CppRestClientCodegen.java | 1 + .../resources/cpprest/cmake-lists.mustache | 49 ++++++++++++++++ samples/client/petstore/cpprest/ApiClient.cpp | 4 +- samples/client/petstore/cpprest/ApiClient.h | 4 +- .../petstore/cpprest/ApiConfiguration.cpp | 4 +- .../petstore/cpprest/ApiConfiguration.h | 4 +- .../client/petstore/cpprest/ApiException.cpp | 4 +- .../client/petstore/cpprest/ApiException.h | 4 +- .../client/petstore/cpprest/CMakeLists.txt | 49 ++++++++++++++++ .../client/petstore/cpprest/HttpContent.cpp | 4 +- samples/client/petstore/cpprest/HttpContent.h | 4 +- samples/client/petstore/cpprest/IHttpBody.h | 4 +- samples/client/petstore/cpprest/JsonBody.cpp | 4 +- samples/client/petstore/cpprest/JsonBody.h | 4 +- samples/client/petstore/cpprest/ModelBase.cpp | 4 +- samples/client/petstore/cpprest/ModelBase.h | 4 +- .../petstore/cpprest/MultipartFormData.cpp | 4 +- .../petstore/cpprest/MultipartFormData.h | 4 +- .../client/petstore/cpprest/api/PetApi.cpp | 57 +++++-------------- samples/client/petstore/cpprest/api/PetApi.h | 21 ++++--- .../client/petstore/cpprest/api/StoreApi.cpp | 19 +++---- .../client/petstore/cpprest/api/StoreApi.h | 8 +-- .../client/petstore/cpprest/api/UserApi.cpp | 32 ++++------- samples/client/petstore/cpprest/api/UserApi.h | 14 ++--- .../petstore/cpprest/model/Category.cpp | 4 +- .../client/petstore/cpprest/model/Category.h | 8 +-- .../client/petstore/cpprest/model/Order.cpp | 4 +- samples/client/petstore/cpprest/model/Order.h | 8 +-- samples/client/petstore/cpprest/model/Pet.cpp | 4 +- samples/client/petstore/cpprest/model/Pet.h | 8 +-- samples/client/petstore/cpprest/model/Tag.cpp | 4 +- samples/client/petstore/cpprest/model/Tag.h | 8 +-- .../client/petstore/cpprest/model/User.cpp | 4 +- samples/client/petstore/cpprest/model/User.h | 8 +-- 34 files changed, 212 insertions(+), 158 deletions(-) create mode 100644 modules/swagger-codegen/src/main/resources/cpprest/cmake-lists.mustache create mode 100644 samples/client/petstore/cpprest/CMakeLists.txt 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/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/samples/client/petstore/cpprest/ApiClient.cpp b/samples/client/petstore/cpprest/ApiClient.cpp index aeed9ef42ae..28c2730548a 100644 --- a/samples/client/petstore/cpprest/ApiClient.cpp +++ b/samples/client/petstore/cpprest/ApiClient.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiClient.h b/samples/client/petstore/cpprest/ApiClient.h index 1f38c864f0e..d4cc7f6065b 100644 --- a/samples/client/petstore/cpprest/ApiClient.h +++ b/samples/client/petstore/cpprest/ApiClient.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiConfiguration.cpp b/samples/client/petstore/cpprest/ApiConfiguration.cpp index 1520a56d347..ddbc1bc3eb2 100644 --- a/samples/client/petstore/cpprest/ApiConfiguration.cpp +++ b/samples/client/petstore/cpprest/ApiConfiguration.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiConfiguration.h b/samples/client/petstore/cpprest/ApiConfiguration.h index 0574783f690..cef9cbff0cb 100644 --- a/samples/client/petstore/cpprest/ApiConfiguration.h +++ b/samples/client/petstore/cpprest/ApiConfiguration.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiException.cpp b/samples/client/petstore/cpprest/ApiException.cpp index 5ddf808f9f0..8e3646eb973 100644 --- a/samples/client/petstore/cpprest/ApiException.cpp +++ b/samples/client/petstore/cpprest/ApiException.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiException.h b/samples/client/petstore/cpprest/ApiException.h index 835752ea75b..43d0746ca41 100644 --- a/samples/client/petstore/cpprest/ApiException.h +++ b/samples/client/petstore/cpprest/ApiException.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/CMakeLists.txt b/samples/client/petstore/cpprest/CMakeLists.txt new file mode 100644 index 00000000000..fb3ff6e7ccb --- /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 or on irc.freenode.net, #swagger. 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/cpprest/HttpContent.cpp b/samples/client/petstore/cpprest/HttpContent.cpp index e9a619d7753..b6e9ff911c1 100644 --- a/samples/client/petstore/cpprest/HttpContent.cpp +++ b/samples/client/petstore/cpprest/HttpContent.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/HttpContent.h b/samples/client/petstore/cpprest/HttpContent.h index 6b7bae0a5f7..a07f5d14e79 100644 --- a/samples/client/petstore/cpprest/HttpContent.h +++ b/samples/client/petstore/cpprest/HttpContent.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/IHttpBody.h b/samples/client/petstore/cpprest/IHttpBody.h index 0ccf80876e9..1d320e2f809 100644 --- a/samples/client/petstore/cpprest/IHttpBody.h +++ b/samples/client/petstore/cpprest/IHttpBody.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/JsonBody.cpp b/samples/client/petstore/cpprest/JsonBody.cpp index 41ce32702c3..554953f40cc 100644 --- a/samples/client/petstore/cpprest/JsonBody.cpp +++ b/samples/client/petstore/cpprest/JsonBody.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/JsonBody.h b/samples/client/petstore/cpprest/JsonBody.h index 335be0a72b6..86ee4459c72 100644 --- a/samples/client/petstore/cpprest/JsonBody.h +++ b/samples/client/petstore/cpprest/JsonBody.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ModelBase.cpp b/samples/client/petstore/cpprest/ModelBase.cpp index 07f44a15a0e..4ed24aa8a0b 100644 --- a/samples/client/petstore/cpprest/ModelBase.cpp +++ b/samples/client/petstore/cpprest/ModelBase.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ModelBase.h b/samples/client/petstore/cpprest/ModelBase.h index 558d403b15d..6f801828dda 100644 --- a/samples/client/petstore/cpprest/ModelBase.h +++ b/samples/client/petstore/cpprest/ModelBase.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/MultipartFormData.cpp b/samples/client/petstore/cpprest/MultipartFormData.cpp index a7e5f56c9f9..ba4ec6537fd 100644 --- a/samples/client/petstore/cpprest/MultipartFormData.cpp +++ b/samples/client/petstore/cpprest/MultipartFormData.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/MultipartFormData.h b/samples/client/petstore/cpprest/MultipartFormData.h index 63b84dcb3a9..997ed75e211 100644 --- a/samples/client/petstore/cpprest/MultipartFormData.h +++ b/samples/client/petstore/cpprest/MultipartFormData.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/api/PetApi.cpp b/samples/client/petstore/cpprest/api/PetApi.cpp index a5e3d57c70b..dc826e379e6 100644 --- a/samples/client/petstore/cpprest/api/PetApi.cpp +++ b/samples/client/petstore/cpprest/api/PetApi.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -39,12 +39,6 @@ PetApi::~PetApi() pplx::task PetApi::addPet(std::shared_ptr body) { - // verify the required parameter 'body' is set - if (body == nullptr) - { - throw ApiException(400, U("Missing required parameter 'body' when calling PetApi->addPet")); - } - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet"); @@ -55,8 +49,8 @@ pplx::task PetApi::addPet(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -172,8 +166,8 @@ pplx::task PetApi::deletePet(int64_t petId, utility::string_t apiKey) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -277,8 +271,8 @@ pplx::task>> PetApi::findPetsByStatus(std::vect std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -407,8 +401,8 @@ pplx::task>> PetApi::findPetsByTags(std::vector std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -538,8 +532,8 @@ pplx::task> PetApi::getPetById(int64_t petId) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -589,6 +583,8 @@ pplx::task> PetApi::getPetById(int64_t petId) //Set the request content type in the header. headerParams[U("Content-Type")] = requestHttpContentType; + // authentication (petstore_auth) required + // oauth2 authentication is added automatically as part of the http_client_config // authentication (api_key) required { utility::string_t apiKey = apiConfiguration->getApiKey(U("api_key")); @@ -653,12 +649,6 @@ pplx::task> PetApi::getPetById(int64_t petId) pplx::task PetApi::updatePet(std::shared_ptr body) { - // verify the required parameter 'body' is set - if (body == nullptr) - { - throw ApiException(400, U("Missing required parameter 'body' when calling PetApi->updatePet")); - } - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet"); @@ -669,8 +659,8 @@ pplx::task PetApi::updatePet(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -772,7 +762,7 @@ pplx::task PetApi::updatePet(std::shared_ptr body) return void(); }); } -pplx::task PetApi::updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status) +pplx::task PetApi::updatePetWithForm(utility::string_t petId, utility::string_t name, utility::string_t status) { @@ -786,8 +776,8 @@ pplx::task PetApi::updatePetWithForm(int64_t petId, utility::string_t name std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -883,7 +873,7 @@ pplx::task PetApi::updatePetWithForm(int64_t petId, utility::string_t name return void(); }); } -pplx::task> PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file) +pplx::task PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file) { @@ -898,6 +888,7 @@ pplx::task> PetApi::uploadFile(int64_t petId, utili std::unordered_set responseHttpContentTypes; responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -990,25 +981,7 @@ pplx::task> PetApi::uploadFile(int64_t petId, utili }) .then([=](utility::string_t response) { - std::shared_ptr result(new ApiResponse()); - - if(responseHttpContentType == U("application/json")) - { - web::json::value json = web::json::value::parse(response); - - result->fromJson(json); - } - // else if(responseHttpContentType == U("multipart/form-data")) - // { - // TODO multipart response parsing - // } - else - { - throw ApiException(500 - , U("error calling uploadFile: unsupported response type")); - } - - return result; + return void(); }); } diff --git a/samples/client/petstore/cpprest/api/PetApi.h b/samples/client/petstore/cpprest/api/PetApi.h index d60c3c80fca..067b09f65c5 100644 --- a/samples/client/petstore/cpprest/api/PetApi.h +++ b/samples/client/petstore/cpprest/api/PetApi.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -22,7 +22,6 @@ #include "ApiClient.h" -#include "ApiResponse.h" #include "HttpContent.h" #include "Pet.h" #include @@ -45,7 +44,7 @@ public: /// /// /// - /// Pet object that needs to be added to the store + /// Pet object that needs to be added to the store (optional) pplx::task addPet(std::shared_ptr body); /// /// Deletes a pet @@ -61,7 +60,7 @@ public: /// /// Multiple status values can be provided with comma separated strings /// - /// Status values that need to be considered for filter + /// Status values that need to be considered for filter (optional, default to available) pplx::task>> findPetsByStatus(std::vector status); /// /// Finds Pets by tags @@ -69,15 +68,15 @@ public: /// /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// - /// Tags to filter by + /// Tags to filter by (optional) pplx::task>> findPetsByTags(std::vector tags); /// /// Find pet by ID /// /// - /// Returns a single pet + /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions /// - /// ID of pet to return + /// ID of pet that needs to be fetched pplx::task> getPetById(int64_t petId); /// /// Update an existing pet @@ -85,7 +84,7 @@ public: /// /// /// - /// Pet object that needs to be added to the store + /// Pet object that needs to be added to the store (optional) pplx::task updatePet(std::shared_ptr body); /// /// Updates a pet in the store with form data @@ -94,7 +93,7 @@ public: /// /// /// ID of pet that needs to be updated/// Updated name of the pet (optional)/// Updated status of the pet (optional) - pplx::task updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status); + pplx::task updatePetWithForm(utility::string_t petId, utility::string_t name, utility::string_t status); /// /// uploads an image /// @@ -102,7 +101,7 @@ public: /// /// /// ID of pet to update/// Additional data to pass to server (optional)/// file to upload (optional) - pplx::task> uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file); + pplx::task uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file); protected: std::shared_ptr m_ApiClient; diff --git a/samples/client/petstore/cpprest/api/StoreApi.cpp b/samples/client/petstore/cpprest/api/StoreApi.cpp index d418af4fa4c..ecafffd45d7 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.cpp +++ b/samples/client/petstore/cpprest/api/StoreApi.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -50,8 +50,8 @@ pplx::task StoreApi::deleteOrder(utility::string_t orderId) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -150,6 +150,7 @@ pplx::task> StoreApi::getInventory() std::unordered_set responseHttpContentTypes; responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -265,7 +266,7 @@ pplx::task> StoreApi::getInventory() return result; }); } -pplx::task> StoreApi::getOrderById(int64_t orderId) +pplx::task> StoreApi::getOrderById(utility::string_t orderId) { @@ -279,8 +280,8 @@ pplx::task> StoreApi::getOrderById(int64_t orderId) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -386,12 +387,6 @@ pplx::task> StoreApi::getOrderById(int64_t orderId) pplx::task> StoreApi::placeOrder(std::shared_ptr body) { - // verify the required parameter 'body' is set - if (body == nullptr) - { - throw ApiException(400, U("Missing required parameter 'body' when calling StoreApi->placeOrder")); - } - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/store/order"); @@ -402,8 +397,8 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr b std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; diff --git a/samples/client/petstore/cpprest/api/StoreApi.h b/samples/client/petstore/cpprest/api/StoreApi.h index 60ec088b326..f752b02e78d 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.h +++ b/samples/client/petstore/cpprest/api/StoreApi.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -61,14 +61,14 @@ public: /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions /// /// ID of pet that needs to be fetched - pplx::task> getOrderById(int64_t orderId); + pplx::task> getOrderById(utility::string_t orderId); /// /// Place an order for a pet /// /// /// /// - /// order placed for purchasing the pet + /// order placed for purchasing the pet (optional) pplx::task> placeOrder(std::shared_ptr body); protected: diff --git a/samples/client/petstore/cpprest/api/UserApi.cpp b/samples/client/petstore/cpprest/api/UserApi.cpp index 3e0318000f9..de3736a0ade 100644 --- a/samples/client/petstore/cpprest/api/UserApi.cpp +++ b/samples/client/petstore/cpprest/api/UserApi.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -39,12 +39,6 @@ UserApi::~UserApi() pplx::task UserApi::createUser(std::shared_ptr body) { - // verify the required parameter 'body' is set - if (body == nullptr) - { - throw ApiException(400, U("Missing required parameter 'body' when calling UserApi->createUser")); - } - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user"); @@ -55,8 +49,8 @@ pplx::task UserApi::createUser(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -167,8 +161,8 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -292,8 +286,8 @@ pplx::task UserApi::createUsersWithListInput(std::vector> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -418,8 +412,8 @@ pplx::task UserApi::deleteUser(utility::string_t username) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -518,8 +512,8 @@ pplx::task> UserApi::getUserByName(utility::string_t usern std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -635,8 +629,8 @@ pplx::task UserApi::loginUser(utility::string_t username, uti std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -770,8 +764,8 @@ pplx::task UserApi::logoutUser() std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -859,12 +853,6 @@ pplx::task UserApi::logoutUser() pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr body) { - // verify the required parameter 'body' is set - if (body == nullptr) - { - throw ApiException(400, U("Missing required parameter 'body' when calling UserApi->updateUser")); - } - std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user/{username}"); @@ -876,8 +864,8 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/xml") ); responseHttpContentTypes.insert( U("application/json") ); + responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; diff --git a/samples/client/petstore/cpprest/api/UserApi.h b/samples/client/petstore/cpprest/api/UserApi.h index e94de1a1241..cd7e5cba4da 100644 --- a/samples/client/petstore/cpprest/api/UserApi.h +++ b/samples/client/petstore/cpprest/api/UserApi.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -44,7 +44,7 @@ public: /// /// This can only be done by the logged in user. /// - /// Created user object + /// Created user object (optional) pplx::task createUser(std::shared_ptr body); /// /// Creates list of users with given input array @@ -52,7 +52,7 @@ public: /// /// /// - /// List of user object + /// List of user object (optional) pplx::task createUsersWithArrayInput(std::vector> body); /// /// Creates list of users with given input array @@ -60,7 +60,7 @@ public: /// /// /// - /// List of user object + /// List of user object (optional) pplx::task createUsersWithListInput(std::vector> body); /// /// Delete user @@ -84,7 +84,7 @@ public: /// /// /// - /// The user name for login/// The password for login in clear text + /// The user name for login (optional)/// The password for login in clear text (optional) pplx::task loginUser(utility::string_t username, utility::string_t password); /// /// Logs out current logged in user session @@ -100,7 +100,7 @@ public: /// /// This can only be done by the logged in user. /// - /// name that need to be deleted/// Updated user object + /// name that need to be deleted/// Updated user object (optional) pplx::task updateUser(utility::string_t username, std::shared_ptr body); protected: diff --git a/samples/client/petstore/cpprest/model/Category.cpp b/samples/client/petstore/cpprest/model/Category.cpp index bdb6d8e894a..560cf9070dc 100644 --- a/samples/client/petstore/cpprest/model/Category.cpp +++ b/samples/client/petstore/cpprest/model/Category.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Category.h b/samples/client/petstore/cpprest/model/Category.h index 80e759424a9..4423f489458 100644 --- a/samples/client/petstore/cpprest/model/Category.h +++ b/samples/client/petstore/cpprest/model/Category.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Category.h * - * A category for a pet + * */ #ifndef Category_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// A category for a pet +/// /// class Category : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Order.cpp b/samples/client/petstore/cpprest/model/Order.cpp index e21d867cd7e..86d26aae977 100644 --- a/samples/client/petstore/cpprest/model/Order.cpp +++ b/samples/client/petstore/cpprest/model/Order.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Order.h b/samples/client/petstore/cpprest/model/Order.h index b8f22de9f47..f5d950b8b8f 100644 --- a/samples/client/petstore/cpprest/model/Order.h +++ b/samples/client/petstore/cpprest/model/Order.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Order.h * - * An order for a pets from the pet store + * */ #ifndef Order_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// An order for a pets from the pet store +/// /// class Order : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Pet.cpp b/samples/client/petstore/cpprest/model/Pet.cpp index 51dd6d883e9..8aec0bf3663 100644 --- a/samples/client/petstore/cpprest/model/Pet.cpp +++ b/samples/client/petstore/cpprest/model/Pet.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Pet.h b/samples/client/petstore/cpprest/model/Pet.h index 065c46bdb93..8fb6958a632 100644 --- a/samples/client/petstore/cpprest/model/Pet.h +++ b/samples/client/petstore/cpprest/model/Pet.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Pet.h * - * A pet for sale in the pet store + * */ #ifndef Pet_H_ @@ -33,7 +33,7 @@ namespace client { namespace model { /// -/// A pet for sale in the pet store +/// /// class Pet : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Tag.cpp b/samples/client/petstore/cpprest/model/Tag.cpp index 3cb0798c99e..faff276fd27 100644 --- a/samples/client/petstore/cpprest/model/Tag.cpp +++ b/samples/client/petstore/cpprest/model/Tag.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Tag.h b/samples/client/petstore/cpprest/model/Tag.h index a977ca07980..a429241f59f 100644 --- a/samples/client/petstore/cpprest/model/Tag.h +++ b/samples/client/petstore/cpprest/model/Tag.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Tag.h * - * A tag for a pet + * */ #ifndef Tag_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// A tag for a pet +/// /// class Tag : public ModelBase diff --git a/samples/client/petstore/cpprest/model/User.cpp b/samples/client/petstore/cpprest/model/User.cpp index 1ea09f35b50..54780080036 100644 --- a/samples/client/petstore/cpprest/model/User.cpp +++ b/samples/client/petstore/cpprest/model/User.cpp @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/User.h b/samples/client/petstore/cpprest/model/User.h index 83b2120a360..10e18fd68b6 100644 --- a/samples/client/petstore/cpprest/model/User.h +++ b/samples/client/petstore/cpprest/model/User.h @@ -1,9 +1,9 @@ /** * 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. + * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. 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 + * Contact: apiteam@wordnik.com * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * User.h * - * A User who is purchasing from the pet store + * */ #ifndef User_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// A User who is purchasing from the pet store +/// /// class User : public ModelBase From 8e6dfce83e5c55666deb2537b04eccb0cd5804f2 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Fri, 5 May 2017 03:58:01 -0400 Subject: [PATCH 02/22] [csharp2] Extend generator from AbstractCSharpCodegen (#5552) * [csharp2] Extend generator from AbstractCSharpCodegen * [csharp2] regenerate sample --- .../languages/CsharpDotNet2ClientCodegen.java | 275 +++--------------- .../Lib/SwaggerClient/docs/ApiResponse.md | 6 +- .../Lib/SwaggerClient/docs/Category.md | 4 +- .../Lib/SwaggerClient/docs/Order.md | 12 +- .../Lib/SwaggerClient/docs/Pet.md | 12 +- .../Lib/SwaggerClient/docs/StoreApi.md | 6 +- .../Lib/SwaggerClient/docs/Tag.md | 4 +- .../Lib/SwaggerClient/docs/User.md | 16 +- .../CsharpDotNet2/IO/Swagger/Api/StoreApi.cs | 10 +- 9 files changed, 71 insertions(+), 274 deletions(-) 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/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); } /// From 8e0d940e0a4ba07b27d5888e303baad4474cadbd Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 5 May 2017 16:20:59 +0800 Subject: [PATCH 03/22] update cpprest petstore sample --- samples/client/petstore/cpprest/ApiClient.cpp | 4 +- samples/client/petstore/cpprest/ApiClient.h | 4 +- .../petstore/cpprest/ApiConfiguration.cpp | 4 +- .../petstore/cpprest/ApiConfiguration.h | 4 +- .../client/petstore/cpprest/ApiException.cpp | 4 +- .../client/petstore/cpprest/ApiException.h | 4 +- .../client/petstore/cpprest/CMakeLists.txt | 2 +- .../client/petstore/cpprest/HttpContent.cpp | 4 +- samples/client/petstore/cpprest/HttpContent.h | 4 +- samples/client/petstore/cpprest/IHttpBody.h | 4 +- samples/client/petstore/cpprest/JsonBody.cpp | 4 +- samples/client/petstore/cpprest/JsonBody.h | 4 +- samples/client/petstore/cpprest/ModelBase.cpp | 4 +- samples/client/petstore/cpprest/ModelBase.h | 4 +- .../petstore/cpprest/MultipartFormData.cpp | 4 +- .../petstore/cpprest/MultipartFormData.h | 4 +- .../client/petstore/cpprest/api/PetApi.cpp | 57 ++++++++++++++----- samples/client/petstore/cpprest/api/PetApi.h | 21 +++---- .../client/petstore/cpprest/api/StoreApi.cpp | 19 ++++--- .../client/petstore/cpprest/api/StoreApi.h | 8 +-- .../client/petstore/cpprest/api/UserApi.cpp | 32 +++++++---- samples/client/petstore/cpprest/api/UserApi.h | 14 ++--- .../petstore/cpprest/model/Category.cpp | 4 +- .../client/petstore/cpprest/model/Category.h | 8 +-- .../client/petstore/cpprest/model/Order.cpp | 4 +- samples/client/petstore/cpprest/model/Order.h | 8 +-- samples/client/petstore/cpprest/model/Pet.cpp | 4 +- samples/client/petstore/cpprest/model/Pet.h | 8 +-- samples/client/petstore/cpprest/model/Tag.cpp | 4 +- samples/client/petstore/cpprest/model/Tag.h | 8 +-- .../client/petstore/cpprest/model/User.cpp | 4 +- samples/client/petstore/cpprest/model/User.h | 8 +-- 32 files changed, 159 insertions(+), 114 deletions(-) diff --git a/samples/client/petstore/cpprest/ApiClient.cpp b/samples/client/petstore/cpprest/ApiClient.cpp index 28c2730548a..aeed9ef42ae 100644 --- a/samples/client/petstore/cpprest/ApiClient.cpp +++ b/samples/client/petstore/cpprest/ApiClient.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiClient.h b/samples/client/petstore/cpprest/ApiClient.h index d4cc7f6065b..1f38c864f0e 100644 --- a/samples/client/petstore/cpprest/ApiClient.h +++ b/samples/client/petstore/cpprest/ApiClient.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiConfiguration.cpp b/samples/client/petstore/cpprest/ApiConfiguration.cpp index ddbc1bc3eb2..1520a56d347 100644 --- a/samples/client/petstore/cpprest/ApiConfiguration.cpp +++ b/samples/client/petstore/cpprest/ApiConfiguration.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiConfiguration.h b/samples/client/petstore/cpprest/ApiConfiguration.h index cef9cbff0cb..0574783f690 100644 --- a/samples/client/petstore/cpprest/ApiConfiguration.h +++ b/samples/client/petstore/cpprest/ApiConfiguration.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiException.cpp b/samples/client/petstore/cpprest/ApiException.cpp index 8e3646eb973..5ddf808f9f0 100644 --- a/samples/client/petstore/cpprest/ApiException.cpp +++ b/samples/client/petstore/cpprest/ApiException.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ApiException.h b/samples/client/petstore/cpprest/ApiException.h index 43d0746ca41..835752ea75b 100644 --- a/samples/client/petstore/cpprest/ApiException.h +++ b/samples/client/petstore/cpprest/ApiException.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/CMakeLists.txt b/samples/client/petstore/cpprest/CMakeLists.txt index fb3ff6e7ccb..de2e2851960 100644 --- a/samples/client/petstore/cpprest/CMakeLists.txt +++ b/samples/client/petstore/cpprest/CMakeLists.txt @@ -1,6 +1,6 @@ # # Swagger Petstore -# This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +# 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 # diff --git a/samples/client/petstore/cpprest/HttpContent.cpp b/samples/client/petstore/cpprest/HttpContent.cpp index b6e9ff911c1..e9a619d7753 100644 --- a/samples/client/petstore/cpprest/HttpContent.cpp +++ b/samples/client/petstore/cpprest/HttpContent.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/HttpContent.h b/samples/client/petstore/cpprest/HttpContent.h index a07f5d14e79..6b7bae0a5f7 100644 --- a/samples/client/petstore/cpprest/HttpContent.h +++ b/samples/client/petstore/cpprest/HttpContent.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/IHttpBody.h b/samples/client/petstore/cpprest/IHttpBody.h index 1d320e2f809..0ccf80876e9 100644 --- a/samples/client/petstore/cpprest/IHttpBody.h +++ b/samples/client/petstore/cpprest/IHttpBody.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/JsonBody.cpp b/samples/client/petstore/cpprest/JsonBody.cpp index 554953f40cc..41ce32702c3 100644 --- a/samples/client/petstore/cpprest/JsonBody.cpp +++ b/samples/client/petstore/cpprest/JsonBody.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/JsonBody.h b/samples/client/petstore/cpprest/JsonBody.h index 86ee4459c72..335be0a72b6 100644 --- a/samples/client/petstore/cpprest/JsonBody.h +++ b/samples/client/petstore/cpprest/JsonBody.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ModelBase.cpp b/samples/client/petstore/cpprest/ModelBase.cpp index 4ed24aa8a0b..07f44a15a0e 100644 --- a/samples/client/petstore/cpprest/ModelBase.cpp +++ b/samples/client/petstore/cpprest/ModelBase.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/ModelBase.h b/samples/client/petstore/cpprest/ModelBase.h index 6f801828dda..558d403b15d 100644 --- a/samples/client/petstore/cpprest/ModelBase.h +++ b/samples/client/petstore/cpprest/ModelBase.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/MultipartFormData.cpp b/samples/client/petstore/cpprest/MultipartFormData.cpp index ba4ec6537fd..a7e5f56c9f9 100644 --- a/samples/client/petstore/cpprest/MultipartFormData.cpp +++ b/samples/client/petstore/cpprest/MultipartFormData.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/MultipartFormData.h b/samples/client/petstore/cpprest/MultipartFormData.h index 997ed75e211..63b84dcb3a9 100644 --- a/samples/client/petstore/cpprest/MultipartFormData.h +++ b/samples/client/petstore/cpprest/MultipartFormData.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/api/PetApi.cpp b/samples/client/petstore/cpprest/api/PetApi.cpp index dc826e379e6..a5e3d57c70b 100644 --- a/samples/client/petstore/cpprest/api/PetApi.cpp +++ b/samples/client/petstore/cpprest/api/PetApi.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -39,6 +39,12 @@ PetApi::~PetApi() pplx::task PetApi::addPet(std::shared_ptr body) { + // verify the required parameter 'body' is set + if (body == nullptr) + { + throw ApiException(400, U("Missing required parameter 'body' when calling PetApi->addPet")); + } + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet"); @@ -49,8 +55,8 @@ pplx::task PetApi::addPet(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -166,8 +172,8 @@ pplx::task PetApi::deletePet(int64_t petId, utility::string_t apiKey) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -271,8 +277,8 @@ pplx::task>> PetApi::findPetsByStatus(std::vect std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -401,8 +407,8 @@ pplx::task>> PetApi::findPetsByTags(std::vector std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -532,8 +538,8 @@ pplx::task> PetApi::getPetById(int64_t petId) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -583,8 +589,6 @@ pplx::task> PetApi::getPetById(int64_t petId) //Set the request content type in the header. headerParams[U("Content-Type")] = requestHttpContentType; - // authentication (petstore_auth) required - // oauth2 authentication is added automatically as part of the http_client_config // authentication (api_key) required { utility::string_t apiKey = apiConfiguration->getApiKey(U("api_key")); @@ -649,6 +653,12 @@ pplx::task> PetApi::getPetById(int64_t petId) pplx::task PetApi::updatePet(std::shared_ptr body) { + // verify the required parameter 'body' is set + if (body == nullptr) + { + throw ApiException(400, U("Missing required parameter 'body' when calling PetApi->updatePet")); + } + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/pet"); @@ -659,8 +669,8 @@ pplx::task PetApi::updatePet(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -762,7 +772,7 @@ pplx::task PetApi::updatePet(std::shared_ptr body) return void(); }); } -pplx::task PetApi::updatePetWithForm(utility::string_t petId, utility::string_t name, utility::string_t status) +pplx::task PetApi::updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status) { @@ -776,8 +786,8 @@ pplx::task PetApi::updatePetWithForm(utility::string_t petId, utility::str std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -873,7 +883,7 @@ pplx::task PetApi::updatePetWithForm(utility::string_t petId, utility::str return void(); }); } -pplx::task PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file) +pplx::task> PetApi::uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file) { @@ -888,7 +898,6 @@ pplx::task PetApi::uploadFile(int64_t petId, utility::string_t additionalM std::unordered_set responseHttpContentTypes; responseHttpContentTypes.insert( U("application/json") ); - responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -981,7 +990,25 @@ pplx::task PetApi::uploadFile(int64_t petId, utility::string_t additionalM }) .then([=](utility::string_t response) { - return void(); + std::shared_ptr result(new ApiResponse()); + + if(responseHttpContentType == U("application/json")) + { + web::json::value json = web::json::value::parse(response); + + result->fromJson(json); + } + // else if(responseHttpContentType == U("multipart/form-data")) + // { + // TODO multipart response parsing + // } + else + { + throw ApiException(500 + , U("error calling uploadFile: unsupported response type")); + } + + return result; }); } diff --git a/samples/client/petstore/cpprest/api/PetApi.h b/samples/client/petstore/cpprest/api/PetApi.h index 067b09f65c5..d60c3c80fca 100644 --- a/samples/client/petstore/cpprest/api/PetApi.h +++ b/samples/client/petstore/cpprest/api/PetApi.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -22,6 +22,7 @@ #include "ApiClient.h" +#include "ApiResponse.h" #include "HttpContent.h" #include "Pet.h" #include @@ -44,7 +45,7 @@ public: /// /// /// - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store pplx::task addPet(std::shared_ptr body); /// /// Deletes a pet @@ -60,7 +61,7 @@ public: /// /// Multiple status values can be provided with comma separated strings /// - /// Status values that need to be considered for filter (optional, default to available) + /// Status values that need to be considered for filter pplx::task>> findPetsByStatus(std::vector status); /// /// Finds Pets by tags @@ -68,15 +69,15 @@ public: /// /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// - /// Tags to filter by (optional) + /// Tags to filter by pplx::task>> findPetsByTags(std::vector tags); /// /// Find pet by ID /// /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Returns a single pet /// - /// ID of pet that needs to be fetched + /// ID of pet to return pplx::task> getPetById(int64_t petId); /// /// Update an existing pet @@ -84,7 +85,7 @@ public: /// /// /// - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store pplx::task updatePet(std::shared_ptr body); /// /// Updates a pet in the store with form data @@ -93,7 +94,7 @@ public: /// /// /// ID of pet that needs to be updated/// Updated name of the pet (optional)/// Updated status of the pet (optional) - pplx::task updatePetWithForm(utility::string_t petId, utility::string_t name, utility::string_t status); + pplx::task updatePetWithForm(int64_t petId, utility::string_t name, utility::string_t status); /// /// uploads an image /// @@ -101,7 +102,7 @@ public: /// /// /// ID of pet to update/// Additional data to pass to server (optional)/// file to upload (optional) - pplx::task uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file); + pplx::task> uploadFile(int64_t petId, utility::string_t additionalMetadata, std::shared_ptr file); protected: std::shared_ptr m_ApiClient; diff --git a/samples/client/petstore/cpprest/api/StoreApi.cpp b/samples/client/petstore/cpprest/api/StoreApi.cpp index ecafffd45d7..d418af4fa4c 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.cpp +++ b/samples/client/petstore/cpprest/api/StoreApi.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -50,8 +50,8 @@ pplx::task StoreApi::deleteOrder(utility::string_t orderId) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -150,7 +150,6 @@ pplx::task> StoreApi::getInventory() std::unordered_set responseHttpContentTypes; responseHttpContentTypes.insert( U("application/json") ); - responseHttpContentTypes.insert( U("application/xml") ); utility::string_t responseHttpContentType; @@ -266,7 +265,7 @@ pplx::task> StoreApi::getInventory() return result; }); } -pplx::task> StoreApi::getOrderById(utility::string_t orderId) +pplx::task> StoreApi::getOrderById(int64_t orderId) { @@ -280,8 +279,8 @@ pplx::task> StoreApi::getOrderById(utility::string_t orde std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -387,6 +386,12 @@ pplx::task> StoreApi::getOrderById(utility::string_t orde pplx::task> StoreApi::placeOrder(std::shared_ptr body) { + // verify the required parameter 'body' is set + if (body == nullptr) + { + throw ApiException(400, U("Missing required parameter 'body' when calling StoreApi->placeOrder")); + } + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/store/order"); @@ -397,8 +402,8 @@ pplx::task> StoreApi::placeOrder(std::shared_ptr b std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; diff --git a/samples/client/petstore/cpprest/api/StoreApi.h b/samples/client/petstore/cpprest/api/StoreApi.h index f752b02e78d..60ec088b326 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.h +++ b/samples/client/petstore/cpprest/api/StoreApi.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -61,14 +61,14 @@ public: /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions /// /// ID of pet that needs to be fetched - pplx::task> getOrderById(utility::string_t orderId); + pplx::task> getOrderById(int64_t orderId); /// /// Place an order for a pet /// /// /// /// - /// order placed for purchasing the pet (optional) + /// order placed for purchasing the pet pplx::task> placeOrder(std::shared_ptr body); protected: diff --git a/samples/client/petstore/cpprest/api/UserApi.cpp b/samples/client/petstore/cpprest/api/UserApi.cpp index de3736a0ade..3e0318000f9 100644 --- a/samples/client/petstore/cpprest/api/UserApi.cpp +++ b/samples/client/petstore/cpprest/api/UserApi.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -39,6 +39,12 @@ UserApi::~UserApi() pplx::task UserApi::createUser(std::shared_ptr body) { + // verify the required parameter 'body' is set + if (body == nullptr) + { + throw ApiException(400, U("Missing required parameter 'body' when calling UserApi->createUser")); + } + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user"); @@ -49,8 +55,8 @@ pplx::task UserApi::createUser(std::shared_ptr body) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -161,8 +167,8 @@ pplx::task UserApi::createUsersWithArrayInput(std::vector> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -286,8 +292,8 @@ pplx::task UserApi::createUsersWithListInput(std::vector> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -412,8 +418,8 @@ pplx::task UserApi::deleteUser(utility::string_t username) std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -512,8 +518,8 @@ pplx::task> UserApi::getUserByName(utility::string_t usern std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -629,8 +635,8 @@ pplx::task UserApi::loginUser(utility::string_t username, uti std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -764,8 +770,8 @@ pplx::task UserApi::logoutUser() std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; @@ -853,6 +859,12 @@ pplx::task UserApi::logoutUser() pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr body) { + // verify the required parameter 'body' is set + if (body == nullptr) + { + throw ApiException(400, U("Missing required parameter 'body' when calling UserApi->updateUser")); + } + std::shared_ptr apiConfiguration( m_ApiClient->getConfiguration() ); utility::string_t path = U("/user/{username}"); @@ -864,8 +876,8 @@ pplx::task UserApi::updateUser(utility::string_t username, std::shared_ptr std::map> fileParams; std::unordered_set responseHttpContentTypes; - responseHttpContentTypes.insert( U("application/json") ); responseHttpContentTypes.insert( U("application/xml") ); + responseHttpContentTypes.insert( U("application/json") ); utility::string_t responseHttpContentType; diff --git a/samples/client/petstore/cpprest/api/UserApi.h b/samples/client/petstore/cpprest/api/UserApi.h index cd7e5cba4da..e94de1a1241 100644 --- a/samples/client/petstore/cpprest/api/UserApi.h +++ b/samples/client/petstore/cpprest/api/UserApi.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -44,7 +44,7 @@ public: /// /// This can only be done by the logged in user. /// - /// Created user object (optional) + /// Created user object pplx::task createUser(std::shared_ptr body); /// /// Creates list of users with given input array @@ -52,7 +52,7 @@ public: /// /// /// - /// List of user object (optional) + /// List of user object pplx::task createUsersWithArrayInput(std::vector> body); /// /// Creates list of users with given input array @@ -60,7 +60,7 @@ public: /// /// /// - /// List of user object (optional) + /// List of user object pplx::task createUsersWithListInput(std::vector> body); /// /// Delete user @@ -84,7 +84,7 @@ public: /// /// /// - /// The user name for login (optional)/// The password for login in clear text (optional) + /// The user name for login/// The password for login in clear text pplx::task loginUser(utility::string_t username, utility::string_t password); /// /// Logs out current logged in user session @@ -100,7 +100,7 @@ public: /// /// This can only be done by the logged in user. /// - /// name that need to be deleted/// Updated user object (optional) + /// name that need to be deleted/// Updated user object pplx::task updateUser(utility::string_t username, std::shared_ptr body); protected: diff --git a/samples/client/petstore/cpprest/model/Category.cpp b/samples/client/petstore/cpprest/model/Category.cpp index 560cf9070dc..bdb6d8e894a 100644 --- a/samples/client/petstore/cpprest/model/Category.cpp +++ b/samples/client/petstore/cpprest/model/Category.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Category.h b/samples/client/petstore/cpprest/model/Category.h index 4423f489458..80e759424a9 100644 --- a/samples/client/petstore/cpprest/model/Category.h +++ b/samples/client/petstore/cpprest/model/Category.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Category.h * - * + * A category for a pet */ #ifndef Category_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// +/// A category for a pet /// class Category : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Order.cpp b/samples/client/petstore/cpprest/model/Order.cpp index 86d26aae977..e21d867cd7e 100644 --- a/samples/client/petstore/cpprest/model/Order.cpp +++ b/samples/client/petstore/cpprest/model/Order.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Order.h b/samples/client/petstore/cpprest/model/Order.h index f5d950b8b8f..b8f22de9f47 100644 --- a/samples/client/petstore/cpprest/model/Order.h +++ b/samples/client/petstore/cpprest/model/Order.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Order.h * - * + * An order for a pets from the pet store */ #ifndef Order_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// +/// An order for a pets from the pet store /// class Order : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Pet.cpp b/samples/client/petstore/cpprest/model/Pet.cpp index 8aec0bf3663..51dd6d883e9 100644 --- a/samples/client/petstore/cpprest/model/Pet.cpp +++ b/samples/client/petstore/cpprest/model/Pet.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Pet.h b/samples/client/petstore/cpprest/model/Pet.h index 8fb6958a632..065c46bdb93 100644 --- a/samples/client/petstore/cpprest/model/Pet.h +++ b/samples/client/petstore/cpprest/model/Pet.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Pet.h * - * + * A pet for sale in the pet store */ #ifndef Pet_H_ @@ -33,7 +33,7 @@ namespace client { namespace model { /// -/// +/// A pet for sale in the pet store /// class Pet : public ModelBase diff --git a/samples/client/petstore/cpprest/model/Tag.cpp b/samples/client/petstore/cpprest/model/Tag.cpp index faff276fd27..3cb0798c99e 100644 --- a/samples/client/petstore/cpprest/model/Tag.cpp +++ b/samples/client/petstore/cpprest/model/Tag.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/Tag.h b/samples/client/petstore/cpprest/model/Tag.h index a429241f59f..a977ca07980 100644 --- a/samples/client/petstore/cpprest/model/Tag.h +++ b/samples/client/petstore/cpprest/model/Tag.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * Tag.h * - * + * A tag for a pet */ #ifndef Tag_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// +/// A tag for a pet /// class Tag : public ModelBase diff --git a/samples/client/petstore/cpprest/model/User.cpp b/samples/client/petstore/cpprest/model/User.cpp index 54780080036..1ea09f35b50 100644 --- a/samples/client/petstore/cpprest/model/User.cpp +++ b/samples/client/petstore/cpprest/model/User.cpp @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git diff --git a/samples/client/petstore/cpprest/model/User.h b/samples/client/petstore/cpprest/model/User.h index 10e18fd68b6..83b2120a360 100644 --- a/samples/client/petstore/cpprest/model/User.h +++ b/samples/client/petstore/cpprest/model/User.h @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -13,7 +13,7 @@ /* * User.h * - * + * A User who is purchasing from the pet store */ #ifndef User_H_ @@ -30,7 +30,7 @@ namespace client { namespace model { /// -/// +/// A User who is purchasing from the pet store /// class User : public ModelBase From b62928ff887c56cae12d15754df2a2041f0f1cc8 Mon Sep 17 00:00:00 2001 From: Mike Kistler Date: Fri, 5 May 2017 03:53:16 -0500 Subject: [PATCH 04/22] Set name for item property from 'x-item-name' annotation if present. (#5461) --- .../io/swagger/codegen/DefaultCodegen.java | 6 +++- .../swagger/codegen/java/JavaModelTest.java | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) 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 ef1c45e5e18..c6bb91aa715 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/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() From 167cbe972603770454f858df4362b7dd977d2424 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 5 May 2017 17:05:45 +0800 Subject: [PATCH 05/22] remove trailing comma in ts angular template (#5563) --- .../src/main/resources/typescript-angular/apis.mustache | 4 ++-- samples/client/petstore/typescript-angular/api/api.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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/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]; From d214e0ad4bb099c71e550e687b88ca898ded4125 Mon Sep 17 00:00:00 2001 From: beatcracker Date: Fri, 5 May 2017 12:21:11 +0300 Subject: [PATCH 06/22] [PowerShell] module to serve as template for PowerShell generator (#5509) * Added PowerShell module. See #4320 MVP PowerShell module to serve as a template for a PowerShell generator. * Fixed function name * Removed module manifest It should be generated by the build script * Ignore module manifests * Removed binding from prop. name for Pet --- .../powershell/PowerShellClient/.gitignore | 185 ++++++++++++++++++ .../powershell/PowerShellClient/Build.ps1 | 49 +++++ .../powershell/PowerShellClient/README.md | 148 ++++++++++++++ .../src/IO.Swagger/.gitignore | 2 + .../src/IO.Swagger/IO.Swagger.psm1 | 36 ++++ .../Private/Get-CommonParameters.ps1 | 15 ++ .../IO.Swagger/Private/Out-DebugParameter.ps1 | 38 ++++ .../src/IO.Swagger/Public/Get-PetById.ps1 | 45 +++++ .../src/IO.Swagger/Public/New-Category.ps1 | 52 +++++ .../src/IO.Swagger/Public/New-Pet.ps1 | 98 ++++++++++ .../src/IO.Swagger/Public/New-Tag.ps1 | 52 +++++ .../IO.Swagger/Public/Set-ApiCredential.ps1 | 64 ++++++ .../src/IO.Swagger/Public/Update-Pet.ps1 | 44 +++++ .../Public/Update-PetUsingParameterSet.ps1 | 90 +++++++++ .../IO.Swagger/Public/Update-PetWithForm.ps1 | 55 ++++++ .../en-US/about_IO.Swagger.help.txt | 19 ++ 16 files changed, 992 insertions(+) create mode 100644 samples/client/petstore/powershell/PowerShellClient/.gitignore create mode 100644 samples/client/petstore/powershell/PowerShellClient/Build.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/README.md create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/.gitignore create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/IO.Swagger.psm1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Private/Get-CommonParameters.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Private/Out-DebugParameter.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Get-PetById.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Category.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Pet.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/New-Tag.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Set-ApiCredential.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-Pet.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-PetUsingParameterSet.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/Public/Update-PetWithForm.ps1 create mode 100644 samples/client/petstore/powershell/PowerShellClient/src/IO.Swagger/en-US/about_IO.Swagger.help.txt 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 From 2a337f8327320b8a1b856347641dd3bfbbbc23ca Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 5 May 2017 21:50:32 +0800 Subject: [PATCH 07/22] add antihax as template owner for 2.3.0 Go --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 From 9212c2156775666314c948de8aa97d11fa08919f Mon Sep 17 00:00:00 2001 From: Alexander Date: Sat, 6 May 2017 03:39:14 +0100 Subject: [PATCH 08/22] [PHP] Add default value to method signature if present in Swagger spec (#5571) * Add default value to method signature if present in Swagger spec * Update pet store PHP code --- modules/swagger-codegen/src/main/resources/php/api.mustache | 4 ++-- .../client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index 6619f8da8c1..7520a48d044 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -93,7 +93,7 @@ use \{{invokerPackage}}\ObjectSerializer; * @throws \{{invokerPackage}}\ApiException on non-2xx response * @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}}) { list($response) = $this->{{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); return $response; @@ -114,7 +114,7 @@ use \{{invokerPackage}}\ObjectSerializer; * @throws \{{invokerPackage}}\ApiException on non-2xx response * @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/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 7024bdb6820..52e2624cc38 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -397,7 +397,7 @@ class FakeApi * @throws \Swagger\Client\ApiException on non-2xx response * @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) { list($response) = $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); return $response; @@ -419,7 +419,7 @@ class FakeApi * @throws \Swagger\Client\ApiException on non-2xx response * @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) { // parse inputs $resourcePath = "/fake"; From 918343b684f1237b2ddbe305b4322866e1326158 Mon Sep 17 00:00:00 2001 From: mguan-trulia Date: Fri, 5 May 2017 19:40:08 -0700 Subject: [PATCH 09/22] issue #3365 adding accept encoding for PHP (#5525) --- .../src/main/resources/php/ApiClient.mustache | 6 ++++- .../main/resources/php/configuration.mustache | 26 +++++++++++++++++++ .../php/SwaggerClient-php/lib/ApiClient.php | 6 ++++- .../SwaggerClient-php/lib/Configuration.php | 26 +++++++++++++++++++ 4 files changed, 62 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache index dd1a221d766..8f0f1167151 100644 --- a/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/php/ApiClient.mustache @@ -157,7 +157,7 @@ class ApiClient 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); @@ -189,6 +189,10 @@ class ApiClient $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); diff --git a/modules/swagger-codegen/src/main/resources/php/configuration.mustache b/modules/swagger-codegen/src/main/resources/php/configuration.mustache index 4e10f33823c..edd0f76bf55 100644 --- a/modules/swagger-codegen/src/main/resources/php/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/php/configuration.mustache @@ -167,6 +167,13 @@ class Configuration */ protected $proxyPassword; + /** + * Allow Curl encoding header + * + * @var bool + */ + protected $allowEncoding = false; + /** * Constructor */ @@ -435,6 +442,16 @@ class Configuration return $this; } + /** + * Set whether to accept encoding + * @param bool $allowEncoding + */ + public function setAllowEncoding($allowEncoding) + { + $this->allowEncoding = $allowEncoding; + return $this; + } + /** * Gets the HTTP connect timeout value * @@ -445,6 +462,15 @@ class Configuration return $this->curlConnectTimeout; } + /** + * Get whether to allow encoding + * + * @return bool + */ + public function getAllowEncoding() + { + return $this->allowEncoding; + } /** * Sets the HTTP Proxy Host diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php index b8add9f133c..ce025591447 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/ApiClient.php @@ -167,7 +167,7 @@ class ApiClient 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); @@ -199,6 +199,10 @@ class ApiClient $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); diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php b/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php index 17e0a6feda3..d85d33af051 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Configuration.php @@ -177,6 +177,13 @@ class Configuration */ protected $proxyPassword; + /** + * Allow Curl encoding header + * + * @var bool + */ + protected $allowEncoding = false; + /** * Constructor */ @@ -445,6 +452,16 @@ class Configuration return $this; } + /** + * Set whether to accept encoding + * @param bool $allowEncoding + */ + public function setAllowEncoding($allowEncoding) + { + $this->allowEncoding = $allowEncoding; + return $this; + } + /** * Gets the HTTP connect timeout value * @@ -455,6 +472,15 @@ class Configuration return $this->curlConnectTimeout; } + /** + * Get whether to allow encoding + * + * @return bool + */ + public function getAllowEncoding() + { + return $this->allowEncoding; + } /** * Sets the HTTP Proxy Host From ea16da813c0455074db9610b3e563046f3561635 Mon Sep 17 00:00:00 2001 From: Luca Favatella Date: Sat, 6 May 2017 04:23:30 +0100 Subject: [PATCH 10/22] [Erlang] Plant CI for server (#5559) * [Erlang] Address apparent reproducibily issue of sample Spotted running `bin/erlang-petstore-server.sh` on d08d55d41 . Apart from newlines, this is the opposite change of ec6248cbc . * [Erlang] Perform basic testing of sample server on CI * [Erlang] Install recent Erlang/OTP version ... in order to satisfy `jesse` compilation. The error I faced is: ``` $ curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 766k 100 766k 0 0 1041k 0 --:--:-- --:--:-- --:--:-- 1041k rebar 3.3.6 on Erlang/OTP R16B03 Erts 5.10.4 ... ===> Verifying dependencies... ===> Fetching jesse ({git,"https://github.com/for-GET/jesse.git", {tag,"1.4.0"}}) ===> Fetching jsx ({git,"https://github.com/talentdeficit/jsx.git", {branch,"v2.8.0"}}) ===> Skipping jsx (from {git,"git://github.com/talentdeficit/jsx.git", {tag,"2.8.0"}}) as an app of the same name has already been fetched ===> Compiling jsx ===> Compiling jesse ===> Compiling _build/default/lib/jesse/src/jesse_tests_util.erl failed _build/default/lib/jesse/src/jesse_tests_util.erl:28: can't find include lib "common_test/include/ct.hrl" _build/default/lib/jesse/src/jesse_tests_util.erl:55: undefined macro 'config/2' _build/default/lib/jesse/src/jesse_tests_util.erl:24: function do_test/2 undefined _build/default/lib/jesse/src/jesse_tests_util.erl:72: function test_schema/3 is unused _build/default/lib/jesse/src/jesse_tests_util.erl:102: function get_path/2 is unused _build/default/lib/jesse/src/jesse_tests_util.erl:105: function load_schema/1 is unused [ERROR] Command execution failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404) at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166) at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:804) at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:751) at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:313) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (Erlang Test) on project ErlangServerTests: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1] ``` * [Erlang] Bump `jsx` dependency to latest stable version * [Erlang] Disable sample server from CI until compilation works --- .travis.yml | 5 ++ .../erlang-server/rebar.config.mustache | 2 +- pom.xml | 1 + samples/server/petstore/erlang-server/pom.xml | 46 +++++++++++++++++++ .../petstore/erlang-server/priv/swagger.json | 4 +- .../petstore/erlang-server/rebar.config | 2 +- 6 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 samples/server/petstore/erlang-server/pom.xml 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/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/pom.xml b/pom.xml index 858c77a65aa..9a8c16156fc 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/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"}}} ]}. From adb213bc00637403b56cea954d51685b816f56ae Mon Sep 17 00:00:00 2001 From: Marcus Low Junxiang Date: Mon, 8 May 2017 09:55:13 +0800 Subject: [PATCH 11/22] Modifying resty dependency to use stable release instead of HEAD (#5579) * Modifying resty dependency to use stable release instead of HEAD * adding dependency to pre-integration test --- .../swagger-codegen/src/main/resources/go/api_client.mustache | 2 +- samples/client/petstore-security-test/go/api_client.go | 2 +- samples/client/petstore/go/go-petstore/api_client.go | 2 +- samples/client/petstore/go/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/go/api_client.mustache b/modules/swagger-codegen/src/main/resources/go/api_client.mustache index e4ae2d09904..1a590bf6a1a 100644 --- a/modules/swagger-codegen/src/main/resources/go/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api_client.mustache @@ -9,7 +9,7 @@ import ( "strings" "net/url" "io/ioutil" - "github.com/go-resty/resty" + "gopkg.in/go-resty/resty.v0" ) type APIClient struct { diff --git a/samples/client/petstore-security-test/go/api_client.go b/samples/client/petstore-security-test/go/api_client.go index 5b7295c680a..0b29304b906 100644 --- a/samples/client/petstore-security-test/go/api_client.go +++ b/samples/client/petstore-security-test/go/api_client.go @@ -18,7 +18,7 @@ import ( "strings" "net/url" "io/ioutil" - "github.com/go-resty/resty" + "gopkg.in/go-resty/resty.v0" ) type APIClient struct { diff --git a/samples/client/petstore/go/go-petstore/api_client.go b/samples/client/petstore/go/go-petstore/api_client.go index a93f346e102..40d04adb01b 100644 --- a/samples/client/petstore/go/go-petstore/api_client.go +++ b/samples/client/petstore/go/go-petstore/api_client.go @@ -18,7 +18,7 @@ import ( "strings" "net/url" "io/ioutil" - "github.com/go-resty/resty" + "gopkg.in/go-resty/resty.v0" ) type APIClient struct { diff --git a/samples/client/petstore/go/pom.xml b/samples/client/petstore/go/pom.xml index 028ef60a6f4..15eb373500a 100644 --- a/samples/client/petstore/go/pom.xml +++ b/samples/client/petstore/go/pom.xml @@ -50,7 +50,7 @@ go get - github.com/go-resty/resty + gopkg.in/go-resty/resty.v0 From a81cff0ed03cd3d45b4fa4da6f034b8e9e90f5d6 Mon Sep 17 00:00:00 2001 From: Takuro Wada Date: Mon, 8 May 2017 19:08:54 +0900 Subject: [PATCH 12/22] [typescript-angular2] change OpaqueToken to InjectionToken (Issue #5565) (#5569) * change OpaqueToken to InjectionToken and add useOpaqueToken option for typescript-angular2 (#5565) * run security shell --- .../languages/TypeScriptAngular2ClientCodegen.java | 13 +++++++++++++ .../typescript-angular2/variables.mustache | 4 ++-- .../TypeScriptAngular2ClientOptionsProvider.java | 1 + .../typescript-angular2/api/FakeApi.ts | 4 ++-- .../typescript-angular2/configuration.ts | 1 + .../typescript-angular2/variables.ts | 4 ++-- .../typescript-angular2/default/api/PetApi.ts | 10 +++++----- .../typescript-angular2/default/variables.ts | 4 ++-- .../petstore/typescript-angular2/npm/README.md | 4 ++-- .../petstore/typescript-angular2/npm/api/PetApi.ts | 10 +++++----- .../petstore/typescript-angular2/npm/package.json | 2 +- .../petstore/typescript-angular2/npm/variables.ts | 4 ++-- 12 files changed, 38 insertions(+), 23 deletions(-) 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 91ed4f35f86..78413f94b78 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 @@ -26,10 +26,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(); @@ -47,6 +50,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 @@ -79,6 +83,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() { @@ -234,4 +243,8 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod public void setNpmRepository(String npmRepository) { this.npmRepository = npmRepository; } + + public void setOpaqueToken() { + this.injectionToken = "OpaqueToken"; + } } 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/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/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/configuration.ts b/samples/client/petstore-security-test/typescript-angular2/configuration.ts index a566a180e4e..c94aa4cbce9 100644 --- a/samples/client/petstore-security-test/typescript-angular2/configuration.ts +++ b/samples/client/petstore-security-test/typescript-angular2/configuration.ts @@ -3,4 +3,5 @@ export class Configuration { username: string; password: string; accessToken: string | (() => string); + withCredentials: boolean; } \ No newline at end of file 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/typescript-angular2/default/api/PetApi.ts b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts index d346647df3c..ddebacbbc88 100644 --- a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts @@ -396,6 +396,11 @@ export class PetApi { 'application/xml' ]; + // authentication (api_key) required + if (this.configuration.apiKey) { + headers.set('api_key', this.configuration.apiKey); + } + // authentication (petstore_auth) required // oauth required if (this.configuration.accessToken) { @@ -405,11 +410,6 @@ export class PetApi { headers.set('Authorization', 'Bearer ' + accessToken); } - // authentication (api_key) required - if (this.configuration.apiKey) { - headers.set('api_key', this.configuration.apiKey); - } - let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, 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/README.md b/samples/client/petstore/typescript-angular2/npm/README.md index d1acd28ff12..fbf37be47b0 100644 --- a/samples/client/petstore/typescript-angular2/npm/README.md +++ b/samples/client/petstore/typescript-angular2/npm/README.md @@ -1,4 +1,4 @@ -## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201704272137 +## @swagger/angular2-typescript-petstore@0.0.1 ### Building @@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's. _published:_ ``` -npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201704272137 --save +npm install @swagger/angular2-typescript-petstore@0.0.1 --save ``` _unPublished (not recommended):_ diff --git a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts index d346647df3c..ddebacbbc88 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts @@ -396,6 +396,11 @@ export class PetApi { 'application/xml' ]; + // authentication (api_key) required + if (this.configuration.apiKey) { + headers.set('api_key', this.configuration.apiKey); + } + // authentication (petstore_auth) required // oauth required if (this.configuration.accessToken) { @@ -405,11 +410,6 @@ export class PetApi { headers.set('Authorization', 'Bearer ' + accessToken); } - // authentication (api_key) required - if (this.configuration.apiKey) { - headers.set('api_key', this.configuration.apiKey); - } - let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, diff --git a/samples/client/petstore/typescript-angular2/npm/package.json b/samples/client/petstore/typescript-angular2/npm/package.json index 1f735d58290..70255c80f82 100644 --- a/samples/client/petstore/typescript-angular2/npm/package.json +++ b/samples/client/petstore/typescript-angular2/npm/package.json @@ -1,6 +1,6 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201704272137", + "version": "0.0.1", "description": "swagger client for @swagger/angular2-typescript-petstore", "author": "Swagger Codegen Contributors", "keywords": [ 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': ' ', From f5f3dbd94ae215143e03eb0ee9022ea600f6c6bf Mon Sep 17 00:00:00 2001 From: Peter Pentchev Date: Mon, 8 May 2017 13:12:13 +0300 Subject: [PATCH 13/22] Run all the CLI commands in the Docker environment (#5564) * [docker] Allow "validate" and "version" in Docker * [docker] Allow all the available CLI commands * [docker] Quote some more variables --- docker-entrypoint.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) 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 From 409638676ee5f2b13d19abca644254952f16cf14 Mon Sep 17 00:00:00 2001 From: Vincent Coetzee Date: Mon, 8 May 2017 12:26:30 +0200 Subject: [PATCH 14/22] Added code to templates to ensure correct generation of code for Swift3 (#5390) * Added code to templates to ensure generation of code for Swift3 that builds on both Apple platforms and Linux. Fixed a bug in the Model decoders that prevented code from building for Linux * Ran the script to generate the PetStore API --- .../src/main/resources/swift3/AlamofireImplementations.mustache | 1 + .../src/main/resources/swift3/Extensions.mustache | 1 + .../swagger-codegen/src/main/resources/swift3/Models.mustache | 2 +- modules/swagger-codegen/src/main/resources/swift3/api.mustache | 1 + .../default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift | 1 + .../default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift | 1 + .../default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift | 1 + .../default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift | 1 + .../Classes/Swaggers/AlamofireImplementations.swift | 1 + .../default/PetstoreClient/Classes/Swaggers/Extensions.swift | 1 + .../swift3/default/PetstoreClient/Classes/Swaggers/Models.swift | 2 +- .../PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift | 1 + .../PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift | 1 + .../PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift | 1 + .../PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift | 1 + .../Classes/Swaggers/AlamofireImplementations.swift | 1 + .../promisekit/PetstoreClient/Classes/Swaggers/Extensions.swift | 1 + .../promisekit/PetstoreClient/Classes/Swaggers/Models.swift | 2 +- .../rxswift/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift | 1 + .../rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift | 1 + .../rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift | 1 + .../rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift | 1 + .../Classes/Swaggers/AlamofireImplementations.swift | 1 + .../rxswift/PetstoreClient/Classes/Swaggers/Extensions.swift | 1 + .../swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift | 2 +- 25 files changed, 25 insertions(+), 4 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/swift3/AlamofireImplementations.mustache b/modules/swagger-codegen/src/main/resources/swift3/AlamofireImplementations.mustache index 8ef9da6b3b1..35d187923f4 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 4d8918a616b..3bcd23e4b34 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/Models.mustache b/modules/swagger-codegen/src/main/resources/swift3/Models.mustache index a0b0c259b6e..7f6e5bd9403 100644 --- a/modules/swagger-codegen/src/main/resources/swift3/Models.mustache +++ b/modules/swagger-codegen/src/main/resources/swift3/Models.mustache @@ -70,7 +70,7 @@ class Decoders { static func decode(clazz: T.Type, source: AnyObject, instance: AnyObject?) -> T { initialize() if T.self is Int32.Type && source is NSNumber { - return source.int32Value as! T; + return (source as! NSNumber).int32Value as! T; } if T.self is Int64.Type && source is NSNumber { return source.int64Value as! T; diff --git a/modules/swagger-codegen/src/main/resources/swift3/api.mustache b/modules/swagger-codegen/src/main/resources/swift3/api.mustache index 495762a46a9..371057a682e 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/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift index 51e54c5af34..36969deb653 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/PetAPI.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 7378416c9c4..ddb79ca09ee 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 f6b937da861..9ad185d9c0a 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 b07b5c89faf..5f5d7754609 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 8ef9da6b3b1..35d187923f4 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 ebb5a78e161..8fcf71332ae 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/default/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift index a9f80d6961b..79af37e3021 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift @@ -70,7 +70,7 @@ class Decoders { static func decode(clazz: T.Type, source: AnyObject, instance: AnyObject?) -> T { initialize() if T.self is Int32.Type && source is NSNumber { - return source.int32Value as! T; + return (source as! NSNumber).int32Value as! T; } if T.self is Int64.Type && source is NSNumber { return source.int64Value as! T; 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 3847ae1dc6a..0e217357c88 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/PetAPI.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index c1dbe4ed14a..cedd7e12c5a 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 369138f1d01..abef290860d 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 9530e6edb81..2e7a5a2da0c 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 8ef9da6b3b1..35d187923f4 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 221636e5fac..0268660cd6b 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/promisekit/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift index dbf9aadf8f2..2fe841e1d92 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift @@ -70,7 +70,7 @@ class Decoders { static func decode(clazz: T.Type, source: AnyObject, instance: AnyObject?) -> T { initialize() if T.self is Int32.Type && source is NSNumber { - return source.int32Value as! T; + return (source as! NSNumber).int32Value as! T; } if T.self is Int64.Type && source is NSNumber { return source.int64Value as! T; 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 976fa6cc0da..abcbfe8d0b7 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/PetAPI.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 524ed037b61..87af8e2606a 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 5177e56f53c..45af2fe899d 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 1b7ce47f4ae..2bfdebd0c46 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 8ef9da6b3b1..35d187923f4 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 ebb5a78e161..8fcf71332ae 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/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift index dbf9aadf8f2..2fe841e1d92 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift @@ -70,7 +70,7 @@ class Decoders { static func decode(clazz: T.Type, source: AnyObject, instance: AnyObject?) -> T { initialize() if T.self is Int32.Type && source is NSNumber { - return source.int32Value as! T; + return (source as! NSNumber).int32Value as! T; } if T.self is Int64.Type && source is NSNumber { return source.int64Value as! T; From 621ff06a896e9af3a15abd1dadcca4991ca9bc94 Mon Sep 17 00:00:00 2001 From: wing328 Date: Mon, 8 May 2017 18:33:25 +0800 Subject: [PATCH 15/22] update java petstore sample --- .../io/swagger/client/model/AdditionalPropertiesClass.java | 2 ++ .../src/main/java/io/swagger/client/model/Animal.java | 1 + .../src/main/java/io/swagger/client/model/AnimalFarm.java | 1 + .../io/swagger/client/model/ArrayOfArrayOfNumberOnly.java | 2 ++ .../main/java/io/swagger/client/model/ArrayOfNumberOnly.java | 2 ++ .../src/main/java/io/swagger/client/model/ArrayTest.java | 3 +++ .../main/java/io/swagger/client/model/Capitalization.java | 1 + .../src/main/java/io/swagger/client/model/Cat.java | 1 + .../src/main/java/io/swagger/client/model/Category.java | 1 + .../src/main/java/io/swagger/client/model/ClassModel.java | 1 + .../src/main/java/io/swagger/client/model/Client.java | 1 + .../src/main/java/io/swagger/client/model/Dog.java | 1 + .../src/main/java/io/swagger/client/model/EnumArrays.java | 1 + .../src/main/java/io/swagger/client/model/EnumClass.java | 1 + .../src/main/java/io/swagger/client/model/EnumTest.java | 2 ++ .../src/main/java/io/swagger/client/model/FormatTest.java | 5 +++++ .../main/java/io/swagger/client/model/HasOnlyReadOnly.java | 1 + .../src/main/java/io/swagger/client/model/MapTest.java | 2 ++ .../model/MixedPropertiesAndAdditionalPropertiesClass.java | 4 ++++ .../main/java/io/swagger/client/model/Model200Response.java | 1 + .../main/java/io/swagger/client/model/ModelApiResponse.java | 1 + .../src/main/java/io/swagger/client/model/ModelReturn.java | 1 + .../src/main/java/io/swagger/client/model/Name.java | 1 + .../src/main/java/io/swagger/client/model/NumberOnly.java | 2 ++ .../src/main/java/io/swagger/client/model/Order.java | 2 ++ .../src/main/java/io/swagger/client/model/OuterEnum.java | 1 + .../src/main/java/io/swagger/client/model/Pet.java | 3 +++ .../src/main/java/io/swagger/client/model/ReadOnlyFirst.java | 1 + .../main/java/io/swagger/client/model/SpecialModelName.java | 1 + .../src/main/java/io/swagger/client/model/Tag.java | 1 + .../src/main/java/io/swagger/client/model/User.java | 1 + 31 files changed, 49 insertions(+) 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 2724e763651..feab1d429d1 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.joda.time.DateTime; import org.joda.time.LocalDate; 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 DateTime 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 1980ab6db88..584389c6974 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.joda.time.DateTime; 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 DateTime 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 41e21346156..ed8cb215f5d 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.joda.time.DateTime; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Order @@ -141,6 +142,7 @@ public class Order { * Get shipDate * @return shipDate **/ + @Valid @ApiModelProperty(value = "") public DateTime 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 From fa2e575762dc71939cfcf8ae8bc1d058bce5cdab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20B=C3=A9langer?= Date: Mon, 8 May 2017 12:38:59 -0400 Subject: [PATCH 16/22] [JavaSpring] add support for cascading bean validation (#5393) --- .../src/main/resources/JavaSpring/beanValidation.mustache | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 From 824842290df65e4bbc62811a7486d379d610deb8 Mon Sep 17 00:00:00 2001 From: sabras75 Date: Tue, 9 May 2017 10:34:17 +0200 Subject: [PATCH 17/22] Fix#5510 (#5582) * Add overloads on signals. The overload adds the NetworkError and the error string to the signal. Both signal will be emitted. Clients are supposed to subscribe to only one of the overloads. * refactor generated code alignement * Do not use method overload for signals. Instead, have another naming convention for signal that carries Error information. Why ? Because signal overloading and QT5 connector with method referencing do not mix well (see http://stackoverflow.com/questions/16794695/connecting-overloaded-signals-and-slots-in-qt-5). It would need to specify exactly which overload to take. That is cumbersome to write AND is a breaking change for the consumer of the generated code. * update qt5 sample files --- .../main/resources/qt5cpp/api-body.mustache | 27 +++--- .../main/resources/qt5cpp/api-header.mustache | 2 + .../qt5cpp/client/SWGFakeApi.cpp | 8 +- .../qt5cpp/client/SWGFakeApi.h | 2 + .../petstore/qt5cpp/client/SWGPetApi.cpp | 90 +++++++++++-------- .../client/petstore/qt5cpp/client/SWGPetApi.h | 9 ++ .../petstore/qt5cpp/client/SWGStoreApi.cpp | 53 ++++++----- .../petstore/qt5cpp/client/SWGStoreApi.h | 5 ++ .../petstore/qt5cpp/client/SWGUserApi.cpp | 88 ++++++++++-------- .../petstore/qt5cpp/client/SWGUserApi.h | 9 ++ 10 files changed, 181 insertions(+), 112 deletions(-) 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/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/qt5cpp/client/SWGPetApi.cpp b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp index ee24554fcb5..5e453b2fa79 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.cpp @@ -38,7 +38,7 @@ SWGPetApi::addPet(SWGPet body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - + QString output = body.asJson(); input.request_body.append(output); @@ -55,6 +55,9 @@ SWGPetApi::addPet(SWGPet 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); - SWGPet* output = static_cast(create(json, QString("SWGPet"))); - + QString json(worker->response); + SWGPet* output = static_cast(create(json, QString("SWGPet"))); worker->deleteLater(); emit getPetByIdSignal(output); - + emit getPetByIdSignalE(output, error_type, error_str); } + void SWGPetApi::updatePet(SWGPet body) { QString fullPath; @@ -357,7 +365,7 @@ SWGPetApi::updatePet(SWGPet body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "PUT"); - + QString output = body.asJson(); input.request_body.append(output); @@ -374,6 +382,9 @@ SWGPetApi::updatePet(SWGPet 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,15 +490,14 @@ SWGPetApi::uploadFileCallback(HttpRequestWorker * worker) { msg = "Error: " + worker->error_str; } - - QString json(worker->response); - SWGApiResponse* output = static_cast(create(json, QString("SWGApiResponse"))); - + QString json(worker->response); + SWGApiResponse* output = static_cast(create(json, QString("SWGApiResponse"))); 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 866946dc74f..0648409a940 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPetApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGPetApi.h @@ -64,6 +64,15 @@ signals: void updatePetWithFormSignal(); void uploadFileSignal(SWGApiResponse* summary); + 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(SWGPet* 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(SWGApiResponse* 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 57b03573668..634bfda4780 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); - SWGOrder* output = static_cast(create(json, QString("SWGOrder"))); - + QString json(worker->response); + SWGOrder* output = static_cast(create(json, QString("SWGOrder"))); worker->deleteLater(); emit getOrderByIdSignal(output); - + emit getOrderByIdSignalE(output, error_type, error_str); } + void SWGStoreApi::placeOrder(SWGOrder body) { QString fullPath; @@ -177,7 +180,7 @@ SWGStoreApi::placeOrder(SWGOrder body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - + QString output = body.asJson(); input.request_body.append(output); @@ -194,6 +197,9 @@ SWGStoreApi::placeOrder(SWGOrder 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); - SWGOrder* output = static_cast(create(json, QString("SWGOrder"))); - + QString json(worker->response); + SWGOrder* output = static_cast(create(json, QString("SWGOrder"))); 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 a44d75457c8..652373aa0b5 100644 --- a/samples/client/petstore/qt5cpp/client/SWGStoreApi.h +++ b/samples/client/petstore/qt5cpp/client/SWGStoreApi.h @@ -51,6 +51,11 @@ signals: void getOrderByIdSignal(SWGOrder* summary); void placeOrderSignal(SWGOrder* summary); + void deleteOrderSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void getInventorySignalE(QMap* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void getOrderByIdSignalE(SWGOrder* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void placeOrderSignalE(SWGOrder* 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 2349aad37e4..02f6b18d4fa 100644 --- a/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp +++ b/samples/client/petstore/qt5cpp/client/SWGUserApi.cpp @@ -38,7 +38,7 @@ SWGUserApi::createUser(SWGUser body) { HttpRequestWorker *worker = new HttpRequestWorker(); HttpRequestInput input(fullPath, "POST"); - + QString output = body.asJson(); input.request_body.append(output); @@ -55,6 +55,9 @@ SWGUserApi::createUser(SWGUser 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); - SWGUser* output = static_cast(create(json, QString("SWGUser"))); - + QString json(worker->response); + SWGUser* output = static_cast(create(json, QString("SWGUser"))); 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, SWGUser body) { QString fullPath; @@ -355,7 +369,7 @@ SWGUserApi::updateUser(QString* username, SWGUser 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, SWGUser 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 e95e7f459fd..83fd0330765 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(SWGUser* 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); + }; } From f25a7575d3b68a2af8d17041a296a53e1016daa0 Mon Sep 17 00:00:00 2001 From: Jim Schubert Date: Tue, 9 May 2017 04:59:48 -0400 Subject: [PATCH 18/22] [generator] Adds a .swagger/VERSION file for all generators (#5556) --- .../java/io/swagger/codegen/DefaultGenerator.java | 13 +++++++++++-- .../codegen/utils/ImplementationVersion.java | 13 +++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 modules/swagger-codegen/src/main/java/io/swagger/codegen/utils/ImplementationVersion.java 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 ea163bee42c..e182f03d61b 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" + 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/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"; + } +} From fd3cae6c4b817778af4bab60f46685ff965a5395 Mon Sep 17 00:00:00 2001 From: wing328 Date: Tue, 9 May 2017 17:07:45 +0800 Subject: [PATCH 19/22] rename .swagger folder to .swagger-codegen --- .../src/main/java/io/swagger/codegen/DefaultGenerator.java | 2 +- samples/client/petstore/ruby/.swagger-codegen/VERSION | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 samples/client/petstore/ruby/.swagger-codegen/VERSION 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 e182f03d61b..df3c0d68357 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 @@ -581,7 +581,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { files.add(ignoreFile); } - final String swaggerVersionMetadata = config.outputFolder() + File.separator + ".swagger" + File.separator + "VERSION"; + final String swaggerVersionMetadata = config.outputFolder() + File.separator + ".swagger-codegen" + File.separator + "VERSION"; File swaggerVersionMetadataFile = new File(swaggerVersionMetadata); try { writeToFile(swaggerVersionMetadata, ImplementationVersion.read()); 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 From 5a257a055817dfaf4e2054d3950da2533f11afe2 Mon Sep 17 00:00:00 2001 From: Voydz Date: Wed, 10 May 2017 09:24:43 +0200 Subject: [PATCH 20/22] [csharp] fixes for netstandard (json serializing and project files) (#5590) --- .../src/main/resources/csharp/ApiClient.mustache | 14 ++++++++++++++ .../src/main/resources/csharp/Project.mustache | 5 ++++- .../SwaggerClient/src/IO.Swagger/Api/FakeApi.cs | 6 ++---- .../SwaggerClient/src/IO.Swagger/IO.Swagger.csproj | 5 ++++- .../src/IO.Swagger/Model/ModelReturn.cs | 2 +- .../SwaggerClient/src/IO.Swagger/IO.Swagger.csproj | 5 ++++- .../src/IO.Swagger/Client/ApiClient.cs | 6 ++++-- .../src/IO.Swagger/IO.Swagger.csproj | 5 ++++- .../src/IO.Swagger/IO.Swagger.csproj | 5 ++++- 9 files changed, 41 insertions(+), 12 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache index e51cee02c58..536e660a94d 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/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/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 - + + + + From ec7b80abab7d99139130e93a1bc21f09e9feec74 Mon Sep 17 00:00:00 2001 From: kenisteward Date: Wed, 10 May 2017 03:46:33 -0400 Subject: [PATCH 21/22] #4962 Empty Response body handling in typescript-angular2 - added returning an empty object on response.json() failure (#5585) --- .../typescript-angular2/api.mustache | 2 +- .../typescript-angular2/default/api/PetApi.ts | 114 +++++++++--------- .../default/api/StoreApi.ts | 39 +++--- .../default/api/UserApi.ts | 96 +++++++++------ .../default/model/ApiResponse.ts | 25 ++++ .../default/model/Category.ts | 7 +- .../default/model/Order.ts | 7 +- .../typescript-angular2/default/model/Pet.ts | 7 +- .../typescript-angular2/default/model/Tag.ts | 7 +- .../typescript-angular2/default/model/User.ts | 7 +- .../default/model/models.ts | 1 + .../typescript-angular2/npm/api/PetApi.ts | 114 +++++++++--------- .../typescript-angular2/npm/api/StoreApi.ts | 39 +++--- .../typescript-angular2/npm/api/UserApi.ts | 96 +++++++++------ .../npm/model/ApiResponse.ts | 25 ++++ .../typescript-angular2/npm/model/Category.ts | 7 +- .../typescript-angular2/npm/model/Order.ts | 7 +- .../typescript-angular2/npm/model/Pet.ts | 7 +- .../typescript-angular2/npm/model/Tag.ts | 7 +- .../typescript-angular2/npm/model/User.ts | 7 +- .../typescript-angular2/npm/model/models.ts | 1 + 21 files changed, 381 insertions(+), 241 deletions(-) create mode 100644 samples/client/petstore/typescript-angular2/default/model/ApiResponse.ts create mode 100644 samples/client/petstore/typescript-angular2/npm/model/ApiResponse.ts diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache index 273d611bb53..4129ee41f2f 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache @@ -47,7 +47,7 @@ export class {{classname}} { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } diff --git a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts index ddebacbbc88..ca01b4ca340 100644 --- a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -45,13 +45,13 @@ export class PetApi { * * @param body Pet object that needs to be added to the store */ - public addPet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> { + public addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> { return this.addPetWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -68,7 +68,7 @@ export class PetApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -78,13 +78,13 @@ export class PetApi { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status?: Array, extraHttpRequestParams?: any): Observable> { + public findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable> { return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -94,21 +94,21 @@ export class PetApi { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by */ - public findPetsByTags(tags?: Array, extraHttpRequestParams?: any): Observable> { + public findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable> { return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } /** * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched + * Returns a single pet + * @param petId ID of pet to return */ public getPetById(petId: number, extraHttpRequestParams?: any): Observable { return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams) @@ -116,7 +116,7 @@ export class PetApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -126,13 +126,13 @@ export class PetApi { * * @param body Pet object that needs to be added to the store */ - public updatePet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> { + public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> { return this.updatePetWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -144,13 +144,13 @@ export class PetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithForm(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> { + public updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> { return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -162,13 +162,13 @@ export class PetApi { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable<{}> { + public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable { return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -179,11 +179,15 @@ export class PetApi { * * @param body Pet object that needs to be added to the store */ - public addPetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable { + public addPetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling addPet.'); + } // to determine the Content-Type header let consumes: string[] = [ 'application/json', @@ -192,8 +196,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -246,8 +250,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -278,15 +282,17 @@ export class PetApi { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter */ - public findPetsByStatusWithHttpInfo(status?: Array, extraHttpRequestParams?: any): Observable { + public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/findByStatus'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); + } if (status) { - status.forEach((element) => { - queryParameters.append('status', element); - }) + queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); } // to determine the Content-Type header @@ -295,8 +301,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -327,15 +333,17 @@ export class PetApi { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by */ - public findPetsByTagsWithHttpInfo(tags?: Array, extraHttpRequestParams?: any): Observable { + public findPetsByTagsWithHttpInfo(tags: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/findByTags'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); + } if (tags) { - tags.forEach((element) => { - queryParameters.append('tags', element); - }) + queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); } // to determine the Content-Type header @@ -344,8 +352,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -373,8 +381,8 @@ export class PetApi { /** * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched + * Returns a single pet + * @param petId ID of pet to return */ public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/${petId}' @@ -392,8 +400,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (api_key) required @@ -401,15 +409,6 @@ export class PetApi { headers.set('api_key', this.configuration.apiKey); } - // authentication (petstore_auth) required - // oauth required - if (this.configuration.accessToken) { - let accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers.set('Authorization', 'Bearer ' + accessToken); - } - let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, @@ -429,11 +428,15 @@ export class PetApi { * * @param body Pet object that needs to be added to the store */ - public updatePetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable { + public updatePetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling updatePet.'); + } // to determine the Content-Type header let consumes: string[] = [ 'application/json', @@ -442,8 +445,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -479,7 +482,7 @@ export class PetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithFormWithHttpInfo(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable { + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/${petId}' .replace('${' + 'petId' + '}', String(petId)); @@ -498,8 +501,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -562,8 +565,7 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/json' ]; // authentication (petstore_auth) required diff --git a/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts index ab4ef909a5f..2bb34f08e5d 100644 --- a/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -51,7 +51,7 @@ export class StoreApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -66,7 +66,7 @@ export class StoreApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -76,13 +76,13 @@ export class StoreApi { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched */ - public getOrderById(orderId: string, extraHttpRequestParams?: any): Observable { + public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable { return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -92,13 +92,13 @@ export class StoreApi { * * @param body order placed for purchasing the pet */ - public placeOrder(body?: models.Order, extraHttpRequestParams?: any): Observable { + public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable { return this.placeOrderWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -125,8 +125,8 @@ export class StoreApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -158,8 +158,7 @@ export class StoreApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/json' ]; // authentication (api_key) required @@ -186,7 +185,7 @@ export class StoreApi { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched */ - public getOrderByIdWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable { + public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/store/order/${orderId}' .replace('${' + 'orderId' + '}', String(orderId)); @@ -202,8 +201,8 @@ export class StoreApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -225,19 +224,23 @@ export class StoreApi { * * @param body order placed for purchasing the pet */ - public placeOrderWithHttpInfo(body?: models.Order, extraHttpRequestParams?: any): Observable { + public placeOrderWithHttpInfo(body: models.Order, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/store/order'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling placeOrder.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); diff --git a/samples/client/petstore/typescript-angular2/default/api/UserApi.ts b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts index b1095986e92..533bbbefeb3 100644 --- a/samples/client/petstore/typescript-angular2/default/api/UserApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -45,13 +45,13 @@ export class UserApi { * This can only be done by the logged in user. * @param body Created user object */ - public createUser(body?: models.User, extraHttpRequestParams?: any): Observable<{}> { + public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> { return this.createUserWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -61,13 +61,13 @@ export class UserApi { * * @param body List of user object */ - public createUsersWithArrayInput(body?: Array, extraHttpRequestParams?: any): Observable<{}> { + public createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -77,13 +77,13 @@ export class UserApi { * * @param body List of user object */ - public createUsersWithListInput(body?: Array, extraHttpRequestParams?: any): Observable<{}> { + public createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -99,7 +99,7 @@ export class UserApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -115,7 +115,7 @@ export class UserApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -126,13 +126,13 @@ export class UserApi { * @param username The user name for login * @param password The password for login in clear text */ - public loginUser(username?: string, password?: string, extraHttpRequestParams?: any): Observable { + public loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable { return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -147,7 +147,7 @@ export class UserApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -158,13 +158,13 @@ export class UserApi { * @param username name that need to be deleted * @param body Updated user object */ - public updateUser(username: string, body?: models.User, extraHttpRequestParams?: any): Observable<{}> { + public updateUser(username: string, body: models.User, extraHttpRequestParams?: any): Observable<{}> { return this.updateUserWithHttpInfo(username, body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -175,19 +175,23 @@ export class UserApi { * This can only be done by the logged in user. * @param body Created user object */ - public createUserWithHttpInfo(body?: models.User, extraHttpRequestParams?: any): Observable { + public createUserWithHttpInfo(body: models.User, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUser.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); @@ -212,19 +216,23 @@ export class UserApi { * * @param body List of user object */ - public createUsersWithArrayInputWithHttpInfo(body?: Array, extraHttpRequestParams?: any): Observable { + public createUsersWithArrayInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/createWithArray'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); @@ -249,19 +257,23 @@ export class UserApi { * * @param body List of user object */ - public createUsersWithListInputWithHttpInfo(body?: Array, extraHttpRequestParams?: any): Observable { + public createUsersWithListInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/createWithList'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); @@ -302,8 +314,8 @@ export class UserApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -341,8 +353,8 @@ export class UserApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -365,11 +377,19 @@ export class UserApi { * @param username The user name for login * @param password The password for login in clear text */ - public loginUserWithHttpInfo(username?: string, password?: string, extraHttpRequestParams?: any): Observable { + public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/login'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new Error('Required parameter password was null or undefined when calling loginUser.'); + } if (username !== undefined) { queryParameters.set('username', username); } @@ -384,8 +404,8 @@ export class UserApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -417,8 +437,8 @@ export class UserApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -441,7 +461,7 @@ export class UserApi { * @param username name that need to be deleted * @param body Updated user object */ - public updateUserWithHttpInfo(username: string, body?: models.User, extraHttpRequestParams?: any): Observable { + public updateUserWithHttpInfo(username: string, body: models.User, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/${username}' .replace('${' + 'username' + '}', String(username)); @@ -451,14 +471,18 @@ export class UserApi { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling updateUser.'); } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling updateUser.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/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/model/Category.ts b/samples/client/petstore/typescript-angular2/default/model/Category.ts index ffdacd4f707..254c3003c89 100644 --- a/samples/client/petstore/typescript-angular2/default/model/Category.ts +++ b/samples/client/petstore/typescript-angular2/default/model/Category.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A category for a pet + */ export interface Category { id?: number; diff --git a/samples/client/petstore/typescript-angular2/default/model/Order.ts b/samples/client/petstore/typescript-angular2/default/model/Order.ts index 9c47071c5b6..2b6c7aeebd6 100644 --- a/samples/client/petstore/typescript-angular2/default/model/Order.ts +++ b/samples/client/petstore/typescript-angular2/default/model/Order.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * An order for a pets from the pet store + */ export interface Order { id?: number; diff --git a/samples/client/petstore/typescript-angular2/default/model/Pet.ts b/samples/client/petstore/typescript-angular2/default/model/Pet.ts index d64dc809e53..b878cadb905 100644 --- a/samples/client/petstore/typescript-angular2/default/model/Pet.ts +++ b/samples/client/petstore/typescript-angular2/default/model/Pet.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A pet for sale in the pet store + */ export interface Pet { id?: number; diff --git a/samples/client/petstore/typescript-angular2/default/model/Tag.ts b/samples/client/petstore/typescript-angular2/default/model/Tag.ts index 8a3b99ae9ca..8cbdc4fa145 100644 --- a/samples/client/petstore/typescript-angular2/default/model/Tag.ts +++ b/samples/client/petstore/typescript-angular2/default/model/Tag.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A tag for a pet + */ export interface Tag { id?: number; diff --git a/samples/client/petstore/typescript-angular2/default/model/User.ts b/samples/client/petstore/typescript-angular2/default/model/User.ts index 43d00f7b318..fbf75dfe28e 100644 --- a/samples/client/petstore/typescript-angular2/default/model/User.ts +++ b/samples/client/petstore/typescript-angular2/default/model/User.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A User who is purchasing from the pet store + */ export interface User { id?: number; diff --git a/samples/client/petstore/typescript-angular2/default/model/models.ts b/samples/client/petstore/typescript-angular2/default/model/models.ts index 92dac02846c..f53c1dd42bd 100644 --- a/samples/client/petstore/typescript-angular2/default/model/models.ts +++ b/samples/client/petstore/typescript-angular2/default/model/models.ts @@ -1,3 +1,4 @@ +export * from './ApiResponse'; export * from './Category'; export * from './Order'; export * from './Pet'; diff --git a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts index ddebacbbc88..ca01b4ca340 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -45,13 +45,13 @@ export class PetApi { * * @param body Pet object that needs to be added to the store */ - public addPet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> { + public addPet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> { return this.addPetWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -68,7 +68,7 @@ export class PetApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -78,13 +78,13 @@ export class PetApi { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter */ - public findPetsByStatus(status?: Array, extraHttpRequestParams?: any): Observable> { + public findPetsByStatus(status: Array, extraHttpRequestParams?: any): Observable> { return this.findPetsByStatusWithHttpInfo(status, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -94,21 +94,21 @@ export class PetApi { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by */ - public findPetsByTags(tags?: Array, extraHttpRequestParams?: any): Observable> { + public findPetsByTags(tags: Array, extraHttpRequestParams?: any): Observable> { return this.findPetsByTagsWithHttpInfo(tags, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } /** * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched + * Returns a single pet + * @param petId ID of pet to return */ public getPetById(petId: number, extraHttpRequestParams?: any): Observable { return this.getPetByIdWithHttpInfo(petId, extraHttpRequestParams) @@ -116,7 +116,7 @@ export class PetApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -126,13 +126,13 @@ export class PetApi { * * @param body Pet object that needs to be added to the store */ - public updatePet(body?: models.Pet, extraHttpRequestParams?: any): Observable<{}> { + public updatePet(body: models.Pet, extraHttpRequestParams?: any): Observable<{}> { return this.updatePetWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -144,13 +144,13 @@ export class PetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithForm(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> { + public updatePetWithForm(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable<{}> { return this.updatePetWithFormWithHttpInfo(petId, name, status, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -162,13 +162,13 @@ export class PetApi { * @param additionalMetadata Additional data to pass to server * @param file file to upload */ - public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable<{}> { + public uploadFile(petId: number, additionalMetadata?: string, file?: any, extraHttpRequestParams?: any): Observable { return this.uploadFileWithHttpInfo(petId, additionalMetadata, file, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -179,11 +179,15 @@ export class PetApi { * * @param body Pet object that needs to be added to the store */ - public addPetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable { + public addPetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling addPet.'); + } // to determine the Content-Type header let consumes: string[] = [ 'application/json', @@ -192,8 +196,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -246,8 +250,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -278,15 +282,17 @@ export class PetApi { * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter */ - public findPetsByStatusWithHttpInfo(status?: Array, extraHttpRequestParams?: any): Observable { + public findPetsByStatusWithHttpInfo(status: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/findByStatus'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); + } if (status) { - status.forEach((element) => { - queryParameters.append('status', element); - }) + queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); } // to determine the Content-Type header @@ -295,8 +301,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -327,15 +333,17 @@ export class PetApi { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by */ - public findPetsByTagsWithHttpInfo(tags?: Array, extraHttpRequestParams?: any): Observable { + public findPetsByTagsWithHttpInfo(tags: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/findByTags'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); + } if (tags) { - tags.forEach((element) => { - queryParameters.append('tags', element); - }) + queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); } // to determine the Content-Type header @@ -344,8 +352,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -373,8 +381,8 @@ export class PetApi { /** * Find pet by ID - * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - * @param petId ID of pet that needs to be fetched + * Returns a single pet + * @param petId ID of pet to return */ public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/${petId}' @@ -392,8 +400,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (api_key) required @@ -401,15 +409,6 @@ export class PetApi { headers.set('api_key', this.configuration.apiKey); } - // authentication (petstore_auth) required - // oauth required - if (this.configuration.accessToken) { - let accessToken = typeof this.configuration.accessToken === 'function' - ? this.configuration.accessToken() - : this.configuration.accessToken; - headers.set('Authorization', 'Bearer ' + accessToken); - } - let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, @@ -429,11 +428,15 @@ export class PetApi { * * @param body Pet object that needs to be added to the store */ - public updatePetWithHttpInfo(body?: models.Pet, extraHttpRequestParams?: any): Observable { + public updatePetWithHttpInfo(body: models.Pet, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling updatePet.'); + } // to determine the Content-Type header let consumes: string[] = [ 'application/json', @@ -442,8 +445,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -479,7 +482,7 @@ export class PetApi { * @param name Updated name of the pet * @param status Updated status of the pet */ - public updatePetWithFormWithHttpInfo(petId: string, name?: string, status?: string, extraHttpRequestParams?: any): Observable { + public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/pet/${petId}' .replace('${' + 'petId' + '}', String(petId)); @@ -498,8 +501,8 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; // authentication (petstore_auth) required @@ -562,8 +565,7 @@ export class PetApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/json' ]; // authentication (petstore_auth) required diff --git a/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts index ab4ef909a5f..2bb34f08e5d 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -51,7 +51,7 @@ export class StoreApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -66,7 +66,7 @@ export class StoreApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -76,13 +76,13 @@ export class StoreApi { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched */ - public getOrderById(orderId: string, extraHttpRequestParams?: any): Observable { + public getOrderById(orderId: number, extraHttpRequestParams?: any): Observable { return this.getOrderByIdWithHttpInfo(orderId, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -92,13 +92,13 @@ export class StoreApi { * * @param body order placed for purchasing the pet */ - public placeOrder(body?: models.Order, extraHttpRequestParams?: any): Observable { + public placeOrder(body: models.Order, extraHttpRequestParams?: any): Observable { return this.placeOrderWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -125,8 +125,8 @@ export class StoreApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -158,8 +158,7 @@ export class StoreApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/json' ]; // authentication (api_key) required @@ -186,7 +185,7 @@ export class StoreApi { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched */ - public getOrderByIdWithHttpInfo(orderId: string, extraHttpRequestParams?: any): Observable { + public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/store/order/${orderId}' .replace('${' + 'orderId' + '}', String(orderId)); @@ -202,8 +201,8 @@ export class StoreApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -225,19 +224,23 @@ export class StoreApi { * * @param body order placed for purchasing the pet */ - public placeOrderWithHttpInfo(body?: models.Order, extraHttpRequestParams?: any): Observable { + public placeOrderWithHttpInfo(body: models.Order, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/store/order'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling placeOrder.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); diff --git a/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts index b1095986e92..533bbbefeb3 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -45,13 +45,13 @@ export class UserApi { * This can only be done by the logged in user. * @param body Created user object */ - public createUser(body?: models.User, extraHttpRequestParams?: any): Observable<{}> { + public createUser(body: models.User, extraHttpRequestParams?: any): Observable<{}> { return this.createUserWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -61,13 +61,13 @@ export class UserApi { * * @param body List of user object */ - public createUsersWithArrayInput(body?: Array, extraHttpRequestParams?: any): Observable<{}> { + public createUsersWithArrayInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { return this.createUsersWithArrayInputWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -77,13 +77,13 @@ export class UserApi { * * @param body List of user object */ - public createUsersWithListInput(body?: Array, extraHttpRequestParams?: any): Observable<{}> { + public createUsersWithListInput(body: Array, extraHttpRequestParams?: any): Observable<{}> { return this.createUsersWithListInputWithHttpInfo(body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -99,7 +99,7 @@ export class UserApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -115,7 +115,7 @@ export class UserApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -126,13 +126,13 @@ export class UserApi { * @param username The user name for login * @param password The password for login in clear text */ - public loginUser(username?: string, password?: string, extraHttpRequestParams?: any): Observable { + public loginUser(username: string, password: string, extraHttpRequestParams?: any): Observable { return this.loginUserWithHttpInfo(username, password, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -147,7 +147,7 @@ export class UserApi { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -158,13 +158,13 @@ export class UserApi { * @param username name that need to be deleted * @param body Updated user object */ - public updateUser(username: string, body?: models.User, extraHttpRequestParams?: any): Observable<{}> { + public updateUser(username: string, body: models.User, extraHttpRequestParams?: any): Observable<{}> { return this.updateUserWithHttpInfo(username, body, extraHttpRequestParams) .map((response: Response) => { if (response.status === 204) { return undefined; } else { - return response.json(); + return response.json() || {}; } }); } @@ -175,19 +175,23 @@ export class UserApi { * This can only be done by the logged in user. * @param body Created user object */ - public createUserWithHttpInfo(body?: models.User, extraHttpRequestParams?: any): Observable { + public createUserWithHttpInfo(body: models.User, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUser.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); @@ -212,19 +216,23 @@ export class UserApi { * * @param body List of user object */ - public createUsersWithArrayInputWithHttpInfo(body?: Array, extraHttpRequestParams?: any): Observable { + public createUsersWithArrayInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/createWithArray'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); @@ -249,19 +257,23 @@ export class UserApi { * * @param body List of user object */ - public createUsersWithListInputWithHttpInfo(body?: Array, extraHttpRequestParams?: any): Observable { + public createUsersWithListInputWithHttpInfo(body: Array, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/createWithList'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/json'); @@ -302,8 +314,8 @@ export class UserApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -341,8 +353,8 @@ export class UserApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -365,11 +377,19 @@ export class UserApi { * @param username The user name for login * @param password The password for login in clear text */ - public loginUserWithHttpInfo(username?: string, password?: string, extraHttpRequestParams?: any): Observable { + public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/login'; let queryParameters = new URLSearchParams(); let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new Error('Required parameter password was null or undefined when calling loginUser.'); + } if (username !== undefined) { queryParameters.set('username', username); } @@ -384,8 +404,8 @@ export class UserApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -417,8 +437,8 @@ export class UserApi { // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; let requestOptions: RequestOptionsArgs = new RequestOptions({ @@ -441,7 +461,7 @@ export class UserApi { * @param username name that need to be deleted * @param body Updated user object */ - public updateUserWithHttpInfo(username: string, body?: models.User, extraHttpRequestParams?: any): Observable { + public updateUserWithHttpInfo(username: string, body: models.User, extraHttpRequestParams?: any): Observable { const path = this.basePath + '/user/${username}' .replace('${' + 'username' + '}', String(username)); @@ -451,14 +471,18 @@ export class UserApi { if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling updateUser.'); } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling updateUser.'); + } // to determine the Content-Type header let consumes: string[] = [ ]; // to determine the Accept header let produces: string[] = [ - 'application/json', - 'application/xml' + 'application/xml', + 'application/json' ]; headers.set('Content-Type', 'application/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/model/Category.ts b/samples/client/petstore/typescript-angular2/npm/model/Category.ts index ffdacd4f707..254c3003c89 100644 --- a/samples/client/petstore/typescript-angular2/npm/model/Category.ts +++ b/samples/client/petstore/typescript-angular2/npm/model/Category.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A category for a pet + */ export interface Category { id?: number; diff --git a/samples/client/petstore/typescript-angular2/npm/model/Order.ts b/samples/client/petstore/typescript-angular2/npm/model/Order.ts index 9c47071c5b6..2b6c7aeebd6 100644 --- a/samples/client/petstore/typescript-angular2/npm/model/Order.ts +++ b/samples/client/petstore/typescript-angular2/npm/model/Order.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * An order for a pets from the pet store + */ export interface Order { id?: number; diff --git a/samples/client/petstore/typescript-angular2/npm/model/Pet.ts b/samples/client/petstore/typescript-angular2/npm/model/Pet.ts index d64dc809e53..b878cadb905 100644 --- a/samples/client/petstore/typescript-angular2/npm/model/Pet.ts +++ b/samples/client/petstore/typescript-angular2/npm/model/Pet.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A pet for sale in the pet store + */ export interface Pet { id?: number; diff --git a/samples/client/petstore/typescript-angular2/npm/model/Tag.ts b/samples/client/petstore/typescript-angular2/npm/model/Tag.ts index 8a3b99ae9ca..8cbdc4fa145 100644 --- a/samples/client/petstore/typescript-angular2/npm/model/Tag.ts +++ b/samples/client/petstore/typescript-angular2/npm/model/Tag.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A tag for a pet + */ export interface Tag { id?: number; diff --git a/samples/client/petstore/typescript-angular2/npm/model/User.ts b/samples/client/petstore/typescript-angular2/npm/model/User.ts index 43d00f7b318..fbf75dfe28e 100644 --- a/samples/client/petstore/typescript-angular2/npm/model/User.ts +++ b/samples/client/petstore/typescript-angular2/npm/model/User.ts @@ -1,9 +1,9 @@ /** * Swagger Petstore - * This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + * 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@wordnik.com + * Contact: apiteam@swagger.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git @@ -12,6 +12,9 @@ import * as models from './models'; +/** + * A User who is purchasing from the pet store + */ export interface User { id?: number; diff --git a/samples/client/petstore/typescript-angular2/npm/model/models.ts b/samples/client/petstore/typescript-angular2/npm/model/models.ts index 92dac02846c..f53c1dd42bd 100644 --- a/samples/client/petstore/typescript-angular2/npm/model/models.ts +++ b/samples/client/petstore/typescript-angular2/npm/model/models.ts @@ -1,3 +1,4 @@ +export * from './ApiResponse'; export * from './Category'; export * from './Order'; export * from './Pet'; From 9b68f02f83cf653ea4d8c0758d439f1598fdb553 Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 10 May 2017 17:31:43 +0800 Subject: [PATCH 22/22] [Java][Spring] Undo "Add examples defined in the spec to Spring MVC server generator " (#5599) * remove unused pom.xml in go pestore * remove example support in JavaSprin (undo changes) --- .../main/resources/JavaSpring/api.mustache | 18 +---- .../JavaSpring/apiController.mustache | 70 +++-------------- .../client/petstore/go/go-petstore/pom.xml | 75 ------------------- .../src/main/java/io/swagger/api/PetApi.java | 8 ++ .../main/java/io/swagger/api/StoreApi.java | 4 + .../src/main/java/io/swagger/api/UserApi.java | 8 ++ .../main/java/io/swagger/model/Category.java | 4 +- .../io/swagger/model/ModelApiResponse.java | 6 +- .../src/main/java/io/swagger/model/Order.java | 11 +-- .../src/main/java/io/swagger/model/Pet.java | 10 ++- .../src/main/java/io/swagger/model/Tag.java | 4 +- .../src/main/java/io/swagger/model/User.java | 16 ++-- .../src/main/java/io/swagger/api/PetApi.java | 25 ++++--- .../main/java/io/swagger/api/StoreApi.java | 13 ++-- .../src/main/java/io/swagger/api/UserApi.java | 25 ++++--- .../main/java/io/swagger/model/Category.java | 4 +- .../io/swagger/model/ModelApiResponse.java | 6 +- .../src/main/java/io/swagger/model/Order.java | 11 +-- .../src/main/java/io/swagger/model/Pet.java | 10 ++- .../src/main/java/io/swagger/model/Tag.java | 4 +- .../src/main/java/io/swagger/model/User.java | 16 ++-- .../src/main/java/io/swagger/api/FakeApi.java | 10 ++- .../io/swagger/api/FakeApiController.java | 8 +- .../src/main/java/io/swagger/api/PetApi.java | 25 ++++--- .../java/io/swagger/api/PetApiController.java | 8 +- .../main/java/io/swagger/api/StoreApi.java | 13 ++-- .../io/swagger/api/StoreApiController.java | 8 +- .../src/main/java/io/swagger/api/UserApi.java | 25 ++++--- .../io/swagger/api/UserApiController.java | 8 +- .../model/AdditionalPropertiesClass.java | 3 +- .../main/java/io/swagger/model/Animal.java | 4 +- .../model/ArrayOfArrayOfNumberOnly.java | 1 + .../io/swagger/model/ArrayOfNumberOnly.java | 1 + .../main/java/io/swagger/model/ArrayTest.java | 4 +- .../java/io/swagger/model/Capitalization.java | 12 +-- .../src/main/java/io/swagger/model/Cat.java | 2 +- .../main/java/io/swagger/model/Category.java | 4 +- .../java/io/swagger/model/ClassModel.java | 2 +- .../main/java/io/swagger/model/Client.java | 2 +- .../src/main/java/io/swagger/model/Dog.java | 2 +- .../java/io/swagger/model/EnumArrays.java | 4 +- .../main/java/io/swagger/model/EnumTest.java | 7 +- .../java/io/swagger/model/FormatTest.java | 24 +++--- .../io/swagger/model/HasOnlyReadOnly.java | 4 +- .../main/java/io/swagger/model/MapTest.java | 3 +- ...ropertiesAndAdditionalPropertiesClass.java | 3 + .../io/swagger/model/Model200Response.java | 4 +- .../io/swagger/model/ModelApiResponse.java | 6 +- .../java/io/swagger/model/ModelReturn.java | 2 +- .../src/main/java/io/swagger/model/Name.java | 8 +- .../java/io/swagger/model/NumberOnly.java | 1 + .../src/main/java/io/swagger/model/Order.java | 11 +-- .../src/main/java/io/swagger/model/Pet.java | 10 ++- .../java/io/swagger/model/ReadOnlyFirst.java | 4 +- .../io/swagger/model/SpecialModelName.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 4 +- .../src/main/java/io/swagger/model/User.java | 16 ++-- .../src/main/java/io/swagger/api/FakeApi.java | 10 ++- .../io/swagger/api/FakeApiController.java | 22 ++---- .../src/main/java/io/swagger/api/PetApi.java | 25 ++++--- .../java/io/swagger/api/PetApiController.java | 67 +++-------------- .../main/java/io/swagger/api/StoreApi.java | 13 ++-- .../io/swagger/api/StoreApiController.java | 44 ++--------- .../src/main/java/io/swagger/api/UserApi.java | 25 ++++--- .../io/swagger/api/UserApiController.java | 51 +++---------- .../model/AdditionalPropertiesClass.java | 3 +- .../main/java/io/swagger/model/Animal.java | 4 +- .../model/ArrayOfArrayOfNumberOnly.java | 1 + .../io/swagger/model/ArrayOfNumberOnly.java | 1 + .../main/java/io/swagger/model/ArrayTest.java | 4 +- .../java/io/swagger/model/Capitalization.java | 12 +-- .../src/main/java/io/swagger/model/Cat.java | 2 +- .../main/java/io/swagger/model/Category.java | 4 +- .../java/io/swagger/model/ClassModel.java | 2 +- .../main/java/io/swagger/model/Client.java | 2 +- .../src/main/java/io/swagger/model/Dog.java | 2 +- .../java/io/swagger/model/EnumArrays.java | 4 +- .../main/java/io/swagger/model/EnumTest.java | 7 +- .../java/io/swagger/model/FormatTest.java | 24 +++--- .../io/swagger/model/HasOnlyReadOnly.java | 4 +- .../main/java/io/swagger/model/MapTest.java | 3 +- ...ropertiesAndAdditionalPropertiesClass.java | 3 + .../io/swagger/model/Model200Response.java | 4 +- .../io/swagger/model/ModelApiResponse.java | 6 +- .../java/io/swagger/model/ModelReturn.java | 2 +- .../src/main/java/io/swagger/model/Name.java | 8 +- .../java/io/swagger/model/NumberOnly.java | 1 + .../src/main/java/io/swagger/model/Order.java | 11 +-- .../src/main/java/io/swagger/model/Pet.java | 10 ++- .../java/io/swagger/model/ReadOnlyFirst.java | 4 +- .../io/swagger/model/SpecialModelName.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 4 +- .../src/main/java/io/swagger/model/User.java | 16 ++-- .../src/main/java/io/swagger/api/FakeApi.java | 10 ++- .../io/swagger/api/FakeApiController.java | 22 ++---- .../src/main/java/io/swagger/api/PetApi.java | 25 ++++--- .../java/io/swagger/api/PetApiController.java | 67 +++-------------- .../main/java/io/swagger/api/StoreApi.java | 13 ++-- .../io/swagger/api/StoreApiController.java | 44 ++--------- .../src/main/java/io/swagger/api/UserApi.java | 25 ++++--- .../io/swagger/api/UserApiController.java | 51 +++---------- .../model/AdditionalPropertiesClass.java | 3 +- .../main/java/io/swagger/model/Animal.java | 4 +- .../model/ArrayOfArrayOfNumberOnly.java | 1 + .../io/swagger/model/ArrayOfNumberOnly.java | 1 + .../main/java/io/swagger/model/ArrayTest.java | 4 +- .../java/io/swagger/model/Capitalization.java | 12 +-- .../src/main/java/io/swagger/model/Cat.java | 2 +- .../main/java/io/swagger/model/Category.java | 4 +- .../java/io/swagger/model/ClassModel.java | 2 +- .../main/java/io/swagger/model/Client.java | 2 +- .../src/main/java/io/swagger/model/Dog.java | 2 +- .../java/io/swagger/model/EnumArrays.java | 4 +- .../main/java/io/swagger/model/EnumTest.java | 7 +- .../java/io/swagger/model/FormatTest.java | 24 +++--- .../io/swagger/model/HasOnlyReadOnly.java | 4 +- .../main/java/io/swagger/model/MapTest.java | 3 +- ...ropertiesAndAdditionalPropertiesClass.java | 3 + .../io/swagger/model/Model200Response.java | 4 +- .../io/swagger/model/ModelApiResponse.java | 6 +- .../java/io/swagger/model/ModelReturn.java | 2 +- .../src/main/java/io/swagger/model/Name.java | 8 +- .../java/io/swagger/model/NumberOnly.java | 1 + .../src/main/java/io/swagger/model/Order.java | 11 +-- .../src/main/java/io/swagger/model/Pet.java | 10 ++- .../java/io/swagger/model/ReadOnlyFirst.java | 4 +- .../io/swagger/model/SpecialModelName.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 4 +- .../src/main/java/io/swagger/model/User.java | 16 ++-- .../src/main/java/io/swagger/api/FakeApi.java | 10 ++- .../io/swagger/api/FakeApiController.java | 19 ++--- .../src/main/java/io/swagger/api/PetApi.java | 25 ++++--- .../java/io/swagger/api/PetApiController.java | 34 +++------ .../main/java/io/swagger/api/StoreApi.java | 13 ++-- .../io/swagger/api/StoreApiController.java | 21 ++---- .../src/main/java/io/swagger/api/UserApi.java | 25 ++++--- .../io/swagger/api/UserApiController.java | 33 +++----- .../model/AdditionalPropertiesClass.java | 3 +- .../main/java/io/swagger/model/Animal.java | 4 +- .../model/ArrayOfArrayOfNumberOnly.java | 1 + .../io/swagger/model/ArrayOfNumberOnly.java | 1 + .../main/java/io/swagger/model/ArrayTest.java | 4 +- .../java/io/swagger/model/Capitalization.java | 12 +-- .../src/main/java/io/swagger/model/Cat.java | 2 +- .../main/java/io/swagger/model/Category.java | 4 +- .../java/io/swagger/model/ClassModel.java | 2 +- .../main/java/io/swagger/model/Client.java | 2 +- .../src/main/java/io/swagger/model/Dog.java | 2 +- .../java/io/swagger/model/EnumArrays.java | 4 +- .../main/java/io/swagger/model/EnumTest.java | 7 +- .../java/io/swagger/model/FormatTest.java | 24 +++--- .../io/swagger/model/HasOnlyReadOnly.java | 4 +- .../main/java/io/swagger/model/MapTest.java | 3 +- ...ropertiesAndAdditionalPropertiesClass.java | 3 + .../io/swagger/model/Model200Response.java | 4 +- .../io/swagger/model/ModelApiResponse.java | 6 +- .../java/io/swagger/model/ModelReturn.java | 2 +- .../src/main/java/io/swagger/model/Name.java | 8 +- .../java/io/swagger/model/NumberOnly.java | 1 + .../src/main/java/io/swagger/model/Order.java | 11 +-- .../src/main/java/io/swagger/model/Pet.java | 10 ++- .../java/io/swagger/model/ReadOnlyFirst.java | 4 +- .../io/swagger/model/SpecialModelName.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 4 +- .../src/main/java/io/swagger/model/User.java | 16 ++-- .../src/main/java/io/swagger/api/FakeApi.java | 10 ++- .../io/swagger/api/FakeApiController.java | 19 ++--- .../src/main/java/io/swagger/api/PetApi.java | 25 ++++--- .../java/io/swagger/api/PetApiController.java | 34 +++------ .../main/java/io/swagger/api/StoreApi.java | 13 ++-- .../io/swagger/api/StoreApiController.java | 21 ++---- .../src/main/java/io/swagger/api/UserApi.java | 25 ++++--- .../io/swagger/api/UserApiController.java | 33 +++----- .../model/AdditionalPropertiesClass.java | 3 +- .../main/java/io/swagger/model/Animal.java | 4 +- .../model/ArrayOfArrayOfNumberOnly.java | 1 + .../io/swagger/model/ArrayOfNumberOnly.java | 1 + .../main/java/io/swagger/model/ArrayTest.java | 4 +- .../java/io/swagger/model/Capitalization.java | 12 +-- .../src/main/java/io/swagger/model/Cat.java | 2 +- .../main/java/io/swagger/model/Category.java | 4 +- .../java/io/swagger/model/ClassModel.java | 2 +- .../main/java/io/swagger/model/Client.java | 2 +- .../src/main/java/io/swagger/model/Dog.java | 2 +- .../java/io/swagger/model/EnumArrays.java | 4 +- .../main/java/io/swagger/model/EnumTest.java | 7 +- .../java/io/swagger/model/FormatTest.java | 24 +++--- .../io/swagger/model/HasOnlyReadOnly.java | 4 +- .../main/java/io/swagger/model/MapTest.java | 3 +- ...ropertiesAndAdditionalPropertiesClass.java | 3 + .../io/swagger/model/Model200Response.java | 4 +- .../io/swagger/model/ModelApiResponse.java | 6 +- .../java/io/swagger/model/ModelReturn.java | 2 +- .../src/main/java/io/swagger/model/Name.java | 8 +- .../java/io/swagger/model/NumberOnly.java | 1 + .../src/main/java/io/swagger/model/Order.java | 11 +-- .../src/main/java/io/swagger/model/Pet.java | 10 ++- .../java/io/swagger/model/ReadOnlyFirst.java | 4 +- .../io/swagger/model/SpecialModelName.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 4 +- .../src/main/java/io/swagger/model/User.java | 16 ++-- .../src/main/java/io/swagger/api/FakeApi.java | 10 ++- .../io/swagger/api/FakeApiController.java | 22 ++---- .../src/main/java/io/swagger/api/PetApi.java | 25 ++++--- .../java/io/swagger/api/PetApiController.java | 67 +++-------------- .../main/java/io/swagger/api/StoreApi.java | 13 ++-- .../io/swagger/api/StoreApiController.java | 44 ++--------- .../src/main/java/io/swagger/api/UserApi.java | 25 ++++--- .../io/swagger/api/UserApiController.java | 51 +++---------- .../model/AdditionalPropertiesClass.java | 3 +- .../main/java/io/swagger/model/Animal.java | 4 +- .../model/ArrayOfArrayOfNumberOnly.java | 1 + .../io/swagger/model/ArrayOfNumberOnly.java | 1 + .../main/java/io/swagger/model/ArrayTest.java | 4 +- .../java/io/swagger/model/Capitalization.java | 12 +-- .../src/main/java/io/swagger/model/Cat.java | 2 +- .../main/java/io/swagger/model/Category.java | 4 +- .../java/io/swagger/model/ClassModel.java | 2 +- .../main/java/io/swagger/model/Client.java | 2 +- .../src/main/java/io/swagger/model/Dog.java | 2 +- .../java/io/swagger/model/EnumArrays.java | 4 +- .../main/java/io/swagger/model/EnumTest.java | 7 +- .../java/io/swagger/model/FormatTest.java | 24 +++--- .../io/swagger/model/HasOnlyReadOnly.java | 4 +- .../main/java/io/swagger/model/MapTest.java | 3 +- ...ropertiesAndAdditionalPropertiesClass.java | 3 + .../io/swagger/model/Model200Response.java | 4 +- .../io/swagger/model/ModelApiResponse.java | 6 +- .../java/io/swagger/model/ModelReturn.java | 2 +- .../src/main/java/io/swagger/model/Name.java | 8 +- .../java/io/swagger/model/NumberOnly.java | 1 + .../src/main/java/io/swagger/model/Order.java | 11 +-- .../src/main/java/io/swagger/model/Pet.java | 10 ++- .../java/io/swagger/model/ReadOnlyFirst.java | 4 +- .../io/swagger/model/SpecialModelName.java | 2 +- .../src/main/java/io/swagger/model/Tag.java | 4 +- .../src/main/java/io/swagger/model/User.java | 16 ++-- 237 files changed, 1069 insertions(+), 1415 deletions(-) delete mode 100644 samples/client/petstore/go/go-petstore/pom.xml 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/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/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 728be281293..5240964394b 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 DateTime 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 728be281293..5240964394b 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 DateTime 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/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 5dc9bce00ef..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 @@ -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 java.util.concurrent.CompletableFuture; @@ -29,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)); } @@ -45,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)); } @@ -59,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/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index 1c4d6eade78..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 @@ -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 java.util.concurrent.CompletableFuture; @@ -33,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)); } @@ -51,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)); } @@ -69,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)); } @@ -87,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)); } @@ -103,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)); } @@ -122,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)); } @@ -140,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)); } @@ -158,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 3039796d0c5..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 @@ -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 java.util.concurrent.CompletableFuture; @@ -28,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)); } @@ -42,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)); } @@ -56,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)); } @@ -69,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 21aee4b1686..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 @@ -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 java.util.concurrent.CompletableFuture; @@ -27,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)); } @@ -39,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)); } @@ -51,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)); } @@ -64,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)); } @@ -78,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)); } @@ -91,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)); } @@ -103,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)); } @@ -116,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 8eefd6ed507..1e0e9707661 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) DateTime 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) DateTime 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 bc079bf6299..9edc15a4fc9 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) DateTime 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/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 9d6cf5cd4be..5ef3ec92155 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 DateTime 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 d4cd89cef34..d25bba89a9c 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 DateTime 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 4106ac36198..5bfcf28b3ea 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 DateTime 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 8eefd6ed507..1e0e9707661 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) DateTime 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) DateTime 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 bc079bf6299..9edc15a4fc9 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) DateTime 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/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 9d6cf5cd4be..5ef3ec92155 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 DateTime 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 d4cd89cef34..d25bba89a9c 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 DateTime 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 4106ac36198..5bfcf28b3ea 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 DateTime 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/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 8eefd6ed507..1e0e9707661 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) DateTime 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) DateTime 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 855d0b198c0..29d67bb25e2 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) DateTime 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/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 9d6cf5cd4be..5ef3ec92155 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 DateTime 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 d4cd89cef34..d25bba89a9c 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 DateTime 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 4106ac36198..5bfcf28b3ea 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 DateTime 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 8eefd6ed507..1e0e9707661 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) DateTime 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) DateTime 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 bc079bf6299..9edc15a4fc9 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) DateTime 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/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 9d6cf5cd4be..5ef3ec92155 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 DateTime 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 d4cd89cef34..d25bba89a9c 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 DateTime 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 4106ac36198..5bfcf28b3ea 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 DateTime 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; }