diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/BashClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/BashClientCodegen.java index 49cd8352866..9b2c2a8431c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/BashClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/BashClientCodegen.java @@ -1,29 +1,31 @@ package io.swagger.codegen.languages; -import io.swagger.codegen.*; -import io.swagger.models.properties.*; -import io.swagger.models.parameters.*; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import io.swagger.codegen.CliOption; +import io.swagger.codegen.CodegenConfig; +import io.swagger.codegen.CodegenOperation; +import io.swagger.codegen.CodegenParameter; +import io.swagger.codegen.CodegenType; +import io.swagger.codegen.DefaultCodegen; +import io.swagger.codegen.SupportingFile; import io.swagger.models.Model; import io.swagger.models.Operation; import io.swagger.models.Swagger; +import io.swagger.models.parameters.BodyParameter; +import io.swagger.models.parameters.Parameter; +import io.swagger.models.parameters.SerializableParameter; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.MapProperty; import io.swagger.models.properties.Property; - import org.apache.commons.lang3.StringEscapeUtils; -import org.apache.commons.lang3.StringUtils; -import java.util.HashMap; + +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.*; -import java.io.File; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Set; public class BashClientCodegen extends DefaultCodegen implements CodegenConfig { @@ -578,16 +580,17 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig { List codesamples = (List)op.vendorExtensions.get("x-code-samples"); for (Object codesample : codesamples) { - ObjectNode codesample_object = (ObjectNode)codesample; + if(codesample instanceof ObjectNode) { + ObjectNode codesample_object = (ObjectNode) codesample; - if((codesample_object.get("lang").asText()).equals("Shell")) { + if ((codesample_object.get("lang").asText()).equals("Shell")) { - op.vendorExtensions.put("x-bash-codegen-sample", - escapeUnsafeCharacters( - codesample_object.get("source").asText())); - - } + op.vendorExtensions.put("x-bash-codegen-sample", + escapeUnsafeCharacters( + codesample_object.get("source").asText())); + } + } } } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/bash/BashTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/bash/BashTest.java index 4f355723a7f..dec0d8ddd4a 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/bash/BashTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/bash/BashTest.java @@ -1,30 +1,14 @@ package io.swagger.codegen.bash; -import io.swagger.codegen.CodegenModel; import io.swagger.codegen.CodegenOperation; -import io.swagger.codegen.CodegenProperty; import io.swagger.codegen.CodegenParameter; import io.swagger.codegen.DefaultCodegen; import io.swagger.codegen.languages.BashClientCodegen; -import io.swagger.models.ArrayModel; -import io.swagger.models.Model; -import io.swagger.models.ModelImpl; import io.swagger.models.Operation; import io.swagger.models.Swagger; -import io.swagger.models.properties.ArrayProperty; -import io.swagger.models.properties.DateTimeProperty; -import io.swagger.models.properties.LongProperty; -import io.swagger.models.properties.MapProperty; -import io.swagger.models.properties.RefProperty; -import io.swagger.models.properties.StringProperty; import io.swagger.parser.SwaggerParser; - import org.testng.Assert; import org.testng.annotations.Test; -import org.testng.annotations.ITestAnnotation; - -import com.google.common.collect.Sets; -import java.util.Map; @SuppressWarnings("static-method") public class BashTest { @@ -48,7 +32,7 @@ public class BashTest { swagger); Assert.assertTrue( - op.vendorExtensions.containsKey("x-bash-codegen-sample")); + op.vendorExtensions.containsKey("x-code-samples")); Assert.assertEquals( op.vendorExtensions.get("x-bash-codegen-description"), diff --git a/pom.xml b/pom.xml index 4e88549b0e2..efc5df165c6 100644 --- a/pom.xml +++ b/pom.xml @@ -863,7 +863,7 @@ - 1.0.26-SNAPSHOT + 1.0.28 2.11.1 2.3.4 1.5.12 diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala index b59e7f912b4..50950fa51c2 100644 --- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala +++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala @@ -5,9 +5,9 @@ */ package io.swagger.client.api -import io.swagger.client.model.Pet import io.swagger.client.model.ApiResponse import java.io.File +import io.swagger.client.model.Pet import io.swagger.client.core._ import io.swagger.client.core.CollectionFormats._ import io.swagger.client.core.ApiKeyLocations._ diff --git a/samples/client/petstore/android/httpclient/docs/PetApi.md b/samples/client/petstore/android/httpclient/docs/PetApi.md index e7b393c8ea7..ff596b3d918 100644 --- a/samples/client/petstore/android/httpclient/docs/PetApi.md +++ b/samples/client/petstore/android/httpclient/docs/PetApi.md @@ -222,7 +222,7 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) ### HTTP request headers diff --git a/samples/client/petstore/android/volley/docs/PetApi.md b/samples/client/petstore/android/volley/docs/PetApi.md index e7b393c8ea7..ff596b3d918 100644 --- a/samples/client/petstore/android/volley/docs/PetApi.md +++ b/samples/client/petstore/android/volley/docs/PetApi.md @@ -222,7 +222,7 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) ### HTTP request headers diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java index 644a15c5da3..9772342710a 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java @@ -576,7 +576,7 @@ public class PetApi { // normal form params } - String[] authNames = new String[] { "api_key", "petstore_auth" }; + String[] authNames = new String[] { "petstore_auth", "api_key" }; try { String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); @@ -646,7 +646,7 @@ public class PetApi { // normal form params } - String[] authNames = new String[] { "api_key", "petstore_auth" }; + String[] authNames = new String[] { "petstore_auth", "api_key" }; try { apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, diff --git a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/PetApi.scala index 97f1bb2ba62..f11d2aaa1b5 100644 --- a/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/PetApi.scala +++ b/samples/client/petstore/async-scala/src/main/scala/io/swagger/client/api/PetApi.scala @@ -1,8 +1,8 @@ package io.swagger.client.api -import io.swagger.client.model.Pet -import java.io.File import io.swagger.client.model.ApiResponse +import java.io.File +import io.swagger.client.model.Pet import com.wordnik.swagger.client._ import scala.concurrent.Future import collection.mutable diff --git a/samples/client/petstore/bash/Dockerfile b/samples/client/petstore/bash/Dockerfile new file mode 100644 index 00000000000..ed2aed705d3 --- /dev/null +++ b/samples/client/petstore/bash/Dockerfile @@ -0,0 +1,61 @@ +FROM ubuntu:16.10 + +RUN apt-get update -y && apt-get full-upgrade -y +RUN apt-get install -y bash-completion zsh curl cowsay git vim bsdmainutils + +ADD petstore-cli /usr/bin/petstore-cli +ADD _petstore-cli /usr/local/share/zsh/site-functions/_petstore-cli +ADD petstore-cli.bash-completion /etc/bash-completion.d/petstore-cli + + +# +# Install oh-my-zsh +# +RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" || true + +# +# Enable bash completion +# +RUN echo '\n\ +. /etc/bash_completion\n\ +source /etc/bash-completion.d/petstore-cli\n\ +' >> ~/.bashrc + +# +# Setup prompt +# +RUN echo 'export PS1="[Swagger Petstore] \$ "' >> ~/.bashrc +RUN echo 'export PROMPT="[Swagger Petstore] \$ "' >> ~/.zshrc + +# +# Setup a welcome message with basic instruction +# +RUN echo 'cat << EOF\n\ +\n\ +This Docker provides preconfigured environment for running the command\n\ +line REST client for $(tput setaf 6)Swagger Petstore$(tput sgr0).\n\ +\n\ +For convenience, you can export the following environment variables:\n\ +\n\ +$(tput setaf 3)PETSTORE_HOST$(tput sgr0) - server URL, e.g. https://example.com:8080\n\ +$(tput setaf 3)PETSTORE_API_KEY$(tput sgr0) - access token, e.g. "ASDASHJDG63456asdASSD"\n\ +$(tput setaf 3)PETSTORE_BASIC_AUTH$(tput sgr0) - basic authentication credentials, e.g.: "username:password"\n\ +\n\ +$(tput setaf 7)Basic usage:$(tput sgr0)\n\ +\n\ +$(tput setaf 3)Print the list of operations available on the service$(tput sgr0)\n\ +$ petstore-cli -h\n\ +\n\ +$(tput setaf 3)Print the service description$(tput sgr0)\n\ +$ petstore-cli --about\n\ +\n\ +$(tput setaf 3)Print detailed information about specific operation$(tput sgr0)\n\ +$ petstore-cli -h\n\ +\n\ +By default you are logged into Zsh with full autocompletion for your REST API,\n\ +but you can switch to Bash, where basic autocompletion is also supported.\n\ +\n\ +EOF\n\ +' | tee -a ~/.bashrc ~/.zshrc + +ENTRYPOINT ["zsh"] diff --git a/samples/client/petstore/bash/_petstore-cli b/samples/client/petstore/bash/_petstore-cli index a1a2a44dcb9..fd6809257f4 100644 --- a/samples/client/petstore/bash/_petstore-cli +++ b/samples/client/petstore/bash/_petstore-cli @@ -10,7 +10,7 @@ # ! # ! Based on: https://github.com/Valodim/zsh-curl-completion/blob/master/_curl # ! -# ! Generated on: 2017-02-06T21:48:13.013+01:00 +# ! Generated on: 2017-03-13T18:03:04.084+01:00 # ! # ! # ! Installation: @@ -302,7 +302,7 @@ case $state in 假端點 偽のエンドポイント 가짜 엔드 포인트]" \ - "testEnumParameters[To test enum parameters]" "addPet[Add a new pet to the store]" \ + "testEnumParameters[To test enum parameters]" "testClassname[To test class name in snake case]" "addPet[Add a new pet to the store]" \ "deletePet[Deletes a pet]" \ "findPetsByStatus[Finds Pets by status]" \ "findPetsByTags[Finds Pets by tags]" \ @@ -349,6 +349,12 @@ case $state in ) _describe -t actions 'operations' _op_arguments -S '' && ret=0 ;; + testClassname) + local -a _op_arguments + _op_arguments=( + ) + _describe -t actions 'operations' _op_arguments -S '' && ret=0 + ;; addPet) local -a _op_arguments _op_arguments=( diff --git a/samples/client/petstore/bash/petstore-cli b/samples/client/petstore/bash/petstore-cli index 6b3270270ce..0f7552a3991 100755 --- a/samples/client/petstore/bash/petstore-cli +++ b/samples/client/petstore/bash/petstore-cli @@ -8,7 +8,7 @@ # ! swagger-codegen (https://github.com/swagger-api/swagger-codegen) # ! FROM SWAGGER SPECIFICATION IN JSON. # ! -# ! Generated on: 2017-02-06T21:48:13.013+01:00 +# ! Generated on: 2017-03-13T18:03:04.084+01:00 # ! # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -90,6 +90,7 @@ operation_parameters_minimum_occurences["testEnumParameters:::enum_query_string_ operation_parameters_minimum_occurences["testEnumParameters:::enum_query_string"]=0 operation_parameters_minimum_occurences["testEnumParameters:::enum_query_integer"]=0 operation_parameters_minimum_occurences["testEnumParameters:::enum_query_double"]=0 +operation_parameters_minimum_occurences["testClassname:::body"]=1 operation_parameters_minimum_occurences["addPet:::body"]=1 operation_parameters_minimum_occurences["deletePet:::petId"]=1 operation_parameters_minimum_occurences["deletePet:::api_key"]=0 @@ -146,6 +147,7 @@ operation_parameters_maximum_occurences["testEnumParameters:::enum_query_string_ operation_parameters_maximum_occurences["testEnumParameters:::enum_query_string"]=0 operation_parameters_maximum_occurences["testEnumParameters:::enum_query_integer"]=0 operation_parameters_maximum_occurences["testEnumParameters:::enum_query_double"]=0 +operation_parameters_maximum_occurences["testClassname:::body"]=0 operation_parameters_maximum_occurences["addPet:::body"]=0 operation_parameters_maximum_occurences["deletePet:::petId"]=0 operation_parameters_maximum_occurences["deletePet:::api_key"]=0 @@ -199,6 +201,7 @@ operation_parameters_collection_type["testEnumParameters:::enum_query_string_arr operation_parameters_collection_type["testEnumParameters:::enum_query_string"]="" operation_parameters_collection_type["testEnumParameters:::enum_query_integer"]="" operation_parameters_collection_type["testEnumParameters:::enum_query_double"]="" +operation_parameters_collection_type["testClassname:::body"]="" operation_parameters_collection_type["addPet:::body"]="" operation_parameters_collection_type["deletePet:::petId"]="" operation_parameters_collection_type["deletePet:::api_key"]="" @@ -720,6 +723,12 @@ read -d '' ops <>> PetApi::findPetsByTags(std::vector { - queryParams[U("tags")] = ApiClient::parameterToArrayString<>(tags); + queryParams[U("tags")] = ApiClient::parameterToArrayString(tags); } std::shared_ptr httpBody; diff --git a/samples/client/petstore/cpprest/api/PetApi.h b/samples/client/petstore/cpprest/api/PetApi.h index 0a783c66a29..d60c3c80fca 100644 --- a/samples/client/petstore/cpprest/api/PetApi.h +++ b/samples/client/petstore/cpprest/api/PetApi.h @@ -22,10 +22,10 @@ #include "ApiClient.h" -#include "Pet.h" -#include #include "ApiResponse.h" #include "HttpContent.h" +#include "Pet.h" +#include namespace io { namespace swagger { diff --git a/samples/client/petstore/cpprest/api/StoreApi.h b/samples/client/petstore/cpprest/api/StoreApi.h index 99cbedea460..60ec088b326 100644 --- a/samples/client/petstore/cpprest/api/StoreApi.h +++ b/samples/client/petstore/cpprest/api/StoreApi.h @@ -22,9 +22,9 @@ #include "ApiClient.h" -#include -#include #include "Order.h" +#include +#include namespace io { namespace swagger { diff --git a/samples/client/petstore/cpprest/model/Category.cpp b/samples/client/petstore/cpprest/model/Category.cpp index 9c0f21b3b22..bdb6d8e894a 100644 --- a/samples/client/petstore/cpprest/model/Category.cpp +++ b/samples/client/petstore/cpprest/model/Category.cpp @@ -21,7 +21,7 @@ namespace model { Category::Category() { - m_Id = 0L; + m_Id = 0; m_IdIsSet = false; m_Name = U(""); m_NameIsSet = false; diff --git a/samples/client/petstore/cpprest/model/Order.cpp b/samples/client/petstore/cpprest/model/Order.cpp index 07e815fa90c..e21d867cd7e 100644 --- a/samples/client/petstore/cpprest/model/Order.cpp +++ b/samples/client/petstore/cpprest/model/Order.cpp @@ -21,9 +21,9 @@ namespace model { Order::Order() { - m_Id = 0L; + m_Id = 0; m_IdIsSet = false; - m_PetId = 0L; + m_PetId = 0; m_PetIdIsSet = false; m_Quantity = 0; m_QuantityIsSet = false; diff --git a/samples/client/petstore/cpprest/model/Pet.cpp b/samples/client/petstore/cpprest/model/Pet.cpp index 74b707a4c26..51dd6d883e9 100644 --- a/samples/client/petstore/cpprest/model/Pet.cpp +++ b/samples/client/petstore/cpprest/model/Pet.cpp @@ -21,7 +21,7 @@ namespace model { Pet::Pet() { - m_Id = 0L; + m_Id = 0; m_IdIsSet = false; m_CategoryIsSet = false; m_Name = U(""); diff --git a/samples/client/petstore/cpprest/model/Tag.cpp b/samples/client/petstore/cpprest/model/Tag.cpp index 466ca0d29da..3cb0798c99e 100644 --- a/samples/client/petstore/cpprest/model/Tag.cpp +++ b/samples/client/petstore/cpprest/model/Tag.cpp @@ -21,7 +21,7 @@ namespace model { Tag::Tag() { - m_Id = 0L; + m_Id = 0; m_IdIsSet = false; m_Name = U(""); m_NameIsSet = false; diff --git a/samples/client/petstore/cpprest/model/User.cpp b/samples/client/petstore/cpprest/model/User.cpp index e9c5e969673..1ea09f35b50 100644 --- a/samples/client/petstore/cpprest/model/User.cpp +++ b/samples/client/petstore/cpprest/model/User.cpp @@ -21,7 +21,7 @@ namespace model { User::User() { - m_Id = 0L; + m_Id = 0; m_IdIsSet = false; m_Username = U(""); m_UsernameIsSet = false; diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md index edb62683e0f..90bd3728440 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md @@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c - API version: 1.0.0 - SDK version: 1.0.0 -- Build date: 2017-01-22T16:52:29.599+08:00 +- Build date: 2017-03-13T18:03:07.267+01:00 - Build package: io.swagger.codegen.languages.CsharpDotNet2ClientCodegen diff --git a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln index 4e593616590..fe31b214495 100644 --- a/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClient/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{45175ABF-4F24-48D0-B481-B1A2D9B8649E}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{883BBE2E-9469-4541-A7E5-BE20571E9306}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{45175ABF-4F24-48D0-B481-B1A2D9B8649E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{45175ABF-4F24-48D0-B481-B1A2D9B8649E}.Debug|Any CPU.Build.0 = Debug|Any CPU -{45175ABF-4F24-48D0-B481-B1A2D9B8649E}.Release|Any CPU.ActiveCfg = Release|Any CPU -{45175ABF-4F24-48D0-B481-B1A2D9B8649E}.Release|Any CPU.Build.0 = Release|Any CPU +{883BBE2E-9469-4541-A7E5-BE20571E9306}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{883BBE2E-9469-4541-A7E5-BE20571E9306}.Debug|Any CPU.Build.0 = Debug|Any CPU +{883BBE2E-9469-4541-A7E5-BE20571E9306}.Release|Any CPU.ActiveCfg = Release|Any CPU +{883BBE2E-9469-4541-A7E5-BE20571E9306}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index ab8b4d19139..68f3e29b301 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -97,6 +97,7 @@ 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 +*Fake_classname_tags123Api* | [**TestClassname**](docs/Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case *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 diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/Fake_classname_tags123Api.md b/samples/client/petstore/csharp/SwaggerClient/docs/Fake_classname_tags123Api.md new file mode 100644 index 00000000000..aa5f600491f --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/Fake_classname_tags123Api.md @@ -0,0 +1,69 @@ +# IO.Swagger.Api.Fake_classname_tags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestClassname**](Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +# **TestClassname** +> ModelClient TestClassname (ModelClient body) + +To test class name in snake case + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class TestClassnameExample + { + public void main() + { + + var apiInstance = new Fake_classname_tags123Api(); + var body = new ModelClient(); // ModelClient | client model + + try + { + // To test class name in snake case + ModelClient result = apiInstance.TestClassname(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling Fake_classname_tags123Api.TestClassname: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs new file mode 100644 index 00000000000..2b08417f7db --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs @@ -0,0 +1,81 @@ +/* + * 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: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using NUnit.Framework; + +using IO.Swagger.Client; +using IO.Swagger.Api; +using IO.Swagger.Model; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing Fake_classname_tags123Api + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the API endpoint. + /// + [TestFixture] + public class Fake_classname_tags123ApiTests + { + private Fake_classname_tags123Api instance; + + /// + /// Setup before each unit test + /// + [SetUp] + public void Init() + { + instance = new Fake_classname_tags123Api(); + } + + /// + /// Clean up after each unit test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of Fake_classname_tags123Api + /// + [Test] + public void InstanceTest() + { + // TODO uncomment below to test 'IsInstanceOfType' Fake_classname_tags123Api + //Assert.IsInstanceOfType(typeof(Fake_classname_tags123Api), instance, "instance is a Fake_classname_tags123Api"); + } + + + /// + /// Test TestClassname + /// + [Test] + public void TestClassnameTest() + { + // TODO uncomment below to test the method and replace null with proper value + //ModelClient body = null; + //var response = instance.TestClassname(body); + //Assert.IsInstanceOf (response, "response is ModelClient"); + } + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs new file mode 100644 index 00000000000..543f94e700a --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/Fake_classname_tags123Api.cs @@ -0,0 +1,341 @@ +/* + * 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: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace IO.Swagger.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFake_classname_tags123Api : IApiAccessor + { + #region Synchronous Operations + /// + /// To test class name in snake case + /// + /// + /// + /// + /// Thrown when fails to make API call + /// client model + /// ModelClient + ModelClient TestClassname (ModelClient body); + + /// + /// To test class name in snake case + /// + /// + /// + /// + /// Thrown when fails to make API call + /// client model + /// ApiResponse of ModelClient + ApiResponse TestClassnameWithHttpInfo (ModelClient body); + #endregion Synchronous Operations + #region Asynchronous Operations + /// + /// To test class name in snake case + /// + /// + /// + /// + /// Thrown when fails to make API call + /// client model + /// Task of ModelClient + System.Threading.Tasks.Task TestClassnameAsync (ModelClient body); + + /// + /// To test class name in snake case + /// + /// + /// + /// + /// Thrown when fails to make API call + /// client model + /// Task of ApiResponse (ModelClient) + System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class Fake_classname_tags123Api : IFake_classname_tags123Api + { + private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public Fake_classname_tags123Api(String basePath) + { + this.Configuration = new Configuration(new ApiClient(basePath)); + + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + + // ensure API client has configuration ready + if (Configuration.ApiClient.Configuration == null) + { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public Fake_classname_tags123Api(Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + + // ensure API client has configuration ready + if (Configuration.ApiClient.Configuration == null) + { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] + public void SetBasePath(String basePath) + { + // do nothing + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Configuration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public IO.Swagger.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Gets the default header. + /// + /// Dictionary of HTTP header + [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] + public Dictionary DefaultHeader() + { + return this.Configuration.DefaultHeader; + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] + public void AddDefaultHeader(string key, string value) + { + this.Configuration.AddDefaultHeader(key, value); + } + + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// ModelClient + public ModelClient TestClassname (ModelClient body) + { + ApiResponse localVarResponse = TestClassnameWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// ApiResponse of ModelClient + public ApiResponse< ModelClient > TestClassnameWithHttpInfo (ModelClient body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); + + var localVarPath = "/fake_classname_test"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestClassname", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); + + } + + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Task of ModelClient + public async System.Threading.Tasks.Task TestClassnameAsync (ModelClient body) + { + ApiResponse localVarResponse = await TestClassnameAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Task of ApiResponse (ModelClient) + public async System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); + + var localVarPath = "/fake_classname_test"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestClassname", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); + + } + + } +} 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 e1d4f2f595d..c320ab5dd49 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 @@ -11,7 +11,7 @@ Contact: apiteam@swagger.io Debug AnyCPU - {45175ABF-4F24-48D0-B481-B1A2D9B8649E} + {883BBE2E-9469-4541-A7E5-BE20571E9306} Library Properties IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln index d5879e565e7..9fa02d64da9 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{5B61D15D-DCEB-42AF-89A6-6AE15FB9548F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{F1AC30CE-606F-4C16-86BF-A51318DE4D3E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger.Test", "src\IO.Swagger.Test\IO.Swagger.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" EndProject @@ -12,10 +12,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{5B61D15D-DCEB-42AF-89A6-6AE15FB9548F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{5B61D15D-DCEB-42AF-89A6-6AE15FB9548F}.Debug|Any CPU.Build.0 = Debug|Any CPU -{5B61D15D-DCEB-42AF-89A6-6AE15FB9548F}.Release|Any CPU.ActiveCfg = Release|Any CPU -{5B61D15D-DCEB-42AF-89A6-6AE15FB9548F}.Release|Any CPU.Build.0 = Release|Any CPU +{F1AC30CE-606F-4C16-86BF-A51318DE4D3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{F1AC30CE-606F-4C16-86BF-A51318DE4D3E}.Debug|Any CPU.Build.0 = Debug|Any CPU +{F1AC30CE-606F-4C16-86BF-A51318DE4D3E}.Release|Any CPU.ActiveCfg = Release|Any CPU +{F1AC30CE-606F-4C16-86BF-A51318DE4D3E}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/README.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/README.md index ab8b4d19139..68f3e29b301 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/README.md +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/README.md @@ -97,6 +97,7 @@ 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 +*Fake_classname_tags123Api* | [**TestClassname**](docs/Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case *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 diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Capitalization.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Capitalization.md new file mode 100644 index 00000000000..87d14f03e0d --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Capitalization.md @@ -0,0 +1,14 @@ +# IO.Swagger.Model.Capitalization +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SmallCamel** | **string** | | [optional] +**CapitalCamel** | **string** | | [optional] +**SmallSnake** | **string** | | [optional] +**CapitalSnake** | **string** | | [optional] +**SCAETHFlowPoints** | **string** | | [optional] +**ATT_NAME** | **string** | Name of the pet | [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/SwaggerClientWithPropertyChanged/docs/Fake_classname_tags123Api.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Fake_classname_tags123Api.md new file mode 100644 index 00000000000..aa5f600491f --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/Fake_classname_tags123Api.md @@ -0,0 +1,69 @@ +# IO.Swagger.Api.Fake_classname_tags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**TestClassname**](Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +# **TestClassname** +> ModelClient TestClassname (ModelClient body) + +To test class name in snake case + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class TestClassnameExample + { + public void main() + { + + var apiInstance = new Fake_classname_tags123Api(); + var body = new ModelClient(); // ModelClient | client model + + try + { + // To test class name in snake case + ModelClient result = apiInstance.TestClassname(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling Fake_classname_tags123Api.TestClassname: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs new file mode 100644 index 00000000000..2b08417f7db --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Api/Fake_classname_tags123ApiTests.cs @@ -0,0 +1,81 @@ +/* + * 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: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using NUnit.Framework; + +using IO.Swagger.Client; +using IO.Swagger.Api; +using IO.Swagger.Model; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing Fake_classname_tags123Api + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the API endpoint. + /// + [TestFixture] + public class Fake_classname_tags123ApiTests + { + private Fake_classname_tags123Api instance; + + /// + /// Setup before each unit test + /// + [SetUp] + public void Init() + { + instance = new Fake_classname_tags123Api(); + } + + /// + /// Clean up after each unit test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of Fake_classname_tags123Api + /// + [Test] + public void InstanceTest() + { + // TODO uncomment below to test 'IsInstanceOfType' Fake_classname_tags123Api + //Assert.IsInstanceOfType(typeof(Fake_classname_tags123Api), instance, "instance is a Fake_classname_tags123Api"); + } + + + /// + /// Test TestClassname + /// + [Test] + public void TestClassnameTest() + { + // TODO uncomment below to test the method and replace null with proper value + //ModelClient body = null; + //var response = instance.TestClassname(body); + //Assert.IsInstanceOf (response, "response is ModelClient"); + } + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj index 02c13c1a05b..b0705818588 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/IO.Swagger.Test.csproj @@ -74,7 +74,7 @@ Contact: apiteam@swagger.io - {5B61D15D-DCEB-42AF-89A6-6AE15FB9548F} + {F1AC30CE-606F-4C16-86BF-A51318DE4D3E} IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs new file mode 100644 index 00000000000..30ed8700f74 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/CapitalizationTests.cs @@ -0,0 +1,118 @@ +/* + * 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: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing Capitalization + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class CapitalizationTests + { + // TODO uncomment below to declare an instance variable for Capitalization + //private Capitalization instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of Capitalization + //instance = new Capitalization(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of Capitalization + /// + [Test] + public void CapitalizationInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" Capitalization + //Assert.IsInstanceOfType (instance, "variable 'instance' is a Capitalization"); + } + + /// + /// Test the property 'SmallCamel' + /// + [Test] + public void SmallCamelTest() + { + // TODO unit test for the property 'SmallCamel' + } + /// + /// Test the property 'CapitalCamel' + /// + [Test] + public void CapitalCamelTest() + { + // TODO unit test for the property 'CapitalCamel' + } + /// + /// Test the property 'SmallSnake' + /// + [Test] + public void SmallSnakeTest() + { + // TODO unit test for the property 'SmallSnake' + } + /// + /// Test the property 'CapitalSnake' + /// + [Test] + public void CapitalSnakeTest() + { + // TODO unit test for the property 'CapitalSnake' + } + /// + /// Test the property 'SCAETHFlowPoints' + /// + [Test] + public void SCAETHFlowPointsTest() + { + // TODO unit test for the property 'SCAETHFlowPoints' + } + /// + /// Test the property 'ATT_NAME' + /// + [Test] + public void ATT_NAMETest() + { + // TODO unit test for the property 'ATT_NAME' + } + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/Fake_classname_tags123Api.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/Fake_classname_tags123Api.cs new file mode 100644 index 00000000000..543f94e700a --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/Fake_classname_tags123Api.cs @@ -0,0 +1,341 @@ +/* + * 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: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using RestSharp; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace IO.Swagger.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFake_classname_tags123Api : IApiAccessor + { + #region Synchronous Operations + /// + /// To test class name in snake case + /// + /// + /// + /// + /// Thrown when fails to make API call + /// client model + /// ModelClient + ModelClient TestClassname (ModelClient body); + + /// + /// To test class name in snake case + /// + /// + /// + /// + /// Thrown when fails to make API call + /// client model + /// ApiResponse of ModelClient + ApiResponse TestClassnameWithHttpInfo (ModelClient body); + #endregion Synchronous Operations + #region Asynchronous Operations + /// + /// To test class name in snake case + /// + /// + /// + /// + /// Thrown when fails to make API call + /// client model + /// Task of ModelClient + System.Threading.Tasks.Task TestClassnameAsync (ModelClient body); + + /// + /// To test class name in snake case + /// + /// + /// + /// + /// Thrown when fails to make API call + /// client model + /// Task of ApiResponse (ModelClient) + System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class Fake_classname_tags123Api : IFake_classname_tags123Api + { + private IO.Swagger.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public Fake_classname_tags123Api(String basePath) + { + this.Configuration = new Configuration(new ApiClient(basePath)); + + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + + // ensure API client has configuration ready + if (Configuration.ApiClient.Configuration == null) + { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public Fake_classname_tags123Api(Configuration configuration = null) + { + if (configuration == null) // use the default one in Configuration + this.Configuration = Configuration.Default; + else + this.Configuration = configuration; + + ExceptionFactory = IO.Swagger.Client.Configuration.DefaultExceptionFactory; + + // ensure API client has configuration ready + if (Configuration.ApiClient.Configuration == null) + { + this.Configuration.ApiClient.Configuration = this.Configuration; + } + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public String GetBasePath() + { + return this.Configuration.ApiClient.RestClient.BaseUrl.ToString(); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")] + public void SetBasePath(String basePath) + { + // do nothing + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Configuration Configuration {get; set;} + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public IO.Swagger.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Gets the default header. + /// + /// Dictionary of HTTP header + [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")] + public Dictionary DefaultHeader() + { + return this.Configuration.DefaultHeader; + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")] + public void AddDefaultHeader(string key, string value) + { + this.Configuration.AddDefaultHeader(key, value); + } + + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// ModelClient + public ModelClient TestClassname (ModelClient body) + { + ApiResponse localVarResponse = TestClassnameWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// ApiResponse of ModelClient + public ApiResponse< ModelClient > TestClassnameWithHttpInfo (ModelClient body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); + + var localVarPath = "/fake_classname_test"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestClassname", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); + + } + + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Task of ModelClient + public async System.Threading.Tasks.Task TestClassnameAsync (ModelClient body) + { + ApiResponse localVarResponse = await TestClassnameAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Task of ApiResponse (ModelClient) + public async System.Threading.Tasks.Task> TestClassnameAsyncWithHttpInfo (ModelClient body) + { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling Fake_classname_tags123Api->TestClassname"); + + var localVarPath = "/fake_classname_test"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + // set "format" to json by default + // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json + localVarPathParams.Add("format", "json"); + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.PATCH, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestClassname", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ModelClient) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ModelClient))); + + } + + } +} 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 f119b58e6d0..12874356c84 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 @@ -11,7 +11,7 @@ Contact: apiteam@swagger.io Debug AnyCPU - {5B61D15D-DCEB-42AF-89A6-6AE15FB9548F} + {F1AC30CE-606F-4C16-86BF-A51318DE4D3E} Library Properties IO.Swagger diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.nuspec b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.nuspec new file mode 100644 index 00000000000..87ba93febfe --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/IO.Swagger.nuspec @@ -0,0 +1,44 @@ + + + + + $id$ + Swagger Library + + + $version$ + + + $author$ + + + $author$ + false + false + + + A library generated from a Swagger doc + http://swagger.io/terms/ + http://www.apache.org/licenses/LICENSE-2.0.html + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs new file mode 100644 index 00000000000..2f11e06c42f --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/Capitalization.cs @@ -0,0 +1,213 @@ +/* + * 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: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace IO.Swagger.Model +{ + /// + /// Capitalization + /// + [DataContract] + [ImplementPropertyChanged] + public partial class Capitalization : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// SmallCamel. + /// CapitalCamel. + /// SmallSnake. + /// CapitalSnake. + /// SCAETHFlowPoints. + /// Name of the pet . + public Capitalization(string SmallCamel = default(string), string CapitalCamel = default(string), string SmallSnake = default(string), string CapitalSnake = default(string), string SCAETHFlowPoints = default(string), string ATT_NAME = default(string)) + { + this.SmallCamel = SmallCamel; + this.CapitalCamel = CapitalCamel; + this.SmallSnake = SmallSnake; + this.CapitalSnake = CapitalSnake; + this.SCAETHFlowPoints = SCAETHFlowPoints; + this.ATT_NAME = ATT_NAME; + } + + /// + /// Gets or Sets SmallCamel + /// + [DataMember(Name="smallCamel", EmitDefaultValue=false)] + public string SmallCamel { get; set; } + /// + /// Gets or Sets CapitalCamel + /// + [DataMember(Name="CapitalCamel", EmitDefaultValue=false)] + public string CapitalCamel { get; set; } + /// + /// Gets or Sets SmallSnake + /// + [DataMember(Name="small_Snake", EmitDefaultValue=false)] + public string SmallSnake { get; set; } + /// + /// Gets or Sets CapitalSnake + /// + [DataMember(Name="Capital_Snake", EmitDefaultValue=false)] + public string CapitalSnake { get; set; } + /// + /// Gets or Sets SCAETHFlowPoints + /// + [DataMember(Name="SCA_ETH_Flow_Points", EmitDefaultValue=false)] + public string SCAETHFlowPoints { get; set; } + /// + /// Name of the pet + /// + /// Name of the pet + [DataMember(Name="ATT_NAME", EmitDefaultValue=false)] + public string ATT_NAME { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class Capitalization {\n"); + sb.Append(" SmallCamel: ").Append(SmallCamel).Append("\n"); + sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append("\n"); + sb.Append(" SmallSnake: ").Append(SmallSnake).Append("\n"); + sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append("\n"); + sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append("\n"); + sb.Append(" ATT_NAME: ").Append(ATT_NAME).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as Capitalization); + } + + /// + /// Returns true if Capitalization instances are equal + /// + /// Instance of Capitalization to be compared + /// Boolean + public bool Equals(Capitalization other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.SmallCamel == other.SmallCamel || + this.SmallCamel != null && + this.SmallCamel.Equals(other.SmallCamel) + ) && + ( + this.CapitalCamel == other.CapitalCamel || + this.CapitalCamel != null && + this.CapitalCamel.Equals(other.CapitalCamel) + ) && + ( + this.SmallSnake == other.SmallSnake || + this.SmallSnake != null && + this.SmallSnake.Equals(other.SmallSnake) + ) && + ( + this.CapitalSnake == other.CapitalSnake || + this.CapitalSnake != null && + this.CapitalSnake.Equals(other.CapitalSnake) + ) && + ( + this.SCAETHFlowPoints == other.SCAETHFlowPoints || + this.SCAETHFlowPoints != null && + this.SCAETHFlowPoints.Equals(other.SCAETHFlowPoints) + ) && + ( + this.ATT_NAME == other.ATT_NAME || + this.ATT_NAME != null && + this.ATT_NAME.Equals(other.ATT_NAME) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.SmallCamel != null) + hash = hash * 59 + this.SmallCamel.GetHashCode(); + if (this.CapitalCamel != null) + hash = hash * 59 + this.CapitalCamel.GetHashCode(); + if (this.SmallSnake != null) + hash = hash * 59 + this.SmallSnake.GetHashCode(); + if (this.CapitalSnake != null) + hash = hash * 59 + this.CapitalSnake.GetHashCode(); + if (this.SCAETHFlowPoints != null) + hash = hash * 59 + this.SCAETHFlowPoints.GetHashCode(); + if (this.ATT_NAME != null) + hash = hash * 59 + this.ATT_NAME.GetHashCode(); + return hash; + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/dart/swagger/README.md b/samples/client/petstore/dart/swagger/README.md index 92fa3e33024..487490fe02f 100644 --- a/samples/client/petstore/dart/swagger/README.md +++ b/samples/client/petstore/dart/swagger/README.md @@ -4,8 +4,8 @@ This is a sample server Petstore server. You can find out more about Swagger at This Dart package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 -- Build date: 2016-11-30T18:12:21.701+08:00 -- Build package: class io.swagger.codegen.languages.DartClientCodegen +- Build date: 2017-03-13T18:03:16.229+01:00 +- Build package: io.swagger.codegen.languages.DartClientCodegen ## Requirements diff --git a/samples/client/petstore/dart/swagger/docs/PetApi.md b/samples/client/petstore/dart/swagger/docs/PetApi.md index 04b6695dbd6..8832e57f4ab 100644 --- a/samples/client/petstore/dart/swagger/docs/PetApi.md +++ b/samples/client/petstore/dart/swagger/docs/PetApi.md @@ -5,7 +5,7 @@ import 'package:swagger/api.dart'; ``` -All URIs are relative to ** +All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/samples/client/petstore/dart/swagger/docs/StoreApi.md b/samples/client/petstore/dart/swagger/docs/StoreApi.md index 112ffe75efb..c2e5dcdfde1 100644 --- a/samples/client/petstore/dart/swagger/docs/StoreApi.md +++ b/samples/client/petstore/dart/swagger/docs/StoreApi.md @@ -5,7 +5,7 @@ import 'package:swagger/api.dart'; ``` -All URIs are relative to ** +All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/samples/client/petstore/dart/swagger/docs/UserApi.md b/samples/client/petstore/dart/swagger/docs/UserApi.md index 8457602024a..2c14f3508d4 100644 --- a/samples/client/petstore/dart/swagger/docs/UserApi.md +++ b/samples/client/petstore/dart/swagger/docs/UserApi.md @@ -5,7 +5,7 @@ import 'package:swagger/api.dart'; ``` -All URIs are relative to ** +All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/samples/client/petstore/elixir/lib/swagger_petstore/api/fake_classname_tags123.ex b/samples/client/petstore/elixir/lib/swagger_petstore/api/fake_classname_tags123.ex new file mode 100644 index 00000000000..2cd659d09f6 --- /dev/null +++ b/samples/client/petstore/elixir/lib/swagger_petstore/api/fake_classname_tags123.ex @@ -0,0 +1,24 @@ +defmodule SwaggerPetstore.Api.Fake_classname_tags123 do + @moduledoc """ + Documentation for SwaggerPetstore.Api.Fake_classname_tags123. + """ + + use Tesla + + plug Tesla.Middleware.BaseUrl, "http://petstore.swagger.io/v2" + plug Tesla.Middleware.JSON + + def test_classname(body) do + method = [method: :patch] + url = [url: "/fake_classname_test"] + query_params = [] + header_params = [] + body_params = [body: body] + form_params = [] + params = query_params ++ header_params ++ body_params ++ form_params + opts = [] + options = method ++ url ++ params ++ opts + + request(options) + end +end diff --git a/samples/client/petstore/flash/.swagger-codegen-ignore b/samples/client/petstore/flash/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/client/petstore/flash/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/flash/flash/src/io/swagger/client/api/PetApi.as b/samples/client/petstore/flash/flash/src/io/swagger/client/api/PetApi.as index 6d44370b732..34b1b7a395d 100644 --- a/samples/client/petstore/flash/flash/src/io/swagger/client/api/PetApi.as +++ b/samples/client/petstore/flash/flash/src/io/swagger/client/api/PetApi.as @@ -6,9 +6,9 @@ import io.swagger.exception.ApiError; import io.swagger.common.ApiUserCredentials; import io.swagger.event.Response; import io.swagger.common.SwaggerApi; -import io.swagger.client.model.Pet; import io.swagger.client.model.ApiResponse; import flash.filesystem.File; +import io.swagger.client.model.Pet; import mx.rpc.AsyncToken; import mx.utils.UIDUtil; diff --git a/samples/client/petstore/flash/git_push.sh b/samples/client/petstore/flash/git_push.sh index 1a36388db02..ed374619b13 100644 --- a/samples/client/petstore/flash/git_push.sh +++ b/samples/client/petstore/flash/git_push.sh @@ -8,12 +8,12 @@ git_repo_id=$2 release_note=$3 if [ "$git_user_id" = "" ]; then - git_user_id="YOUR_GIT_USR_ID" + git_user_id="GIT_USER_ID" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="YOUR_GIT_REPO_ID" + git_repo_id="GIT_REPO_ID" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/samples/client/petstore/go/go-petstore/fake_api.go b/samples/client/petstore/go/go-petstore/fake_api.go index 2e2638e076d..282c0d50b36 100644 --- a/samples/client/petstore/go/go-petstore/fake_api.go +++ b/samples/client/petstore/go/go-petstore/fake_api.go @@ -1,4 +1,4 @@ -/* +/* * 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: \" \\ @@ -11,10 +11,10 @@ package petstore import ( - "encoding/json" "net/url" "strings" "time" + "encoding/json" ) type FakeApi struct { @@ -62,7 +62,7 @@ func (a FakeApi) TestClientModel(body Client) (*Client, *APIResponse, error) { } // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/json"} + localVarHttpContentTypes := []string{ "application/json", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -72,7 +72,7 @@ func (a FakeApi) TestClientModel(body Client) (*Client, *APIResponse, error) { // to determine the Accept header localVarHttpHeaderAccepts := []string{ "application/json", - } + } // set Accept header localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) @@ -100,8 +100,8 @@ func (a FakeApi) TestClientModel(body Client) (*Client, *APIResponse, error) { } /** - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 * * @param number None * @param double None @@ -118,7 +118,7 @@ func (a FakeApi) TestClientModel(body Client) (*Client, *APIResponse, error) { * @param "dateTime" (time.Time) None * @param "password" (string) None * @param "callback" (string) None - * @return + * @return */ func (a FakeApi) TestEndpointParameters(number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals map[string]interface{}) (*APIResponse, error) { @@ -134,8 +134,8 @@ func (a FakeApi) TestEndpointParameters(number float32, double float64, patternW var localVarFileBytes []byte // authentication '(http_basic_test)' required // http basic authentication required - if a.Configuration.Username != "" || a.Configuration.Password != "" { - localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + localVarHeaderParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString() } // add default headers if any for key := range a.Configuration.DefaultHeader { @@ -143,7 +143,7 @@ func (a FakeApi) TestEndpointParameters(number float32, double float64, patternW } // to determine the Content-Type header - localVarHttpContentTypes := []string{"application/xml; charset=utf-8", "application/json; charset=utf-8"} + localVarHttpContentTypes := []string{ "application/xml; charset=utf-8", "application/json; charset=utf-8", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -154,7 +154,7 @@ func (a FakeApi) TestEndpointParameters(number float32, double float64, patternW localVarHttpHeaderAccepts := []string{ "application/xml; charset=utf-8", "application/json; charset=utf-8", - } + } // set Accept header localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) @@ -224,7 +224,7 @@ func (a FakeApi) TestEndpointParameters(number float32, double float64, patternW * @param "enumQueryString" (string) Query parameter enum test (string) * @param "enumQueryInteger" (int32) Query parameter enum test (double) * @param "enumQueryDouble" (float64) Query parameter enum test (double) - * @return + * @return */ func (a FakeApi) TestEnumParameters(localVarOptionals map[string]interface{}) (*APIResponse, error) { @@ -242,9 +242,9 @@ func (a FakeApi) TestEnumParameters(localVarOptionals map[string]interface{}) (* for key := range a.Configuration.DefaultHeader { localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] } - var collectionFormat = "csv" + var enumQueryStringArrayCollectionFormat = "csv" if localVarTempParam, localVarOk := localVarOptionals["enumQueryStringArray"].([]string); localVarOptionals != nil && localVarOk { - localVarQueryParams.Add("enum_query_string_array", a.Configuration.APIClient.ParameterToString(localVarTempParam, collectionFormat)) + localVarQueryParams.Add("enum_query_string_array", a.Configuration.APIClient.ParameterToString(localVarTempParam, enumQueryStringArrayCollectionFormat)) } if localVarTempParam, localVarOk := localVarOptionals["enumQueryString"].(string); localVarOptionals != nil && localVarOk { localVarQueryParams.Add("enum_query_string", a.Configuration.APIClient.ParameterToString(localVarTempParam, "")) @@ -254,7 +254,7 @@ func (a FakeApi) TestEnumParameters(localVarOptionals map[string]interface{}) (* } // to determine the Content-Type header - localVarHttpContentTypes := []string{"*/*"} + localVarHttpContentTypes := []string{ "*/*", } // set Content-Type header localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) @@ -264,7 +264,7 @@ func (a FakeApi) TestEnumParameters(localVarOptionals map[string]interface{}) (* // to determine the Accept header localVarHttpHeaderAccepts := []string{ "*/*", - } + } // set Accept header localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) @@ -301,3 +301,4 @@ func (a FakeApi) TestEnumParameters(localVarOptionals map[string]interface{}) (* } return localVarAPIResponse, err } + diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy index d0779e65c25..b1b43f81559 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/PetApi.groovy @@ -5,9 +5,9 @@ import static groovyx.net.http.ContentType.* import static groovyx.net.http.Method.* import io.swagger.api.ApiUtils -import io.swagger.model.Pet +import io.swagger.model.File import io.swagger.model.ModelApiResponse -import java.io.File +import io.swagger.model.Pet import java.util.*; diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/StoreApi.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/StoreApi.groovy index 0cf30090200..51047b4834b 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/StoreApi.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/api/StoreApi.groovy @@ -5,6 +5,7 @@ import static groovyx.net.http.ContentType.* import static groovyx.net.http.Method.* import io.swagger.api.ApiUtils +import io.swagger.model.Map import io.swagger.model.Order import java.util.*; diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy index afc35651173..ca30463cfb4 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Order.groovy @@ -3,7 +3,7 @@ package io.swagger.model; import groovy.transform.Canonical import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.Date; +import io.swagger.model.Date; @Canonical class Order { diff --git a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy index 53f113424cd..4e2bb9db157 100644 --- a/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy +++ b/samples/client/petstore/groovy/src/main/groovy/io/swagger/model/Pet.groovy @@ -3,9 +3,9 @@ package io.swagger.model; import groovy.transform.Canonical import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.ArrayList; import io.swagger.model.Category; import io.swagger.model.Tag; -import java.util.ArrayList; import java.util.List; @Canonical class Pet { diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..78304e89b0d --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,29 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiClient; + +import io.swagger.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import feign.*; + + +public interface FakeClassnameTags123Api extends ApiClient.Api { + + + /** + * To test class name in snake case + * + * @param body client model (required) + * @return Client + */ + @RequestLine("PATCH /fake_classname_test") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + Client testClassname(Client body); +} diff --git a/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..77930522c3c --- /dev/null +++ b/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,39 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiClient; +import io.swagger.client.model.Client; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + private FakeClassnameTags123Api api; + + @Before + public void setup() { + api = new ApiClient().buildClient(FakeClassnameTags123Api.class); + } + + + /** + * To test class name in snake case + * + * + */ + @Test + public void testClassnameTest() { + Client body = null; + // Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey1/docs/FakeApi.md b/samples/client/petstore/java/jersey1/docs/FakeApi.md index 651c9d0c43f..0e370b3862f 100644 --- a/samples/client/petstore/java/jersey1/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey1/docs/FakeApi.md @@ -175,8 +175,8 @@ Name | Type | Description | Notes **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] ### Return type diff --git a/samples/client/petstore/java/jersey1/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey1/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..44b5bcd6bc8 --- /dev/null +++ b/samples/client/petstore/java/jersey1/docs/FakeClassnameTags123Api.md @@ -0,0 +1,52 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeClassnameTags123Api; + + +FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); +Client body = new Client(); // Client | client model +try { + Client result = apiInstance.testClassname(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..bd7c179ff1e --- /dev/null +++ b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,92 @@ +/* + * 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: \" \\ + * + * 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. + */ + +package io.swagger.client.api; + +import com.sun.jersey.api.client.GenericType; + +import io.swagger.client.ApiException; +import io.swagger.client.ApiClient; +import io.swagger.client.Configuration; +import io.swagger.client.model.*; +import io.swagger.client.Pair; + +import io.swagger.client.model.Client; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class FakeClassnameTags123Api { + private ApiClient apiClient; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test class name in snake case + * + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + */ + public Client testClassname(Client body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname"); + } + + // create path and map variables + String localVarPath = "/fake_classname_test".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/samples/client/petstore/java/jersey1/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/jersey1/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..af5885aaddd --- /dev/null +++ b/samples/client/petstore/java/jersey1/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,51 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.Client; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Ignore +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + + /** + * To test class name in snake case + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client body = null; + Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey2-java6/.travis.yml b/samples/client/petstore/java/jersey2-java6/.travis.yml index 33e79472abd..70cb81a67c2 100644 --- a/samples/client/petstore/java/jersey2-java6/.travis.yml +++ b/samples/client/petstore/java/jersey2-java6/.travis.yml @@ -1,18 +1,6 @@ # # Generated by: https://github.com/swagger-api/swagger-codegen.git # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# language: java jdk: - oraclejdk8 diff --git a/samples/client/petstore/java/jersey2-java6/build.gradle b/samples/client/petstore/java/jersey2-java6/build.gradle index 3aced963cc4..d0acf976a5a 100644 --- a/samples/client/petstore/java/jersey2-java6/build.gradle +++ b/samples/client/petstore/java/jersey2-java6/build.gradle @@ -96,7 +96,6 @@ ext { swagger_annotations_version = "1.5.8" jackson_version = "2.7.5" jersey_version = "2.22.2" - jodatime_version = "2.9.4" commons_io_version=2.5 commons_lang3_version=3.5 junit_version = "4.12" @@ -110,10 +109,9 @@ dependencies { compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" - compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version" - compile "joda-time:joda-time:$jodatime_version" compile "commons-io:commons-io:$commons_io_version" compile "org.apache.commons:commons-lang3:$commons_lang3_version" + compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_version", compile "com.brsanthu:migbase64:2.2" testCompile "junit:junit:$junit_version" } diff --git a/samples/client/petstore/java/jersey2-java6/build.sbt b/samples/client/petstore/java/jersey2-java6/build.sbt index e4fccb57d6a..48cf18c0d8c 100644 --- a/samples/client/petstore/java/jersey2-java6/build.sbt +++ b/samples/client/petstore/java/jersey2-java6/build.sbt @@ -13,11 +13,10 @@ lazy val root = (project in file(".")). "org.glassfish.jersey.core" % "jersey-client" % "2.22.2", "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2", "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2", - "com.fasterxml.jackson.core" % "jackson-core" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5", - "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5", - "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.7.5", - "joda-time" % "joda-time" % "2.9.4", + "com.fasterxml.jackson.core" % "jackson-core" % "2.6.4" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.6.4" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.6.4" % "compile", + "com.github.joschi.jackson" % "jackson-datatype-threetenbp" % "2.6.4" % "compile", "com.brsanthu" % "migbase64" % "2.2", "org.apache.commons" % "commons-lang3" % "3.5", "commons-io" % "commons-io" % "2.5", diff --git a/samples/client/petstore/java/jersey2-java6/docs/Capitalization.md b/samples/client/petstore/java/jersey2-java6/docs/Capitalization.md new file mode 100644 index 00000000000..0f3064c1996 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/docs/Capitalization.md @@ -0,0 +1,15 @@ + +# Capitalization + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**scAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-java6/docs/ClassModel.md b/samples/client/petstore/java/jersey2-java6/docs/ClassModel.md new file mode 100644 index 00000000000..64f880c8786 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/docs/ClassModel.md @@ -0,0 +1,10 @@ + +# ClassModel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertyClass** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md b/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md index 29b6d288c8f..08fee344882 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md +++ b/samples/client/petstore/java/jersey2-java6/docs/EnumTest.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] **enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] **enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] diff --git a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md index 29813bd9349..0e370b3862f 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md @@ -15,6 +15,8 @@ Method | HTTP request | Description To test \"client\" model +To test \"client\" model + ### Example ```java // Import classes: @@ -88,7 +90,7 @@ Float _float = 3.4F; // Float | None String string = "string_example"; // String | None byte[] binary = B; // byte[] | None LocalDate date = new LocalDate(); // LocalDate | None -DateTime dateTime = new DateTime(); // DateTime | None +OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None String password = "password_example"; // String | None String paramCallback = "paramCallback_example"; // String | None try { @@ -114,7 +116,7 @@ Name | Type | Description | Notes **string** | **String**| None | [optional] **binary** | **byte[]**| None | [optional] **date** | **LocalDate**| None | [optional] - **dateTime** | **DateTime**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] **password** | **String**| None | [optional] **paramCallback** | **String**| None | [optional] @@ -137,6 +139,8 @@ null (empty response body) To test enum parameters +To test enum parameters + ### Example ```java // Import classes: @@ -151,7 +155,7 @@ List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_exampl String enumHeaderString = "-efg"; // String | Header parameter enum test (string) List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) -BigDecimal enumQueryInteger = new BigDecimal(); // BigDecimal | Query parameter enum test (double) +Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) try { apiInstance.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); @@ -171,8 +175,8 @@ Name | Type | Description | Notes **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **BigDecimal**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] ### Return type @@ -184,6 +188,6 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json + - **Content-Type**: */* + - **Accept**: */* diff --git a/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..44b5bcd6bc8 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md @@ -0,0 +1,52 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeClassnameTags123Api; + + +FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); +Client body = new Client(); // Client | client model +try { + Client result = apiInstance.testClassname(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/petstore/java/jersey2-java6/docs/FormatTest.md b/samples/client/petstore/java/jersey2-java6/docs/FormatTest.md index 44de7d9511a..c7a3acb3cb7 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FormatTest.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FormatTest.md @@ -14,8 +14,8 @@ Name | Type | Description | Notes **_byte** | **byte[]** | | **binary** | **byte[]** | | [optional] **date** | [**LocalDate**](LocalDate.md) | | -**dateTime** | [**DateTime**](DateTime.md) | | [optional] -**uuid** | **String** | | [optional] +**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**uuid** | [**UUID**](UUID.md) | | [optional] **password** | **String** | | diff --git a/samples/client/petstore/java/jersey2-java6/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/jersey2-java6/docs/MixedPropertiesAndAdditionalPropertiesClass.md index e3487bcc501..b12e2cd70e6 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/java/jersey2-java6/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -4,8 +4,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**uuid** | **String** | | [optional] -**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**uuid** | [**UUID**](UUID.md) | | [optional] +**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] **map** | [**Map<String, Animal>**](Animal.md) | | [optional] diff --git a/samples/client/petstore/java/jersey2-java6/docs/Order.md b/samples/client/petstore/java/jersey2-java6/docs/Order.md index a1089f5384e..268c617d1ff 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/Order.md +++ b/samples/client/petstore/java/jersey2-java6/docs/Order.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **id** | **Long** | | [optional] **petId** | **Long** | | [optional] **quantity** | **Integer** | | [optional] -**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**shipDate** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] **status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] **complete** | **Boolean** | | [optional] diff --git a/samples/client/petstore/java/jersey2-java6/docs/OuterEnum.md b/samples/client/petstore/java/jersey2-java6/docs/OuterEnum.md new file mode 100644 index 00000000000..ed2cb206789 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/docs/OuterEnum.md @@ -0,0 +1,14 @@ + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/jersey2-java6/effective.pom b/samples/client/petstore/java/jersey2-java6/effective.pom deleted file mode 100644 index 70b95f7d5b5..00000000000 --- a/samples/client/petstore/java/jersey2-java6/effective.pom +++ /dev/null @@ -1,431 +0,0 @@ - - - - - - - - - - - - - - - - 4.0.0 - io.swagger - swagger-petstore-jersey2-java6 - 1.0.0 - swagger-petstore-jersey2-java6 - - 2.2.0 - - - scm:git:git@github.com:swagger-api/swagger-mustache.git - scm:git:git@github.com:swagger-api/swagger-codegen.git - https://github.com/swagger-api/swagger-codegen - - - 2.5 - 3.5 - 2.7.5 - 2.22.2 - 2.9.4 - 4.12 - 1.0.0 - 1.5.9 - - - - io.swagger - swagger-annotations - 1.5.9 - compile - - - org.glassfish.jersey.core - jersey-client - 2.22.2 - compile - - - org.glassfish.jersey.media - jersey-media-multipart - 2.22.2 - compile - - - org.glassfish.jersey.media - jersey-media-json-jackson - 2.22.2 - compile - - - com.fasterxml.jackson.core - jackson-core - 2.7.5 - compile - - - com.fasterxml.jackson.core - jackson-annotations - 2.7.5 - compile - - - com.fasterxml.jackson.core - jackson-databind - 2.7.5 - compile - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - 2.7.5 - compile - - - joda-time - joda-time - 2.9.4 - compile - - - com.brsanthu - migbase64 - 2.2 - compile - - - org.apache.commons - commons-lang3 - 3.5 - compile - - - commons-io - commons-io - 2.5 - compile - - - junit - junit - 4.12 - test - - - - - - false - - central - Central Repository - https://repo.maven.apache.org/maven2 - - - - - - never - - - false - - central - Central Repository - https://repo.maven.apache.org/maven2 - - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/src/main/java - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/src/main/scripts - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/src/test/java - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/classes - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/test-classes - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/src/main/resources - - - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/src/test/resources - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target - swagger-petstore-jersey2-java6-1.0.0 - - - - maven-antrun-plugin - 1.3 - - - maven-assembly-plugin - 2.2-beta-5 - - - maven-dependency-plugin - 2.8 - - - maven-release-plugin - 2.3.2 - - - - - - maven-surefire-plugin - 2.12 - - - default-test - test - - test - - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - - - - loggerPath - conf/log4j.properties - - - -Xms512m -Xmx1500m - methods - pertest - - - - maven-dependency-plugin - 2.8 - - - package - - copy-dependencies - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/lib - - - - - - maven-jar-plugin - 2.6 - - - default-jar - package - - jar - - - - - - jar - test-jar - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.12 - - - add_sources - generate-sources - - add-source - - - - src/main/java - - - - - add_test_sources - generate-test-sources - - add-test-source - - - - src/test/java - - - - - - - maven-compiler-plugin - 2.5.1 - - - default-compile - compile - - compile - - - 1.7 - 1.7 - - - - default-testCompile - test-compile - - testCompile - - - 1.7 - 1.7 - - - - - 1.7 - 1.7 - - - - maven-javadoc-plugin - 2.10.4 - - - maven-clean-plugin - 2.5 - - - default-clean - clean - - clean - - - - - - maven-resources-plugin - 2.6 - - - default-testResources - process-test-resources - - testResources - - - - default-resources - process-resources - - resources - - - - - - maven-install-plugin - 2.4 - - - default-install - install - - install - - - - - - maven-deploy-plugin - 2.7 - - - default-deploy - deploy - - deploy - - - - - - maven-site-plugin - 3.3 - - - default-site - site - - site - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/site - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - - - - default-deploy - site-deploy - - deploy - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/site - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - - - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/site - - - org.apache.maven.plugins - maven-project-info-reports-plugin - - - - - - - - /Users/williamcheng/Code/jan2017/swagger-codegen/samples/client/petstore/java/jersey2-java6/target/site - - \ No newline at end of file diff --git a/samples/client/petstore/java/jersey2-java6/pom.xml b/samples/client/petstore/java/jersey2-java6/pom.xml index f9cf3667bb2..f8e7a142779 100644 --- a/samples/client/petstore/java/jersey2-java6/pom.xml +++ b/samples/client/petstore/java/jersey2-java6/pom.xml @@ -2,12 +2,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 io.swagger - swagger-petstore-jersey2-java6 + swagger-petstore-jersey2 jar - swagger-petstore-jersey2-java6 + swagger-petstore-jersey2 1.0.0 + https://github.com/swagger-api/swagger-codegen + Swagger Java - scm:git:git@github.com:swagger-api/swagger-mustache.git + scm:git:git@github.com:swagger-api/swagger-codegen.git scm:git:git@github.com:swagger-api/swagger-codegen.git https://github.com/swagger-api/swagger-codegen @@ -15,6 +17,23 @@ 2.2.0 + + + Unlicense + http://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + Swagger + apiteam@swagger.io + Swagger + http://swagger.io + + + @@ -108,9 +127,55 @@ org.apache.maven.plugins maven-javadoc-plugin 2.10.4 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + io.swagger @@ -152,15 +217,10 @@ ${jackson-version} - com.fasterxml.jackson.datatype - jackson-datatype-joda + com.github.joschi.jackson + jackson-datatype-threetenbp ${jackson-version} - - joda-time - joda-time - ${jodatime-version} - @@ -191,10 +251,9 @@ 1.5.9 2.22.2 - 2.7.5 - 2.9.4 2.5 3.5 + 2.6.4 1.0.0 4.12 diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java index d37be0a0de2..999d343919d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiClient.java @@ -86,6 +86,7 @@ public class ApiClient { /** * Gets the JSON instance to do JSON serialization and deserialization. + * @return JSON */ public JSON getJSON() { return json; @@ -111,6 +112,7 @@ public class ApiClient { /** * Gets the status code of the previous request + * @return Status code */ public int getStatusCode() { return statusCode; @@ -118,6 +120,7 @@ public class ApiClient { /** * Gets the response headers of the previous request + * @return Response headers */ public Map> getResponseHeaders() { return responseHeaders; @@ -125,6 +128,7 @@ public class ApiClient { /** * Get authentications (key: authentication name, value: authentication). + * @return Map of authentication object */ public Map getAuthentications() { return authentications; @@ -142,6 +146,7 @@ public class ApiClient { /** * Helper method to set username for the first HTTP basic authentication. + * @param username Username */ public void setUsername(String username) { for (Authentication auth : authentications.values()) { @@ -155,6 +160,7 @@ public class ApiClient { /** * Helper method to set password for the first HTTP basic authentication. + * @param password Password */ public void setPassword(String password) { for (Authentication auth : authentications.values()) { @@ -168,6 +174,7 @@ public class ApiClient { /** * Helper method to set API key value for the first API key authentication. + * @param apiKey API key */ public void setApiKey(String apiKey) { for (Authentication auth : authentications.values()) { @@ -181,6 +188,7 @@ public class ApiClient { /** * Helper method to set API key prefix for the first API key authentication. + * @param apiKeyPrefix API key prefix */ public void setApiKeyPrefix(String apiKeyPrefix) { for (Authentication auth : authentications.values()) { @@ -194,6 +202,7 @@ public class ApiClient { /** * Helper method to set access token for the first OAuth2 authentication. + * @param accessToken Access token */ public void setAccessToken(String accessToken) { for (Authentication auth : authentications.values()) { @@ -207,6 +216,8 @@ public class ApiClient { /** * Set the User-Agent header's value (by adding to the default header map). + * @param userAgent Http user agent + * @return API client */ public ApiClient setUserAgent(String userAgent) { addDefaultHeader("User-Agent", userAgent); @@ -218,6 +229,7 @@ public class ApiClient { * * @param key The header's key * @param value The header's value + * @return API client */ public ApiClient addDefaultHeader(String key, String value) { defaultHeaderMap.put(key, value); @@ -226,6 +238,7 @@ public class ApiClient { /** * Check that whether debugging is enabled for this API client. + * @return True if debugging is switched on */ public boolean isDebugging() { return debugging; @@ -235,6 +248,7 @@ public class ApiClient { * Enable/disable debugging for this API client. * * @param debugging To enable (true) or disable (false) debugging + * @return API client */ public ApiClient setDebugging(boolean debugging) { this.debugging = debugging; @@ -248,12 +262,17 @@ public class ApiClient { * with file response. The default value is null, i.e. using * the system's default tempopary folder. * - * @see https://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile(java.lang.String,%20java.lang.String,%20java.io.File) + * @return Temp folder path */ public String getTempFolderPath() { return tempFolderPath; } + /** + * Set temp folder path + * @param tempFolderPath Temp folder path + * @return API client + */ public ApiClient setTempFolderPath(String tempFolderPath) { this.tempFolderPath = tempFolderPath; return this; @@ -261,6 +280,7 @@ public class ApiClient { /** * Connect timeout (in milliseconds). + * @return Connection timeout */ public int getConnectTimeout() { return connectionTimeout; @@ -270,6 +290,8 @@ public class ApiClient { * Set the connect timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and * {@link Integer#MAX_VALUE}. + * @param connectionTimeout Connection timeout in milliseconds + * @return API client */ public ApiClient setConnectTimeout(int connectionTimeout) { this.connectionTimeout = connectionTimeout; @@ -279,6 +301,7 @@ public class ApiClient { /** * Get the date format used to parse/format date parameters. + * @return Date format */ public DateFormat getDateFormat() { return dateFormat; @@ -286,6 +309,8 @@ public class ApiClient { /** * Set the date format used to parse/format date parameters. + * @param dateFormat Date format + * @return API client */ public ApiClient setDateFormat(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -296,6 +321,8 @@ public class ApiClient { /** * Parse the given string into Date object. + * @param str String + * @return Date */ public Date parseDate(String str) { try { @@ -307,6 +334,8 @@ public class ApiClient { /** * Format the given Date object into string. + * @param date Date + * @return Date in string format */ public String formatDate(Date date) { return dateFormat.format(date); @@ -314,6 +343,8 @@ public class ApiClient { /** * Format the given parameter object into string. + * @param param Object + * @return Object in string format */ public String parameterToString(Object param) { if (param == null) { @@ -324,7 +355,7 @@ public class ApiClient { StringBuilder b = new StringBuilder(); for(Object o : (Collection)param) { if(b.length() > 0) { - b.append(","); + b.append(','); } b.append(String.valueOf(o)); } @@ -335,15 +366,19 @@ public class ApiClient { } /* - Format to {@code Pair} objects. - */ + * Format to {@code Pair} objects. + * @param collectionFormat Collection format + * @param name Name + * @param value Value + * @return List of pairs + */ public List parameterToPairs(String collectionFormat, String name, Object value){ List params = new ArrayList(); // preconditions if (name == null || name.isEmpty() || value == null) return params; - Collection valueCollection = null; + Collection valueCollection; if (value instanceof Collection) { valueCollection = (Collection) value; } else { @@ -355,11 +390,11 @@ public class ApiClient { return params; } - // get the collection format - collectionFormat = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // default: csv + // get the collection format (default: csv) + String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat); // create the params based on the collection format - if (collectionFormat.equals("multi")) { + if ("multi".equals(format)) { for (Object item : valueCollection) { params.add(new Pair(name, parameterToString(item))); } @@ -369,13 +404,13 @@ public class ApiClient { String delimiter = ","; - if (collectionFormat.equals("csv")) { + if ("csv".equals(format)) { delimiter = ","; - } else if (collectionFormat.equals("ssv")) { + } else if ("ssv".equals(format)) { delimiter = " "; - } else if (collectionFormat.equals("tsv")) { + } else if ("tsv".equals(format)) { delimiter = "\t"; - } else if (collectionFormat.equals("pipes")) { + } else if ("pipes".equals(format)) { delimiter = "|"; } @@ -396,6 +431,8 @@ public class ApiClient { * application/json * application/json; charset=UTF8 * APPLICATION/JSON + * @param mime MIME + * @return True if the MIME type is JSON */ public boolean isJsonMime(String mime) { return mime != null && mime.matches("(?i)application\\/json(;.*)?"); @@ -445,6 +482,8 @@ public class ApiClient { /** * Escape the given string to be used as URL query value. + * @param str String + * @return Escaped string */ public String escapeString(String str) { try { @@ -457,9 +496,14 @@ public class ApiClient { /** * Serialize the given Java object into string entity according the given * Content-Type (only JSON is supported for now). + * @param obj Object + * @param formParams Form parameters + * @param contentType Context type + * @return Entity + * @throws ApiException API exception */ public Entity serialize(Object obj, Map formParams, String contentType) throws ApiException { - Entity entity = null; + Entity entity; if (contentType.startsWith("multipart/form-data")) { MultiPart multiPart = new MultiPart(); for (Entry param: formParams.entrySet()) { @@ -489,7 +533,13 @@ public class ApiClient { /** * Deserialize response body to Java object according to the Content-Type. + * @param Type + * @param response Response + * @param returnType Return type + * @return Deserialize object + * @throws ApiException API exception */ + @SuppressWarnings("unchecked") public T deserialize(Response response, GenericType returnType) throws ApiException { if (response == null || returnType == null) { return null; @@ -498,9 +548,8 @@ public class ApiClient { if ("byte[]".equals(returnType.toString())) { // Handle binary response (byte array). return (T) response.readEntity(byte[].class); - } else if (returnType.equals(File.class)) { + } else if (returnType.getRawType() == File.class) { // Handle file downloading. - @SuppressWarnings("unchecked") T file = (T) downloadFileFromResponse(response); return file; } @@ -517,6 +566,8 @@ public class ApiClient { /** * Download file from the given response. + * @param response Response + * @return File * @throws ApiException If fail to read file content from response and write to disk */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -541,13 +592,13 @@ public class ApiClient { filename = matcher.group(1); } - String prefix = null; + String prefix; String suffix = null; if (filename == null) { prefix = "download-"; suffix = ""; } else { - int pos = filename.lastIndexOf("."); + int pos = filename.lastIndexOf('.'); if (pos == -1) { prefix = filename + "-"; } else { @@ -568,6 +619,7 @@ public class ApiClient { /** * Invoke API by sending HTTP request with the given options. * + * @param Type * @param path The sub-path of the HTTP URL * @param method The request method, one of "GET", "POST", "PUT", and "DELETE" * @param queryParams The query parameters @@ -579,6 +631,7 @@ public class ApiClient { * @param authNames The authentications to apply * @param returnType The return type into which to deserialize the response * @return The response body in type of string + * @throws ApiException API exception */ public T invokeAPI(String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String accept, String contentType, String[] authNames, GenericType returnType) throws ApiException { updateParamsForAuth(authNames, queryParams, headerParams); @@ -597,16 +650,17 @@ public class ApiClient { Invocation.Builder invocationBuilder = target.request().accept(accept); - for (String key : headerParams.keySet()) { - String value = headerParams.get(key); + for (Entry entry : headerParams.entrySet()) { + String value = entry.getValue(); if (value != null) { - invocationBuilder = invocationBuilder.header(key, value); + invocationBuilder = invocationBuilder.header(entry.getKey(), value); } } - for (String key : defaultHeaderMap.keySet()) { + for (Entry entry : defaultHeaderMap.entrySet()) { + String key = entry.getKey(); if (!headerParams.containsKey(key)) { - String value = defaultHeaderMap.get(key); + String value = entry.getValue(); if (value != null) { invocationBuilder = invocationBuilder.header(key, value); } @@ -615,7 +669,7 @@ public class ApiClient { Entity entity = serialize(body, formParams, contentType); - Response response = null; + Response response; if ("GET".equals(method)) { response = invocationBuilder.get(); @@ -625,6 +679,8 @@ public class ApiClient { response = invocationBuilder.put(entity); } else if ("DELETE".equals(method)) { response = invocationBuilder.delete(); + } else if ("PATCH".equals(method)) { + response = invocationBuilder.header("X-HTTP-Method-Override", "PATCH").post(entity); } else { throw new ApiException(500, "unknown method type " + method); } @@ -634,7 +690,7 @@ public class ApiClient { if (response.getStatus() == Status.NO_CONTENT.getStatusCode()) { return null; - } else if (response.getStatusInfo().getFamily().equals(Status.Family.SUCCESSFUL)) { + } else if (response.getStatusInfo().getFamily() == Status.Family.SUCCESSFUL) { if (returnType == null) return null; else @@ -660,6 +716,8 @@ public class ApiClient { /** * Build the Client used to make HTTP requests. + * @param debugging Debug setting + * @return Client */ private Client buildHttpClient(boolean debugging) { final ClientConfig clientConfig = new ClientConfig(); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiException.java index 02a967d8373..d0b5cfc1e57 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiException.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/ApiException.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Configuration.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Configuration.java index 57e53b2d598..cbf868efb85 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Configuration.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Configuration.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/CustomInstantDeserializer.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/CustomInstantDeserializer.java new file mode 100644 index 00000000000..5ed8ba446ec --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/CustomInstantDeserializer.java @@ -0,0 +1,232 @@ +package io.swagger.client; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonTokenId; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils; +import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; +import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; +import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; +import com.fasterxml.jackson.datatype.threetenbp.function.Function; +import org.threeten.bp.DateTimeException; +import org.threeten.bp.Instant; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZoneId; +import org.threeten.bp.ZonedDateTime; +import org.threeten.bp.format.DateTimeFormatter; +import org.threeten.bp.temporal.Temporal; +import org.threeten.bp.temporal.TemporalAccessor; + +import java.io.IOException; +import java.math.BigDecimal; + +/** + * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. + * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. + * + * @author Nick Williams + */ +public class CustomInstantDeserializer + extends ThreeTenDateTimeDeserializerBase { + private static final long serialVersionUID = 1L; + + public static final CustomInstantDeserializer INSTANT = new CustomInstantDeserializer( + Instant.class, DateTimeFormatter.ISO_INSTANT, + new Function() { + @Override + public Instant apply(TemporalAccessor temporalAccessor) { + return Instant.from(temporalAccessor); + } + }, + new Function() { + @Override + public Instant apply(FromIntegerArguments a) { + return Instant.ofEpochMilli(a.value); + } + }, + new Function() { + @Override + public Instant apply(FromDecimalArguments a) { + return Instant.ofEpochSecond(a.integer, a.fraction); + } + }, + null + ); + + public static final CustomInstantDeserializer OFFSET_DATE_TIME = new CustomInstantDeserializer( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + new Function() { + @Override + public OffsetDateTime apply(TemporalAccessor temporalAccessor) { + return OffsetDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromIntegerArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromDecimalArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { + return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); + } + } + ); + + public static final CustomInstantDeserializer ZONED_DATE_TIME = new CustomInstantDeserializer( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + new Function() { + @Override + public ZonedDateTime apply(TemporalAccessor temporalAccessor) { + return ZonedDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromIntegerArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromDecimalArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { + return zonedDateTime.withZoneSameInstant(zoneId); + } + } + ); + + protected final Function fromMilliseconds; + + protected final Function fromNanoseconds; + + protected final Function parsedToValue; + + protected final BiFunction adjust; + + protected CustomInstantDeserializer(Class supportedType, + DateTimeFormatter parser, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust) { + super(supportedType, parser); + this.parsedToValue = parsedToValue; + this.fromMilliseconds = fromMilliseconds; + this.fromNanoseconds = fromNanoseconds; + this.adjust = adjust == null ? new BiFunction() { + @Override + public T apply(T t, ZoneId zoneId) { + return t; + } + } : adjust; + } + + @SuppressWarnings("unchecked") + protected CustomInstantDeserializer(CustomInstantDeserializer base, DateTimeFormatter f) { + super((Class) base.handledType(), f); + parsedToValue = base.parsedToValue; + fromMilliseconds = base.fromMilliseconds; + fromNanoseconds = base.fromNanoseconds; + adjust = base.adjust; + } + + @Override + protected JsonDeserializer withDateFormat(DateTimeFormatter dtf) { + if (dtf == _formatter) { + return this; + } + return new CustomInstantDeserializer(this, dtf); + } + + @Override + public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { + //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only + //string values have to be adjusted to the configured TZ. + switch (parser.getCurrentTokenId()) { + case JsonTokenId.ID_NUMBER_FLOAT: { + BigDecimal value = parser.getDecimalValue(); + long seconds = value.longValue(); + int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); + return fromNanoseconds.apply(new FromDecimalArguments( + seconds, nanoseconds, getZone(context))); + } + + case JsonTokenId.ID_NUMBER_INT: { + long timestamp = parser.getLongValue(); + if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + return this.fromNanoseconds.apply(new FromDecimalArguments( + timestamp, 0, this.getZone(context) + )); + } + return this.fromMilliseconds.apply(new FromIntegerArguments( + timestamp, this.getZone(context) + )); + } + + case JsonTokenId.ID_STRING: { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; + } + if (string.endsWith("+0000")) { + string = string.substring(0, string.length() - 5) + "Z"; + } + T value; + try { + TemporalAccessor acc = _formatter.parse(string); + value = parsedToValue.apply(acc); + if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { + return adjust.apply(value, this.getZone(context)); + } + } catch (DateTimeException e) { + throw _peelDTE(e); + } + return value; + } + } + throw context.mappingException("Expected type float, integer, or string."); + } + + private ZoneId getZone(DeserializationContext context) { + // Instants are always in UTC, so don't waste compute cycles + return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone()); + } + + private static class FromIntegerArguments { + public final long value; + public final ZoneId zoneId; + + private FromIntegerArguments(long value, ZoneId zoneId) { + this.value = value; + this.zoneId = zoneId; + } + } + + private static class FromDecimalArguments { + public final long integer; + public final int fraction; + public final ZoneId zoneId; + + private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) { + this.integer = integer; + this.fraction = fraction; + this.zoneId = zoneId; + } + } +} diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/JSON.java index 126fa1c856a..4ade3277cc0 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/JSON.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/JSON.java @@ -1,8 +1,9 @@ package io.swagger.client; +import org.threeten.bp.*; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.datatype.joda.*; +import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; import java.text.DateFormat; @@ -20,11 +21,16 @@ public class JSON implements ContextResolver { mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); mapper.setDateFormat(new RFC3339DateFormat()); - mapper.registerModule(new JodaModule()); + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + mapper.registerModule(module); } /** * Set the date format for JSON (de)serialization with Date properties. + * @param dateFormat Date format */ public void setDateFormat(DateFormat dateFormat) { mapper.setDateFormat(dateFormat); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Pair.java index 9ad2d246519..b75cd316ac1 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Pair.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/Pair.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/RFC3339DateFormat.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/RFC3339DateFormat.java index d662f9457d7..e8df24310aa 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/RFC3339DateFormat.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/RFC3339DateFormat.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ package io.swagger.client; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/StringUtil.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/StringUtil.java index 31140c76df4..339a3fb36d5 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/StringUtil.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java index 299cc5765af..60192509f52 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java @@ -7,10 +7,10 @@ import io.swagger.client.Pair; import javax.ws.rs.core.GenericType; -import io.swagger.client.model.Client; -import org.joda.time.LocalDate; -import org.joda.time.DateTime; import java.math.BigDecimal; +import io.swagger.client.model.Client; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; @@ -39,7 +39,7 @@ public class FakeApi { /** * To test \"client\" model - * + * To test \"client\" model * @param body client model (required) * @return Client * @throws ApiException if fails to make API call @@ -97,7 +97,7 @@ public class FakeApi { * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ - public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, DateTime dateTime, String password, String paramCallback) throws ApiException { + public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { Object localVarPostBody = null; // verify the required parameter 'number' is set @@ -176,7 +176,7 @@ if (paramCallback != null) } /** * To test enum parameters - * + * To test enum parameters * @param enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @param enumHeaderStringArray Header parameter enum test (string array) (optional) @@ -187,7 +187,7 @@ if (paramCallback != null) * @param enumQueryDouble Query parameter enum test (double) (optional) * @throws ApiException if fails to make API call */ - public void testEnumParameters(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble) throws ApiException { + public void testEnumParameters(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble) throws ApiException { Object localVarPostBody = null; // create path and map variables @@ -215,12 +215,12 @@ if (enumQueryDouble != null) localVarFormParams.put("enum_query_double", enumQueryDouble); final String[] localVarAccepts = { - "application/json" + "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { - "application/json" + "*/*" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..f51298081fe --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,78 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.ApiClient; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; + +import javax.ws.rs.core.GenericType; + +import io.swagger.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class FakeClassnameTags123Api { + private ApiClient apiClient; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test class name in snake case + * + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + */ + public Client testClassname(Client body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname"); + } + + // create path and map variables + String localVarPath = "/fake_classname_test".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/PetApi.java index ab85c4ac394..e816fce5bad 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/PetApi.java @@ -7,9 +7,9 @@ import io.swagger.client.Pair; import javax.ws.rs.core.GenericType; -import io.swagger.client.model.Pet; import java.io.File; import io.swagger.client.model.ModelApiResponse; +import io.swagger.client.model.Pet; import java.util.ArrayList; import java.util.HashMap; @@ -124,7 +124,7 @@ public class PetApi { * Finds Pets by status * Multiple status values can be provided with comma separated strings * @param status Status values that need to be considered for filter (required) - * @return List + * @return List<Pet> * @throws ApiException if fails to make API call */ public List findPetsByStatus(List status) throws ApiException { @@ -166,7 +166,7 @@ public class PetApi { * Finds Pets by tags * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @param tags Tags to filter by (required) - * @return List + * @return List<Pet> * @throws ApiException if fails to make API call */ public List findPetsByTags(List tags) throws ApiException { diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/StoreApi.java index c0c9a166ad7..41bd6751871 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/StoreApi.java @@ -78,7 +78,7 @@ public class StoreApi { /** * Returns pet inventories by status * Returns a map of status codes to quantities - * @return Map + * @return Map<String, Integer> * @throws ApiException if fails to make API call */ public Map getInventory() throws ApiException { diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/ApiKeyAuth.java index 0e0fdb63fb3..5c6925473e5 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/ApiKeyAuth.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/ApiKeyAuth.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/Authentication.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/Authentication.java index 0ff06e3b86f..e40d7ff7002 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/Authentication.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/Authentication.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/HttpBasicAuth.java index 420178c112d..788b63a9918 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/HttpBasicAuth.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/HttpBasicAuth.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuth.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuth.java index c1b64913ab8..2d9dc9da8b5 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuth.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuth.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuthFlow.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuthFlow.java index 18c25738e0f..b3718a0643c 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuthFlow.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/auth/OAuthFlow.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java index 9c7eefd8142..d25a531da70 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AdditionalPropertiesClass.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Animal.java index 37322036a3b..6bde500e6a9 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Animal.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -28,12 +16,19 @@ package io.swagger.client.model; import org.apache.commons.lang3.ObjectUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; /** * Animal */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true ) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), +}) public class Animal { @JsonProperty("className") diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AnimalFarm.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AnimalFarm.java index e8d42abef86..ac4c22a76d7 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AnimalFarm.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/AnimalFarm.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java index 865301853a5..6442d6cb9e3 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfArrayOfNumberOnly.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java index 13b18d821a8..8b804b0b802 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayOfNumberOnly.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayTest.java index 8d76222e80e..0a1faf8633d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ArrayTest.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Capitalization.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Capitalization.java new file mode 100644 index 00000000000..4a982a45f71 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Capitalization.java @@ -0,0 +1,204 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.model; + +import org.apache.commons.lang3.ObjectUtils; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Capitalization + */ + +public class Capitalization { + @JsonProperty("smallCamel") + private String smallCamel = null; + + @JsonProperty("CapitalCamel") + private String capitalCamel = null; + + @JsonProperty("small_Snake") + private String smallSnake = null; + + @JsonProperty("Capital_Snake") + private String capitalSnake = null; + + @JsonProperty("SCA_ETH_Flow_Points") + private String scAETHFlowPoints = null; + + @JsonProperty("ATT_NAME") + private String ATT_NAME = null; + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @ApiModelProperty(example = "null", value = "") + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @ApiModelProperty(example = "null", value = "") + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @ApiModelProperty(example = "null", value = "") + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @ApiModelProperty(example = "null", value = "") + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @ApiModelProperty(example = "null", value = "") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @ApiModelProperty(example = "null", value = "Name of the pet ") + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return ObjectUtils.equals(this.smallCamel, capitalization.smallCamel) && + ObjectUtils.equals(this.capitalCamel, capitalization.capitalCamel) && + ObjectUtils.equals(this.smallSnake, capitalization.smallSnake) && + ObjectUtils.equals(this.capitalSnake, capitalization.capitalSnake) && + ObjectUtils.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + ObjectUtils.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return ObjectUtils.hashCodeMulti(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Cat.java index 67da93eaf5a..03d398d9506 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Cat.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Category.java index 65e7653b4e2..49e34cf1a6e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Category.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ClassModel.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ClassModel.java new file mode 100644 index 00000000000..f682855449e --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ClassModel.java @@ -0,0 +1,90 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.model; + +import org.apache.commons.lang3.ObjectUtils; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") + +public class ClassModel { + @JsonProperty("_class") + private String propertyClass = null; + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(example = "null", value = "") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return ObjectUtils.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return ObjectUtils.hashCodeMulti(propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Client.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Client.java index 7236cb848d9..49799a3ca84 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Client.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Client.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Dog.java index 83cf2efd730..e8a8a629ed8 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Dog.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumArrays.java index b91b2f9e8b0..d15264a0372 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumArrays.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumClass.java index 39a75ac97f4..1732c2f241d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumClass.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumTest.java index efa77302887..b09055b9942 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/EnumTest.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -30,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.client.model.OuterEnum; /** * EnumTest @@ -137,6 +126,9 @@ public class EnumTest { @JsonProperty("enum_number") private EnumNumberEnum enumNumber = null; + @JsonProperty("outerEnum") + private OuterEnum outerEnum = null; + public EnumTest enumString(EnumStringEnum enumString) { this.enumString = enumString; return this; @@ -191,6 +183,24 @@ public class EnumTest { this.enumNumber = enumNumber; } + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @ApiModelProperty(example = "null", value = "") + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + @Override public boolean equals(java.lang.Object o) { @@ -203,12 +213,13 @@ public class EnumTest { EnumTest enumTest = (EnumTest) o; return ObjectUtils.equals(this.enumString, enumTest.enumString) && ObjectUtils.equals(this.enumInteger, enumTest.enumInteger) && - ObjectUtils.equals(this.enumNumber, enumTest.enumNumber); + ObjectUtils.equals(this.enumNumber, enumTest.enumNumber) && + ObjectUtils.equals(this.outerEnum, enumTest.outerEnum); } @Override public int hashCode() { - return ObjectUtils.hashCodeMulti(enumString, enumInteger, enumNumber); + return ObjectUtils.hashCodeMulti(enumString, enumInteger, enumNumber, outerEnum); } @@ -220,6 +231,7 @@ public class EnumTest { sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/FormatTest.java index 871c46a1d4d..76910c24bb5 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/FormatTest.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -31,8 +19,9 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; -import org.joda.time.DateTime; -import org.joda.time.LocalDate; +import java.util.UUID; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; /** * FormatTest @@ -70,10 +59,10 @@ public class FormatTest { private LocalDate date = null; @JsonProperty("dateTime") - private DateTime dateTime = null; + private OffsetDateTime dateTime = null; @JsonProperty("uuid") - private String uuid = null; + private UUID uuid = null; @JsonProperty("password") private String password = null; @@ -85,8 +74,8 @@ public class FormatTest { /** * Get integer - * minimum: 10.0 - * maximum: 100.0 + * minimum: 10 + * maximum: 100 * @return integer **/ @ApiModelProperty(example = "null", value = "") @@ -105,8 +94,8 @@ public class FormatTest { /** * Get int32 - * minimum: 20.0 - * maximum: 200.0 + * minimum: 20 + * maximum: 200 * @return int32 **/ @ApiModelProperty(example = "null", value = "") @@ -268,7 +257,7 @@ public class FormatTest { this.date = date; } - public FormatTest dateTime(DateTime dateTime) { + public FormatTest dateTime(OffsetDateTime dateTime) { this.dateTime = dateTime; return this; } @@ -278,15 +267,15 @@ public class FormatTest { * @return dateTime **/ @ApiModelProperty(example = "null", value = "") - public DateTime getDateTime() { + public OffsetDateTime getDateTime() { return dateTime; } - public void setDateTime(DateTime dateTime) { + public void setDateTime(OffsetDateTime dateTime) { this.dateTime = dateTime; } - public FormatTest uuid(String uuid) { + public FormatTest uuid(UUID uuid) { this.uuid = uuid; return this; } @@ -296,11 +285,11 @@ public class FormatTest { * @return uuid **/ @ApiModelProperty(example = "null", value = "") - public String getUuid() { + public UUID getUuid() { return uuid; } - public void setUuid(String uuid) { + public void setUuid(UUID uuid) { this.uuid = uuid; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java index 61a27927a45..2c7bd1eed1e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/HasOnlyReadOnly.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MapTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MapTest.java index 94c5805a235..770b018c3e4 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MapTest.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index bf3fbe4876c..b9da5e384a2 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -34,7 +22,8 @@ import io.swagger.client.model.Animal; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.joda.time.DateTime; +import java.util.UUID; +import org.threeten.bp.OffsetDateTime; /** * MixedPropertiesAndAdditionalPropertiesClass @@ -42,15 +31,15 @@ import org.joda.time.DateTime; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private String uuid = null; + private UUID uuid = null; @JsonProperty("dateTime") - private DateTime dateTime = null; + private OffsetDateTime dateTime = null; @JsonProperty("map") private Map map = new HashMap(); - public MixedPropertiesAndAdditionalPropertiesClass uuid(String uuid) { + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { this.uuid = uuid; return this; } @@ -60,15 +49,15 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return uuid **/ @ApiModelProperty(example = "null", value = "") - public String getUuid() { + public UUID getUuid() { return uuid; } - public void setUuid(String uuid) { + public void setUuid(UUID uuid) { this.uuid = uuid; } - public MixedPropertiesAndAdditionalPropertiesClass dateTime(DateTime dateTime) { + public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { this.dateTime = dateTime; return this; } @@ -78,11 +67,11 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return dateTime **/ @ApiModelProperty(example = "null", value = "") - public DateTime getDateTime() { + public OffsetDateTime getDateTime() { return dateTime; } - public void setDateTime(DateTime dateTime) { + public void setDateTime(OffsetDateTime dateTime) { this.dateTime = dateTime; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Model200Response.java index ee1c0b84b3e..23dba81e4bf 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Model200Response.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelApiResponse.java index f297c62d02a..6eddaf96ac6 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelApiResponse.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelReturn.java index 6b1651ea352..26925e54c65 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ModelReturn.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Name.java index 72338ad60ea..a4ddcaef6b3 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Name.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/NumberOnly.java index 2a96764e4c6..07eb245e799 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/NumberOnly.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Order.java index 1a72afa5da3..732470801fe 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Order.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ @@ -30,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.joda.time.DateTime; +import org.threeten.bp.OffsetDateTime; /** * Order @@ -47,7 +35,7 @@ public class Order { private Integer quantity = null; @JsonProperty("shipDate") - private DateTime shipDate = null; + private OffsetDateTime shipDate = null; /** * Order Status @@ -141,7 +129,7 @@ public class Order { this.quantity = quantity; } - public Order shipDate(DateTime shipDate) { + public Order shipDate(OffsetDateTime shipDate) { this.shipDate = shipDate; return this; } @@ -151,11 +139,11 @@ public class Order { * @return shipDate **/ @ApiModelProperty(example = "null", value = "") - public DateTime getShipDate() { + public OffsetDateTime getShipDate() { return shipDate; } - public void setShipDate(DateTime shipDate) { + public void setShipDate(OffsetDateTime shipDate) { this.shipDate = shipDate; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/OuterEnum.java new file mode 100644 index 00000000000..75577d61434 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/OuterEnum.java @@ -0,0 +1,52 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.model; + +import org.apache.commons.lang3.ObjectUtils; + +import com.fasterxml.jackson.annotation.JsonCreator; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String text) { + for (OuterEnum b : OuterEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Pet.java index 5afa9425acf..98d279c74ea 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Pet.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ReadOnlyFirst.java index 7e50551c137..17704aaa98b 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/ReadOnlyFirst.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/SpecialModelName.java index 3fad665435c..29e3c93931d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Tag.java index 4109837bb89..8ad6341b843 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/Tag.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/User.java index 9333959c881..98ac173d267 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/User.java @@ -8,18 +8,6 @@ * 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. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. */ diff --git a/samples/client/petstore/java/jersey2-java6/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/jersey2-java6/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..af5885aaddd --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,51 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.Client; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Ignore +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + + /** + * To test class name in snake case + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client body = null; + Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md index 651c9d0c43f..0e370b3862f 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md @@ -175,8 +175,8 @@ Name | Type | Description | Notes **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] ### Return type diff --git a/samples/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..44b5bcd6bc8 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md @@ -0,0 +1,52 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeClassnameTags123Api; + + +FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); +Client body = new Client(); // Client | client model +try { + Client result = apiInstance.testClassname(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..f51298081fe --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,78 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.ApiClient; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; + +import javax.ws.rs.core.GenericType; + +import io.swagger.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class FakeClassnameTags123Api { + private ApiClient apiClient; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test class name in snake case + * + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + */ + public Client testClassname(Client body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname"); + } + + // create path and map variables + String localVarPath = "/fake_classname_test".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/samples/client/petstore/java/jersey2-java8/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/jersey2-java8/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..af5885aaddd --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,51 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.Client; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Ignore +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + + /** + * To test class name in snake case + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client body = null; + Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/jersey2/docs/FakeApi.md b/samples/client/petstore/java/jersey2/docs/FakeApi.md index 651c9d0c43f..0e370b3862f 100644 --- a/samples/client/petstore/java/jersey2/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2/docs/FakeApi.md @@ -175,8 +175,8 @@ Name | Type | Description | Notes **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] ### Return type diff --git a/samples/client/petstore/java/jersey2/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey2/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..44b5bcd6bc8 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/FakeClassnameTags123Api.md @@ -0,0 +1,52 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeClassnameTags123Api; + + +FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); +Client body = new Client(); // Client | client model +try { + Client result = apiInstance.testClassname(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..f51298081fe --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,78 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.ApiClient; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; + +import javax.ws.rs.core.GenericType; + +import io.swagger.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class FakeClassnameTags123Api { + private ApiClient apiClient; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * To test class name in snake case + * + * @param body client model (required) + * @return Client + * @throws ApiException if fails to make API call + */ + public Client testClassname(Client body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname"); + } + + // create path and map variables + String localVarPath = "/fake_classname_test".replaceAll("\\{format\\}","json"); + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } +} diff --git a/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..af5885aaddd --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,51 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.Client; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Ignore +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + + /** + * To test class name in snake case + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client body = null; + Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Capitalization.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Capitalization.md new file mode 100644 index 00000000000..0f3064c1996 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/Capitalization.md @@ -0,0 +1,15 @@ + +# Capitalization + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**scAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ClassModel.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ClassModel.md new file mode 100644 index 00000000000..64f880c8786 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/ClassModel.md @@ -0,0 +1,10 @@ + +# ClassModel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertyClass** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md index 651c9d0c43f..0e370b3862f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md @@ -175,8 +175,8 @@ Name | Type | Description | Notes **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] ### Return type diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..44b5bcd6bc8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeClassnameTags123Api.md @@ -0,0 +1,52 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeClassnameTags123Api; + + +FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); +Client body = new Client(); // Client | client model +try { + Client result = apiInstance.testClassname(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/OuterEnum.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/OuterEnum.md new file mode 100644 index 00000000000..ed2cb206789 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/OuterEnum.md @@ -0,0 +1,14 @@ + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiClient.java index c960ab9195d..8410522b276 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/ApiClient.java @@ -72,6 +72,8 @@ public class ApiClient { */ public ApiClient() { httpClient = new OkHttpClient(); + + verifyingSsl = true; json = new JSON(); @@ -820,6 +822,13 @@ public class ApiClient { if (returnType == null || response.code() == 204) { // returning null if the returnType is not defined, // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } return null; } else { return deserialize(response, returnType); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..d19a14e08b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,175 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.swagger.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeClassnameTags123Api { + private ApiClient apiClient; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /* Build call for testClassname */ + private com.squareup.okhttp.Call testClassnameCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake_classname_test".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call testClassnameValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testClassname(Async)"); + } + + + com.squareup.okhttp.Call call = testClassnameCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * To test class name in snake case + * + * @param body client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Client testClassname(Client body) throws ApiException { + ApiResponse resp = testClassnameWithHttpInfo(body); + return resp.getData(); + } + + /** + * To test class name in snake case + * + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiException { + com.squareup.okhttp.Call call = testClassnameValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * To test class name in snake case (asynchronously) + * + * @param body client model (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call testClassnameAsync(Client body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = testClassnameValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } +} diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Capitalization.java new file mode 100644 index 00000000000..3899582de4e --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/Capitalization.java @@ -0,0 +1,246 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import android.os.Parcelable; +import android.os.Parcel; + +/** + * Capitalization + */ + +public class Capitalization implements Parcelable { + @SerializedName("smallCamel") + private String smallCamel = null; + + @SerializedName("CapitalCamel") + private String capitalCamel = null; + + @SerializedName("small_Snake") + private String smallSnake = null; + + @SerializedName("Capital_Snake") + private String capitalSnake = null; + + @SerializedName("SCA_ETH_Flow_Points") + private String scAETHFlowPoints = null; + + @SerializedName("ATT_NAME") + private String ATT_NAME = null; + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @ApiModelProperty(example = "null", value = "") + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @ApiModelProperty(example = "null", value = "") + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @ApiModelProperty(example = "null", value = "") + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @ApiModelProperty(example = "null", value = "") + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @ApiModelProperty(example = "null", value = "") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @ApiModelProperty(example = "null", value = "Name of the pet ") + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public void writeToParcel(Parcel out, int flags) { + + out.writeValue(smallCamel); + + out.writeValue(capitalCamel); + + out.writeValue(smallSnake); + + out.writeValue(capitalSnake); + + out.writeValue(scAETHFlowPoints); + + out.writeValue(ATT_NAME); + } + + public Capitalization() { + super(); + } + + Capitalization(Parcel in) { + + smallCamel = (String)in.readValue(null); + capitalCamel = (String)in.readValue(null); + smallSnake = (String)in.readValue(null); + capitalSnake = (String)in.readValue(null); + scAETHFlowPoints = (String)in.readValue(null); + ATT_NAME = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public Capitalization createFromParcel(Parcel in) { + return new Capitalization(in); + } + public Capitalization[] newArray(int size) { + return new Capitalization[size]; + } + }; +} + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ClassModel.java new file mode 100644 index 00000000000..1b7d5f90c2d --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/ClassModel.java @@ -0,0 +1,117 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import android.os.Parcelable; +import android.os.Parcel; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") + +public class ClassModel implements Parcelable { + @SerializedName("_class") + private String propertyClass = null; + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(example = "null", value = "") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public void writeToParcel(Parcel out, int flags) { + + out.writeValue(propertyClass); + } + + public ClassModel() { + super(); + } + + ClassModel(Parcel in) { + + propertyClass = (String)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public ClassModel createFromParcel(Parcel in) { + return new ClassModel(in); + } + public ClassModel[] newArray(int size) { + return new ClassModel[size]; + } + }; +} + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/OuterEnum.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/OuterEnum.java new file mode 100644 index 00000000000..b4ec56eec80 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/OuterEnum.java @@ -0,0 +1,47 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; +import android.os.Parcelable; +import android.os.Parcel; + + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + @SerializedName("placed") + PLACED("placed"), + + @SerializedName("approved") + APPROVED("approved"), + + @SerializedName("delivered") + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } +} + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..af5885aaddd --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,51 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.Client; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Ignore +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + + /** + * To test class name in snake case + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client body = null; + Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md index 651c9d0c43f..0e370b3862f 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md @@ -175,8 +175,8 @@ Name | Type | Description | Notes **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] ### Return type diff --git a/samples/client/petstore/java/okhttp-gson/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/okhttp-gson/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..44b5bcd6bc8 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/FakeClassnameTags123Api.md @@ -0,0 +1,52 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeClassnameTags123Api; + + +FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); +Client body = new Client(); // Client | client model +try { + Client result = apiInstance.testClassname(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..d19a14e08b6 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,175 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.api; + +import io.swagger.client.ApiCallback; +import io.swagger.client.ApiClient; +import io.swagger.client.ApiException; +import io.swagger.client.ApiResponse; +import io.swagger.client.Configuration; +import io.swagger.client.Pair; +import io.swagger.client.ProgressRequestBody; +import io.swagger.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.swagger.client.model.Client; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class FakeClassnameTags123Api { + private ApiClient apiClient; + + public FakeClassnameTags123Api() { + this(Configuration.getDefaultApiClient()); + } + + public FakeClassnameTags123Api(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { + return apiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /* Build call for testClassname */ + private com.squareup.okhttp.Call testClassnameCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake_classname_test".replaceAll("\\{format\\}","json"); + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call testClassnameValidateBeforeCall(Client body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling testClassname(Async)"); + } + + + com.squareup.okhttp.Call call = testClassnameCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * To test class name in snake case + * + * @param body client model (required) + * @return Client + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Client testClassname(Client body) throws ApiException { + ApiResponse resp = testClassnameWithHttpInfo(body); + return resp.getData(); + } + + /** + * To test class name in snake case + * + * @param body client model (required) + * @return ApiResponse<Client> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiException { + com.squareup.okhttp.Call call = testClassnameValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * To test class name in snake case (asynchronously) + * + * @param body client model (required) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call testClassnameAsync(Client body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = testClassnameValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } +} diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..af5885aaddd --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,51 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client.api; + +import io.swagger.client.ApiException; +import io.swagger.client.model.Client; +import org.junit.Test; +import org.junit.Ignore; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +@Ignore +public class FakeClassnameTags123ApiTest { + + private final FakeClassnameTags123Api api = new FakeClassnameTags123Api(); + + + /** + * To test class name in snake case + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClassnameTest() throws ApiException { + Client body = null; + Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..0b7cd1bc1e1 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,41 @@ +package io.swagger.client.api; + +import io.swagger.client.CollectionFormats.*; + +import retrofit.Callback; +import retrofit.http.*; +import retrofit.mime.*; + +import io.swagger.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public interface FakeClassnameTags123Api { + /** + * To test class name in snake case + * Sync method + * + * @param body client model (required) + * @return Client + */ + + @PATCH("/fake_classname_test") + Client testClassname( + @retrofit.http.Body Client body + ); + + /** + * To test class name in snake case + * Async method + * @param body client model (required) + * @param cb callback method + */ + + @PATCH("/fake_classname_test") + void testClassname( + @retrofit.http.Body Client body, Callback cb + ); +} diff --git a/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..2fd2c16ed50 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,39 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiClient; +import io.swagger.client.model.Client; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + private FakeClassnameTags123Api api; + + @Before + public void setup() { + api = new ApiClient().createService(FakeClassnameTags123Api.class); + } + + + /** + * To test class name in snake case + * + * + */ + @Test + public void testClassnameTest() { + Client body = null; + // Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md b/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md index e62301d3af7..063c71645ba 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md @@ -177,8 +177,8 @@ Name | Type | Description | Notes **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] ### Return type diff --git a/samples/client/petstore/java/retrofit2-play24/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/retrofit2-play24/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..1af4ad538aa --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/docs/FakeClassnameTags123Api.md @@ -0,0 +1,52 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** fake_classname_test | To test class name in snake case + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeClassnameTags123Api; + + +FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); +Client body = new Client(); // Client | client model +try { + Client result = apiInstance.testClassname(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/CustomInstantDeserializer.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/CustomInstantDeserializer.java new file mode 100644 index 00000000000..5ed8ba446ec --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/CustomInstantDeserializer.java @@ -0,0 +1,232 @@ +package io.swagger.client; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonTokenId; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils; +import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; +import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; +import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; +import com.fasterxml.jackson.datatype.threetenbp.function.Function; +import org.threeten.bp.DateTimeException; +import org.threeten.bp.Instant; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZoneId; +import org.threeten.bp.ZonedDateTime; +import org.threeten.bp.format.DateTimeFormatter; +import org.threeten.bp.temporal.Temporal; +import org.threeten.bp.temporal.TemporalAccessor; + +import java.io.IOException; +import java.math.BigDecimal; + +/** + * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. + * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. + * + * @author Nick Williams + */ +public class CustomInstantDeserializer + extends ThreeTenDateTimeDeserializerBase { + private static final long serialVersionUID = 1L; + + public static final CustomInstantDeserializer INSTANT = new CustomInstantDeserializer( + Instant.class, DateTimeFormatter.ISO_INSTANT, + new Function() { + @Override + public Instant apply(TemporalAccessor temporalAccessor) { + return Instant.from(temporalAccessor); + } + }, + new Function() { + @Override + public Instant apply(FromIntegerArguments a) { + return Instant.ofEpochMilli(a.value); + } + }, + new Function() { + @Override + public Instant apply(FromDecimalArguments a) { + return Instant.ofEpochSecond(a.integer, a.fraction); + } + }, + null + ); + + public static final CustomInstantDeserializer OFFSET_DATE_TIME = new CustomInstantDeserializer( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + new Function() { + @Override + public OffsetDateTime apply(TemporalAccessor temporalAccessor) { + return OffsetDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromIntegerArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromDecimalArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { + return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); + } + } + ); + + public static final CustomInstantDeserializer ZONED_DATE_TIME = new CustomInstantDeserializer( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + new Function() { + @Override + public ZonedDateTime apply(TemporalAccessor temporalAccessor) { + return ZonedDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromIntegerArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromDecimalArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { + return zonedDateTime.withZoneSameInstant(zoneId); + } + } + ); + + protected final Function fromMilliseconds; + + protected final Function fromNanoseconds; + + protected final Function parsedToValue; + + protected final BiFunction adjust; + + protected CustomInstantDeserializer(Class supportedType, + DateTimeFormatter parser, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust) { + super(supportedType, parser); + this.parsedToValue = parsedToValue; + this.fromMilliseconds = fromMilliseconds; + this.fromNanoseconds = fromNanoseconds; + this.adjust = adjust == null ? new BiFunction() { + @Override + public T apply(T t, ZoneId zoneId) { + return t; + } + } : adjust; + } + + @SuppressWarnings("unchecked") + protected CustomInstantDeserializer(CustomInstantDeserializer base, DateTimeFormatter f) { + super((Class) base.handledType(), f); + parsedToValue = base.parsedToValue; + fromMilliseconds = base.fromMilliseconds; + fromNanoseconds = base.fromNanoseconds; + adjust = base.adjust; + } + + @Override + protected JsonDeserializer withDateFormat(DateTimeFormatter dtf) { + if (dtf == _formatter) { + return this; + } + return new CustomInstantDeserializer(this, dtf); + } + + @Override + public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { + //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only + //string values have to be adjusted to the configured TZ. + switch (parser.getCurrentTokenId()) { + case JsonTokenId.ID_NUMBER_FLOAT: { + BigDecimal value = parser.getDecimalValue(); + long seconds = value.longValue(); + int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); + return fromNanoseconds.apply(new FromDecimalArguments( + seconds, nanoseconds, getZone(context))); + } + + case JsonTokenId.ID_NUMBER_INT: { + long timestamp = parser.getLongValue(); + if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + return this.fromNanoseconds.apply(new FromDecimalArguments( + timestamp, 0, this.getZone(context) + )); + } + return this.fromMilliseconds.apply(new FromIntegerArguments( + timestamp, this.getZone(context) + )); + } + + case JsonTokenId.ID_STRING: { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; + } + if (string.endsWith("+0000")) { + string = string.substring(0, string.length() - 5) + "Z"; + } + T value; + try { + TemporalAccessor acc = _formatter.parse(string); + value = parsedToValue.apply(acc); + if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { + return adjust.apply(value, this.getZone(context)); + } + } catch (DateTimeException e) { + throw _peelDTE(e); + } + return value; + } + } + throw context.mappingException("Expected type float, integer, or string."); + } + + private ZoneId getZone(DeserializationContext context) { + // Instants are always in UTC, so don't waste compute cycles + return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone()); + } + + private static class FromIntegerArguments { + public final long value; + public final ZoneId zoneId; + + private FromIntegerArguments(long value, ZoneId zoneId) { + this.value = value; + this.zoneId = zoneId; + } + } + + private static class FromDecimalArguments { + public final long integer; + public final int fraction; + public final ZoneId zoneId; + + private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) { + this.integer = integer; + this.fraction = fraction; + this.zoneId = zoneId; + } + } +} diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/JSON.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/JSON.java new file mode 100644 index 00000000000..590495331b6 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/JSON.java @@ -0,0 +1,289 @@ +/* + * 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: \" \\ + * + * 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. + */ + + +package io.swagger.client; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.format.DateTimeFormatter; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.util.Date; + +public class JSON { + private Gson gson; + private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + + public JSON() { + gson = new GsonBuilder() + .registerTypeAdapter(Date.class, dateTypeAdapter) + .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) + .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) + .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) + .create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + * @return JSON + */ + public JSON setGson(Gson gson) { + this.gson = gson; + return this; + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + return this; + } + + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() { + } + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() { + } + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public JSON setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + return this; + } + + public JSON setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + return this; + } + +} diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..a3e18a44fc6 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,37 @@ +package io.swagger.client.api; + +import io.swagger.client.CollectionFormats.*; + + +import retrofit2.Call; +import retrofit2.http.*; + +import okhttp3.RequestBody; + +import io.swagger.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import play.libs.F; +import retrofit2.Response; + +public interface FakeClassnameTags123Api { + /** + * To test class name in snake case + * + * @param body client model (required) + * @return Call<Client> + */ + + @Headers({ + "Content-Type:application/json" + }) + @PATCH("fake_classname_test") + F.Promise> testClassname( + @retrofit2.http.Body Client body + ); + +} diff --git a/samples/client/petstore/java/retrofit2-play24/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/retrofit2-play24/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..2fd2c16ed50 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,39 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiClient; +import io.swagger.client.model.Client; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + private FakeClassnameTags123Api api; + + @Before + public void setup() { + api = new ApiClient().createService(FakeClassnameTags123Api.class); + } + + + /** + * To test class name in snake case + * + * + */ + @Test + public void testClassnameTest() { + Client body = null; + // Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/retrofit2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2/docs/FakeApi.md index e62301d3af7..063c71645ba 100644 --- a/samples/client/petstore/java/retrofit2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2/docs/FakeApi.md @@ -177,8 +177,8 @@ Name | Type | Description | Notes **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] ### Return type diff --git a/samples/client/petstore/java/retrofit2/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/retrofit2/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..1af4ad538aa --- /dev/null +++ b/samples/client/petstore/java/retrofit2/docs/FakeClassnameTags123Api.md @@ -0,0 +1,52 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** fake_classname_test | To test class name in snake case + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeClassnameTags123Api; + + +FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); +Client body = new Client(); // Client | client model +try { + Client result = apiInstance.testClassname(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..d214188b811 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,35 @@ +package io.swagger.client.api; + +import io.swagger.client.CollectionFormats.*; + + +import retrofit2.Call; +import retrofit2.http.*; + +import okhttp3.RequestBody; + +import io.swagger.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public interface FakeClassnameTags123Api { + /** + * To test class name in snake case + * + * @param body client model (required) + * @return Call<Client> + */ + + @Headers({ + "Content-Type:application/json" + }) + @PATCH("fake_classname_test") + Call testClassname( + @retrofit2.http.Body Client body + ); + +} diff --git a/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..2fd2c16ed50 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,39 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiClient; +import io.swagger.client.model.Client; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + private FakeClassnameTags123Api api; + + @Before + public void setup() { + api = new ApiClient().createService(FakeClassnameTags123Api.class); + } + + + /** + * To test class name in snake case + * + * + */ + @Test + public void testClassnameTest() { + Client body = null; + // Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md index e62301d3af7..063c71645ba 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md @@ -177,8 +177,8 @@ Name | Type | Description | Notes **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] - **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] ### Return type diff --git a/samples/client/petstore/java/retrofit2rx/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/retrofit2rx/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..1af4ad538aa --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/docs/FakeClassnameTags123Api.md @@ -0,0 +1,52 @@ +# FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** fake_classname_test | To test class name in snake case + + + +# **testClassname** +> Client testClassname(body) + +To test class name in snake case + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeClassnameTags123Api; + + +FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); +Client body = new Client(); // Client | client model +try { + Client result = apiInstance.testClassname(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..04e5c547d7e --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,35 @@ +package io.swagger.client.api; + +import io.swagger.client.CollectionFormats.*; + +import rx.Observable; + +import retrofit2.http.*; + +import okhttp3.RequestBody; + +import io.swagger.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public interface FakeClassnameTags123Api { + /** + * To test class name in snake case + * + * @param body client model (required) + * @return Call<Client> + */ + + @Headers({ + "Content-Type:application/json" + }) + @PATCH("fake_classname_test") + Observable testClassname( + @retrofit2.http.Body Client body + ); + +} diff --git a/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..2fd2c16ed50 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,39 @@ +package io.swagger.client.api; + +import io.swagger.client.ApiClient; +import io.swagger.client.model.Client; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + private FakeClassnameTags123Api api; + + @Before + public void setup() { + api = new ApiClient().createService(FakeClassnameTags123Api.class); + } + + + /** + * To test class name in snake case + * + * + */ + @Test + public void testClassnameTest() { + Client body = null; + // Client response = api.testClassname(body); + + // TODO: test validations + } + +} diff --git a/samples/client/petstore/javascript-closure-angular/.swagger-codegen-ignore b/samples/client/petstore/javascript-closure-angular/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/client/petstore/javascript-closure-angular/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/ApiResponse.js b/samples/client/petstore/javascript-closure-angular/API/Client/ApiResponse.js index 0ec7148bc9a..1571a951f19 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/ApiResponse.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/ApiResponse.js @@ -1,6 +1,7 @@ goog.provide('API.Client.ApiResponse'); /** + * Describes the result of uploading an image resource * @record */ API.Client.ApiResponse = function() {} diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/Category.js b/samples/client/petstore/javascript-closure-angular/API/Client/Category.js index fe9d23c34ff..563fd25b62c 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/Category.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/Category.js @@ -1,6 +1,7 @@ goog.provide('API.Client.Category'); /** + * A category for a pet * @record */ API.Client.Category = function() {} diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/Order.js b/samples/client/petstore/javascript-closure-angular/API/Client/Order.js index c4ec23a066a..1e1e6f8cff8 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/Order.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/Order.js @@ -1,6 +1,7 @@ goog.provide('API.Client.Order'); /** + * An order for a pets from the pet store * @record */ API.Client.Order = function() {} diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/Pet.js b/samples/client/petstore/javascript-closure-angular/API/Client/Pet.js index 2c734557b64..5643c51817b 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/Pet.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/Pet.js @@ -1,6 +1,7 @@ goog.provide('API.Client.Pet'); /** + * A pet for sale in the pet store * @record */ API.Client.Pet = function() {} diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/PetApi.js b/samples/client/petstore/javascript-closure-angular/API/Client/PetApi.js index 06561bb4ab5..3d25f137ff6 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/PetApi.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/PetApi.js @@ -5,7 +5,7 @@ * * 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. * Version: 1.0.0 - * Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen + * Generated by: io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen */ /** * @license Apache 2.0 diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/StoreApi.js b/samples/client/petstore/javascript-closure-angular/API/Client/StoreApi.js index d997cc15ce3..2b780ca475d 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/StoreApi.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/StoreApi.js @@ -5,7 +5,7 @@ * * 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. * Version: 1.0.0 - * Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen + * Generated by: io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen */ /** * @license Apache 2.0 diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/Tag.js b/samples/client/petstore/javascript-closure-angular/API/Client/Tag.js index a65ee4658c8..19bb326f21f 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/Tag.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/Tag.js @@ -1,6 +1,7 @@ goog.provide('API.Client.Tag'); /** + * A tag for a pet * @record */ API.Client.Tag = function() {} diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/User.js b/samples/client/petstore/javascript-closure-angular/API/Client/User.js index 332c98a8028..9956225f75d 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/User.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/User.js @@ -1,6 +1,7 @@ goog.provide('API.Client.User'); /** + * A User who is purchasing from the pet store * @record */ API.Client.User = function() {} diff --git a/samples/client/petstore/javascript-closure-angular/API/Client/UserApi.js b/samples/client/petstore/javascript-closure-angular/API/Client/UserApi.js index 5a146fc04d6..0f64823bb97 100644 --- a/samples/client/petstore/javascript-closure-angular/API/Client/UserApi.js +++ b/samples/client/petstore/javascript-closure-angular/API/Client/UserApi.js @@ -5,7 +5,7 @@ * * 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. * Version: 1.0.0 - * Generated by: class io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen + * Generated by: io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen */ /** * @license Apache 2.0 diff --git a/samples/client/petstore/javascript-promise/src/api/FakeApi.js b/samples/client/petstore/javascript-promise/src/api/FakeApi.js index 8a556c0b24c..eb820735f8b 100644 --- a/samples/client/petstore/javascript-promise/src/api/FakeApi.js +++ b/samples/client/petstore/javascript-promise/src/api/FakeApi.js @@ -178,8 +178,8 @@ * @param {module:model/String} opts.enumHeaderString Header parameter enum test (string) (default to -efg) * @param {Array.} opts.enumQueryStringArray Query parameter enum test (string array) * @param {module:model/String} opts.enumQueryString Query parameter enum test (string) (default to -efg) - * @param {Number} opts.enumQueryInteger Query parameter enum test (double) - * @param {Number} opts.enumQueryDouble Query parameter enum test (double) + * @param {module:model/Number} opts.enumQueryInteger Query parameter enum test (double) + * @param {module:model/Number} opts.enumQueryDouble Query parameter enum test (double) * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ this.testEnumParameters = function(opts) { diff --git a/samples/client/petstore/javascript/src/api/FakeApi.js b/samples/client/petstore/javascript/src/api/FakeApi.js index 2ee4b332d0d..b51d6e8d07a 100644 --- a/samples/client/petstore/javascript/src/api/FakeApi.js +++ b/samples/client/petstore/javascript/src/api/FakeApi.js @@ -200,8 +200,8 @@ * @param {module:model/String} opts.enumHeaderString Header parameter enum test (string) (default to -efg) * @param {Array.} opts.enumQueryStringArray Query parameter enum test (string array) * @param {module:model/String} opts.enumQueryString Query parameter enum test (string) (default to -efg) - * @param {Number} opts.enumQueryInteger Query parameter enum test (double) - * @param {Number} opts.enumQueryDouble Query parameter enum test (double) + * @param {module:model/Number} opts.enumQueryInteger Query parameter enum test (double) + * @param {module:model/Number} opts.enumQueryDouble Query parameter enum test (double) * @param {module:api/FakeApi~testEnumParametersCallback} callback The callback function, accepting three arguments: error, data, response */ this.testEnumParameters = function(opts, callback) { diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 1fd5b85a80b..e578f3309e8 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -223,6 +223,7 @@ Each of these calls returns a hashref with various useful pieces of information. To load the API packages: ```perl use WWW::SwaggerClient::FakeApi; +use WWW::SwaggerClient::FakeClassnameTags123Api; use WWW::SwaggerClient::PetApi; use WWW::SwaggerClient::StoreApi; use WWW::SwaggerClient::UserApi; @@ -275,6 +276,7 @@ use strict; use warnings; # load the API package use WWW::SwaggerClient::FakeApi; +use WWW::SwaggerClient::FakeClassnameTags123Api; use WWW::SwaggerClient::PetApi; use WWW::SwaggerClient::StoreApi; use WWW::SwaggerClient::UserApi; @@ -340,6 +342,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters +*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store *PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/perl/docs/FakeClassnameTags123Api.md b/samples/client/petstore/perl/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..db389956f46 --- /dev/null +++ b/samples/client/petstore/perl/docs/FakeClassnameTags123Api.md @@ -0,0 +1,58 @@ +# WWW::SwaggerClient::FakeClassnameTags123Api + +## Load the API package +```perl +use WWW::SwaggerClient::Object::FakeClassnameTags123Api; +``` + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_classname**](FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **test_classname** +> Client test_classname(body => $body) + +To test class name in snake case + +### Example +```perl +use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::FakeClassnameTags123Api; + +my $api_instance = WWW::SwaggerClient::FakeClassnameTags123Api->new(); +my $body = WWW::SwaggerClient::Object::Client->new(); # Client | client model + +eval { + my $result = $api_instance->test_classname(body => $body); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling FakeClassnameTags123Api->test_classname: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeClassnameTags123Api.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeClassnameTags123Api.pm new file mode 100644 index 00000000000..568c14216c7 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeClassnameTags123Api.pm @@ -0,0 +1,120 @@ +=begin comment + +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: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::FakeClassnameTags123Api; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use Exporter; +use Carp qw( croak ); +use Log::Any qw($log); + +use WWW::SwaggerClient::ApiClient; +use WWW::SwaggerClient::Configuration; + +use base "Class::Data::Inheritable"; + +__PACKAGE__->mk_classdata('method_documentation' => {}); + +sub new { + my $class = shift; + my (%self) = ( + 'api_client' => WWW::SwaggerClient::ApiClient->instance, + @_ + ); + + #my $self = { + # #api_client => $options->{api_client} + # api_client => $default_api_client + #}; + + bless \%self, $class; + +} + + +# +# test_classname +# +# To test class name in snake case +# +# @param Client $body client model (required) +{ + my $params = { + 'body' => { + data_type => 'Client', + description => 'client model', + required => '1', + }, + }; + __PACKAGE__->method_documentation->{ 'test_classname' } = { + summary => 'To test class name in snake case', + params => $params, + returns => 'Client', + }; +} +# @return Client +# +sub test_classname { + my ($self, %args) = @_; + + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling test_classname"); + } + + # parse inputs + my $_resource_path = '/fake_classname_test'; + $_resource_path =~ s/{format}/json/; # default format to json + + my $_method = 'PATCH'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept('application/json'); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); + + my $_body_data; + # body params + if ( exists $args{'body'}) { + $_body_data = $args{'body'}; + } + + # authentication setting, if any + my $auth_settings = [qw()]; + + # make the API Call + my $response = $self->{api_client}->call_api($_resource_path, $_method, + $query_params, $form_params, + $header_params, $_body_data, $auth_settings); + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('Client', $response); + return $_response_object; +} + +1; diff --git a/samples/client/petstore/perl/t/FakeClassnameTags123ApiTest.t b/samples/client/petstore/perl/t/FakeClassnameTags123ApiTest.t new file mode 100644 index 00000000000..d76f7a38ed7 --- /dev/null +++ b/samples/client/petstore/perl/t/FakeClassnameTags123ApiTest.t @@ -0,0 +1,41 @@ +=begin comment + +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: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by Swagger Codegen +# Please update the test cases below to test the API endpoints. +# Ref: https://github.com/swagger-api/swagger-codegen +# +use Test::More tests => 1; #TODO update number of test cases +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + +use_ok('WWW::SwaggerClient::FakeClassnameTags123Api'); + +my $api = WWW::SwaggerClient::FakeClassnameTags123Api->new(); +isa_ok($api, 'WWW::SwaggerClient::FakeClassnameTags123Api'); + +# +# test_classname test +# +{ + my $body = undef; # replace NULL with a proper value + my $result = $api->test_classname(body => $body); +} + + +1; diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 7de4bd350d5..ddf4676b77e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -78,6 +78,7 @@ Class | Method | HTTP request | Description *FakeApi* | [**testClientModel**](docs/Api/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**testEndpointParameters**](docs/Api/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**testEnumParameters**](docs/Api/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +*Fake_classname_tags123Api* | [**testClassname**](docs/Api/Fake_classname_tags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case *PetApi* | [**addPet**](docs/Api/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/Api/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/Api/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Api/Fake_classname_tags123Api.md b/samples/client/petstore/php/SwaggerClient-php/docs/Api/Fake_classname_tags123Api.md new file mode 100644 index 00000000000..da2e15359f2 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Api/Fake_classname_tags123Api.md @@ -0,0 +1,52 @@ +# Swagger\Client\Fake_classname_tags123Api + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](Fake_classname_tags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +> \Swagger\Client\Model\Client testClassname($body) + +To test class name in snake case + +### Example +```php +testClassname($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling Fake_classname_tags123Api->testClassname: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\Client**](../Model/\Swagger\Client\Model\Client.md)| client model | + +### Return type + +[**\Swagger\Client\Model\Client**](../Model/Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php new file mode 100644 index 00000000000..88191d22240 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/Fake_classname_tags123Api.php @@ -0,0 +1,171 @@ +apiClient = $apiClient; + } + + /** + * Get API client + * + * @return \Swagger\Client\ApiClient get the API client + */ + public function getApiClient() + { + return $this->apiClient; + } + + /** + * Set the API client + * + * @param \Swagger\Client\ApiClient $apiClient set the API client + * + * @return Fake_classname_tags123Api + */ + public function setApiClient(\Swagger\Client\ApiClient $apiClient) + { + $this->apiClient = $apiClient; + return $this; + } + + /** + * Operation testClassname + * + * To test class name in snake case + * + * @param \Swagger\Client\Model\Client $body client model (required) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\Client + */ + public function testClassname($body) + { + list($response) = $this->testClassnameWithHttpInfo($body); + return $response; + } + + /** + * Operation testClassnameWithHttpInfo + * + * To test class name in snake case + * + * @param \Swagger\Client\Model\Client $body client model (required) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\Client, HTTP status code, HTTP response headers (array of strings) + */ + public function testClassnameWithHttpInfo($body) + { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling testClassname'); + } + // parse inputs + $resourcePath = "/fake_classname_test"; + $httpBody = ''; + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept(['application/json']); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(['application/json']); + + // default format to json + $resourcePath = str_replace("{format}", "json", $resourcePath); + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, + 'PATCH', + $queryParams, + $httpBody, + $headerParams, + '\Swagger\Client\Model\Client', + '/fake_classname_test' + ); + + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Client', $httpHeader), $statusCode, $httpHeader]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Client', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + } + + throw $e; + } + } +} diff --git a/samples/client/petstore/php/SwaggerClient-php/test/Api/Fake_classname_tags123ApiTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Api/Fake_classname_tags123ApiTest.php new file mode 100644 index 00000000000..8ad4c816f49 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/test/Api/Fake_classname_tags123ApiTest.php @@ -0,0 +1,90 @@ + Client test_classname(body) + +To test class name in snake case + +### Example +```ruby +# load the gem +require 'petstore' + +api_instance = Petstore::FakeClassnameTags123Api.new + +body = Petstore::Client.new # Client | client model + + +begin + #To test class name in snake case + result = api_instance.test_classname(body) + p result +rescue Petstore::ApiError => e + puts "Exception when calling FakeClassnameTags123Api->test_classname: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + + diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index 5644d820a27..7ffded4660c 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -51,6 +51,7 @@ require 'petstore/models/user' # APIs require 'petstore/api/fake_api' +require 'petstore/api/fake_classname_tags123_api' require 'petstore/api/pet_api' require 'petstore/api/store_api' require 'petstore/api/user_api' diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index 481004db585..206ede2dc05 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -145,20 +145,20 @@ module Petstore # verify the required parameter 'byte' is set fail ArgumentError, "Missing the required parameter 'byte' when calling FakeApi.test_endpoint_parameters" if byte.nil? - if !opts[:'integer'].nil? && opts[:'integer'] > 100.0 - fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 100.0.' + if !opts[:'integer'].nil? && opts[:'integer'] > 100 + fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 100.' end - if !opts[:'integer'].nil? && opts[:'integer'] < 10.0 - fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 10.0.' + if !opts[:'integer'].nil? && opts[:'integer'] < 10 + fail ArgumentError, 'invalid value for "opts[:"integer"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 10.' end - if !opts[:'int32'].nil? && opts[:'int32'] > 200.0 - fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 200.0.' + if !opts[:'int32'].nil? && opts[:'int32'] > 200 + fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be smaller than or equal to 200.' end - if !opts[:'int32'].nil? && opts[:'int32'] < 20.0 - fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 20.0.' + if !opts[:'int32'].nil? && opts[:'int32'] < 20 + fail ArgumentError, 'invalid value for "opts[:"int32"]" when calling FakeApi.test_endpoint_parameters, must be greater than or equal to 20.' end if !opts[:'float'].nil? && opts[:'float'] > 987.6 @@ -273,6 +273,12 @@ module Petstore if opts[:'enum_query_string'] && !['_abc', '-efg', '(xyz)'].include?(opts[:'enum_query_string']) fail ArgumentError, 'invalid value for "enum_query_string", must be one of _abc, -efg, (xyz)' end + if opts[:'enum_query_integer'] && !['1', '-2'].include?(opts[:'enum_query_integer']) + fail ArgumentError, 'invalid value for "enum_query_integer", must be one of 1, -2' + end + if opts[:'enum_query_double'] && !['1.1', '-1.2'].include?(opts[:'enum_query_double']) + fail ArgumentError, 'invalid value for "enum_query_double", must be one of 1.1, -1.2' + end # resource path local_var_path = "/fake".sub('{format}','json') diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb new file mode 100644 index 00000000000..33eebedc093 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb @@ -0,0 +1,75 @@ +=begin +#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: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require "uri" + +module Petstore + class FakeClassnameTags123Api + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + + # To test class name in snake case + # + # @param body client model + # @param [Hash] opts the optional parameters + # @return [Client] + def test_classname(body, opts = {}) + data, _status_code, _headers = test_classname_with_http_info(body, opts) + return data + end + + # To test class name in snake case + # + # @param body client model + # @param [Hash] opts the optional parameters + # @return [Array<(Client, Fixnum, Hash)>] Client data, response status code and response headers + def test_classname_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FakeClassnameTags123Api.test_classname ..." + end + # verify the required parameter 'body' is set + fail ArgumentError, "Missing the required parameter 'body' when calling FakeClassnameTags123Api.test_classname" if body.nil? + # resource path + local_var_path = "/fake_classname_test".sub('{format}','json') + + # query parameters + query_params = {} + + # header parameters + header_params = {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = {} + + # http body (model) + post_body = @api_client.object_to_http_body(body) + auth_names = [] + data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'Client') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeClassnameTags123Api#test_classname\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index 39d5490b787..30e2a46dfac 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -137,12 +137,12 @@ module Petstore end # verify the required parameter 'order_id' is set fail ArgumentError, "Missing the required parameter 'order_id' when calling StoreApi.get_order_by_id" if order_id.nil? - if order_id > 5.0 - fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be smaller than or equal to 5.0.' + if order_id > 5 + fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be smaller than or equal to 5.' end - if order_id < 1.0 - fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be greater than or equal to 1.0.' + if order_id < 1 + fail ArgumentError, 'invalid value for "order_id" when calling StoreApi.get_order_by_id, must be greater than or equal to 1.' end # resource path diff --git a/samples/client/petstore/ruby/spec/api/fake_classname_tags123_api_spec.rb b/samples/client/petstore/ruby/spec/api/fake_classname_tags123_api_spec.rb new file mode 100644 index 00000000000..581f228fb66 --- /dev/null +++ b/samples/client/petstore/ruby/spec/api/fake_classname_tags123_api_spec.rb @@ -0,0 +1,46 @@ +=begin +#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: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Petstore::FakeClassnameTags123Api +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'FakeClassnameTags123Api' do + before do + # run before each test + @instance = Petstore::FakeClassnameTags123Api.new + end + + after do + # run after each test + end + + describe 'test an instance of FakeClassnameTags123Api' do + it 'should create an instact of FakeClassnameTags123Api' do + expect(@instance).to be_instance_of(Petstore::FakeClassnameTags123Api) + end + end + + # unit tests for test_classname + # To test class name in snake case + # + # @param body client model + # @param [Hash] opts the optional parameters + # @return [Client] + describe 'test_classname test' do + it "should work" do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 5e5f0df315f..b29cedcf817 100644 --- a/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -177,14 +177,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" } ]}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - examples: [{contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], @@ -200,14 +200,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" } ]}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - parameter tags: (query) Tags to filter by (optional) @@ -268,14 +268,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - examples: [{contentType=application/json, example={ "photoUrls" : [ "aeiou" ], @@ -291,14 +291,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - parameter petId: (path) ID of pet that needs to be fetched diff --git a/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index 10c878314e7..6e2c98864b1 100644 --- a/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -69,10 +69,10 @@ public class StoreAPI: APIBase { - name: api_key - examples: [{contentType=application/json, example={ "key" : 123 -}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@6e901cd0}] +}}, {contentType=application/xml, example=}] - examples: [{contentType=application/json, example={ "key" : 123 -}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@6e901cd0}] +}}, {contentType=application/xml, example=}] - returns: RequestBuilder<[String:Int32]> */ @@ -116,11 +116,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] - examples: [{contentType=application/json, example={ @@ -131,11 +131,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] @@ -184,11 +184,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] - examples: [{contentType=application/json, example={ @@ -199,11 +199,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] diff --git a/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index d6df7754683..0891f2cd372 100644 --- a/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift/default/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -177,14 +177,14 @@ public class UserAPI: APIBase { "email" : "aeiou", "username" : "aeiou" }}, {contentType=application/xml, example= - 123456 - string - string - string - string - string - string - 0 + 123456789 + aeiou + aeiou + aeiou + aeiou + aeiou + aeiou + 123 }] - examples: [{contentType=application/json, example={ "firstName" : "aeiou", @@ -196,14 +196,14 @@ public class UserAPI: APIBase { "email" : "aeiou", "username" : "aeiou" }}, {contentType=application/xml, example= - 123456 - string - string - string - string - string - string - 0 + 123456789 + aeiou + aeiou + aeiou + aeiou + aeiou + aeiou + 123 }] - parameter username: (path) The name that needs to be fetched. Use user1 for testing. @@ -244,8 +244,8 @@ public class UserAPI: APIBase { Logs user into the system - GET /user/login - - - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] - - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=aeiou}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=aeiou}] - parameter username: (query) The user name for login (optional) - parameter password: (query) The password for login in clear text (optional) diff --git a/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index b4cd67db8d2..5527956a09d 100644 --- a/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -247,14 +247,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" } ]}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - examples: [{contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], @@ -270,14 +270,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" } ]}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - parameter tags: (query) Tags to filter by (optional) @@ -355,14 +355,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - examples: [{contentType=application/json, example={ "photoUrls" : [ "aeiou" ], @@ -378,14 +378,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - parameter petId: (path) ID of pet that needs to be fetched diff --git a/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index 75b33b2fd0f..b6c59b7aff5 100644 --- a/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -103,10 +103,10 @@ public class StoreAPI: APIBase { - name: api_key - examples: [{contentType=application/json, example={ "key" : 123 -}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@6e901cd0}] +}}, {contentType=application/xml, example=}] - examples: [{contentType=application/json, example={ "key" : 123 -}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@6e901cd0}] +}}, {contentType=application/xml, example=}] - returns: RequestBuilder<[String:Int32]> */ @@ -167,11 +167,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] - examples: [{contentType=application/json, example={ @@ -182,11 +182,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] @@ -252,11 +252,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] - examples: [{contentType=application/json, example={ @@ -267,11 +267,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] diff --git a/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index 98afec0c80a..07c05056ea3 100644 --- a/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift/promisekit/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -263,14 +263,14 @@ public class UserAPI: APIBase { "email" : "aeiou", "username" : "aeiou" }}, {contentType=application/xml, example= - 123456 - string - string - string - string - string - string - 0 + 123456789 + aeiou + aeiou + aeiou + aeiou + aeiou + aeiou + 123 }] - examples: [{contentType=application/json, example={ "firstName" : "aeiou", @@ -282,14 +282,14 @@ public class UserAPI: APIBase { "email" : "aeiou", "username" : "aeiou" }}, {contentType=application/xml, example= - 123456 - string - string - string - string - string - string - 0 + 123456789 + aeiou + aeiou + aeiou + aeiou + aeiou + aeiou + 123 }] - parameter username: (path) The name that needs to be fetched. Use user1 for testing. @@ -348,8 +348,8 @@ public class UserAPI: APIBase { Logs user into the system - GET /user/login - - - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] - - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=aeiou}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=aeiou}] - parameter username: (query) The user name for login (optional) - parameter password: (query) The password for login in clear text (optional) diff --git a/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 971771918ae..0fac18f1f0e 100644 --- a/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -255,14 +255,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" } ]}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - examples: [{contentType=application/json, example=[ { "photoUrls" : [ "aeiou" ], @@ -278,14 +278,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" } ]}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - parameter tags: (query) Tags to filter by (optional) @@ -365,14 +365,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - examples: [{contentType=application/json, example={ "photoUrls" : [ "aeiou" ], @@ -388,14 +388,14 @@ public class PetAPI: APIBase { } ], "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 + 123456789 doggie - string + aeiou - string + aeiou }] - parameter petId: (path) ID of pet that needs to be fetched diff --git a/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index 5a0fff19e52..a6c71ed31b6 100644 --- a/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -107,10 +107,10 @@ public class StoreAPI: APIBase { - name: api_key - examples: [{contentType=application/json, example={ "key" : 123 -}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@6e901cd0}] +}}, {contentType=application/xml, example=}] - examples: [{contentType=application/json, example={ "key" : 123 -}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@6e901cd0}] +}}, {contentType=application/xml, example=}] - returns: RequestBuilder<[String:Int32]> */ @@ -173,11 +173,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] - examples: [{contentType=application/json, example={ @@ -188,11 +188,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] @@ -260,11 +260,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] - examples: [{contentType=application/json, example={ @@ -275,11 +275,11 @@ public class StoreAPI: APIBase { "complete" : true, "status" : "aeiou" }}, {contentType=application/xml, example= - 123456 - 123456 - 0 + 123456789 + 123456789 + 123 2000-01-23T04:56:07.000Z - string + aeiou true }] diff --git a/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index 0dbc4e7b340..e4782e6f499 100644 --- a/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift/rxswift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -273,14 +273,14 @@ public class UserAPI: APIBase { "email" : "aeiou", "username" : "aeiou" }}, {contentType=application/xml, example= - 123456 - string - string - string - string - string - string - 0 + 123456789 + aeiou + aeiou + aeiou + aeiou + aeiou + aeiou + 123 }] - examples: [{contentType=application/json, example={ "firstName" : "aeiou", @@ -292,14 +292,14 @@ public class UserAPI: APIBase { "email" : "aeiou", "username" : "aeiou" }}, {contentType=application/xml, example= - 123456 - string - string - string - string - string - string - 0 + 123456789 + aeiou + aeiou + aeiou + aeiou + aeiou + aeiou + 123 }] - parameter username: (path) The name that needs to be fetched. Use user1 for testing. @@ -360,8 +360,8 @@ public class UserAPI: APIBase { Logs user into the system - GET /user/login - - - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] - - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=aeiou}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=aeiou}] - parameter username: (query) The user name for login (optional) - parameter password: (query) The password for login in clear text (optional) 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 870a0efe98c..4dab196c207 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 @@ -181,6 +181,22 @@ open class FakeAPI: APIBase { case xyz = "(xyz)" } + /** + * enum for parameter enumQueryInteger + */ + public enum EnumQueryInteger_testEnumParameters: Int32 { + case number1 = 1 + case numberminus2 = -2 + } + + /** + * enum for parameter enumQueryDouble + */ + public enum EnumQueryDouble_testEnumParameters: Double { + case number11 = 1.1 + case numberminus12 = -1.2 + } + /** To test enum parameters @@ -194,7 +210,7 @@ open class FakeAPI: APIBase { - parameter enumQueryDouble: (form) Query parameter enum test (double) (optional) - parameter completion: completion handler to receive the data and the error objects */ - open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: Int32? = nil, enumQueryDouble: Double? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { + open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { testEnumParametersWithRequestBuilder(enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble).execute { (response, error) -> Void in completion(error) } @@ -217,13 +233,13 @@ open class FakeAPI: APIBase { - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: Int32? = nil, enumQueryDouble: Double? = nil) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String:Any?] = [ "enum_form_string_array": enumFormStringArray, "enum_form_string": enumFormString?.rawValue, - "enum_query_double": enumQueryDouble + "enum_query_double": enumQueryDouble?.rawValue ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -233,7 +249,7 @@ open class FakeAPI: APIBase { url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ "enum_query_string_array": enumQueryStringArray, "enum_query_string": enumQueryString?.rawValue, - "enum_query_integer": enumQueryInteger?.encodeToJSON() + "enum_query_integer": enumQueryInteger?.encodeToJSON()?.rawValue ]) let nillableHeaders: [String: Any?] = [ 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 8283b3cbe26..6245a5516b6 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 @@ -229,6 +229,22 @@ open class FakeAPI: APIBase { case xyz = "(xyz)" } + /** + * enum for parameter enumQueryInteger + */ + public enum EnumQueryInteger_testEnumParameters: Int32 { + case number1 = 1 + case numberminus2 = -2 + } + + /** + * enum for parameter enumQueryDouble + */ + public enum EnumQueryDouble_testEnumParameters: Double { + case number11 = 1.1 + case numberminus12 = -1.2 + } + /** To test enum parameters @@ -242,7 +258,7 @@ open class FakeAPI: APIBase { - parameter enumQueryDouble: (form) Query parameter enum test (double) (optional) - parameter completion: completion handler to receive the data and the error objects */ - open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: Int32? = nil, enumQueryDouble: Double? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { + open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { testEnumParametersWithRequestBuilder(enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble).execute { (response, error) -> Void in completion(error) } @@ -261,7 +277,7 @@ open class FakeAPI: APIBase { - parameter enumQueryDouble: (form) Query parameter enum test (double) (optional) - returns: Promise */ - open class func testEnumParameters( enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: Int32? = nil, enumQueryDouble: Double? = nil) -> Promise { + open class func testEnumParameters( enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil) -> Promise { let deferred = Promise.pending() testEnumParameters(enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble) { error in if let error = error { @@ -289,13 +305,13 @@ open class FakeAPI: APIBase { - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: Int32? = nil, enumQueryDouble: Double? = nil) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String:Any?] = [ "enum_form_string_array": enumFormStringArray, "enum_form_string": enumFormString?.rawValue, - "enum_query_double": enumQueryDouble + "enum_query_double": enumQueryDouble?.rawValue ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -305,7 +321,7 @@ open class FakeAPI: APIBase { url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ "enum_query_string_array": enumQueryStringArray, "enum_query_string": enumQueryString?.rawValue, - "enum_query_integer": enumQueryInteger?.encodeToJSON() + "enum_query_integer": enumQueryInteger?.encodeToJSON()?.rawValue ]) let nillableHeaders: [String: Any?] = [ 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 b02619e504e..e60300fea8d 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 @@ -233,6 +233,22 @@ open class FakeAPI: APIBase { case xyz = "(xyz)" } + /** + * enum for parameter enumQueryInteger + */ + public enum EnumQueryInteger_testEnumParameters: Int32 { + case number1 = 1 + case numberminus2 = -2 + } + + /** + * enum for parameter enumQueryDouble + */ + public enum EnumQueryDouble_testEnumParameters: Double { + case number11 = 1.1 + case numberminus12 = -1.2 + } + /** To test enum parameters @@ -246,7 +262,7 @@ open class FakeAPI: APIBase { - parameter enumQueryDouble: (form) Query parameter enum test (double) (optional) - parameter completion: completion handler to receive the data and the error objects */ - open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: Int32? = nil, enumQueryDouble: Double? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { + open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { testEnumParametersWithRequestBuilder(enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble).execute { (response, error) -> Void in completion(error) } @@ -265,7 +281,7 @@ open class FakeAPI: APIBase { - parameter enumQueryDouble: (form) Query parameter enum test (double) (optional) - returns: Observable */ - open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: Int32? = nil, enumQueryDouble: Double? = nil) -> Observable { + open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil) -> Observable { return Observable.create { observer -> Disposable in testEnumParameters(enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble) { error in if let error = error { @@ -295,13 +311,13 @@ open class FakeAPI: APIBase { - returns: RequestBuilder */ - open class func testEnumParametersWithRequestBuilder(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: Int32? = nil, enumQueryDouble: Double? = nil) -> RequestBuilder { + open class func testEnumParametersWithRequestBuilder(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil) -> RequestBuilder { let path = "/fake" let URLString = PetstoreClientAPI.basePath + path let formParams: [String:Any?] = [ "enum_form_string_array": enumFormStringArray, "enum_form_string": enumFormString?.rawValue, - "enum_query_double": enumQueryDouble + "enum_query_double": enumQueryDouble?.rawValue ] let nonNullParameters = APIHelper.rejectNil(formParams) @@ -311,7 +327,7 @@ open class FakeAPI: APIBase { url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ "enum_query_string_array": enumQueryStringArray, "enum_query_string": enumQueryString?.rawValue, - "enum_query_integer": enumQueryInteger?.encodeToJSON() + "enum_query_integer": enumQueryInteger?.encodeToJSON()?.rawValue ]) let nillableHeaders: [String: Any?] = [ diff --git a/samples/client/petstore/tizen/.swagger-codegen-ignore b/samples/client/petstore/tizen/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/client/petstore/tizen/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/tizen/doc/Doxyfile b/samples/client/petstore/tizen/doc/Doxyfile index 9a76a40a3b7..853d5442178 100644 --- a/samples/client/petstore/tizen/doc/Doxyfile +++ b/samples/client/petstore/tizen/doc/Doxyfile @@ -753,7 +753,7 @@ WARN_LOGFILE = # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = ./src +INPUT = ./src ./include # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/samples/client/petstore/tizen/doc/README.md b/samples/client/petstore/tizen/doc/README.md index dff9254b762..6b90ef614aa 100644 --- a/samples/client/petstore/tizen/doc/README.md +++ b/samples/client/petstore/tizen/doc/README.md @@ -66,9 +66,9 @@ Check out [Doxygen](https://www.doxygen.org/) for additional information about t ## What are the Model files for the data structures/objects? -* [ApiResponse](../src/ApiResponse.cpp) - -* [Category](../src/Category.cpp) - -* [Order](../src/Order.cpp) - -* [Pet](../src/Pet.cpp) - -* [Tag](../src/Tag.cpp) - -* [User](../src/User.cpp) - +* [ApiResponse](../src/ApiResponse.cpp) - Describes the result of uploading an image resource +* [Category](../src/Category.cpp) - A category for a pet +* [Order](../src/Order.cpp) - An order for a pets from the pet store +* [Pet](../src/Pet.cpp) - A pet for sale in the pet store +* [Tag](../src/Tag.cpp) - A tag for a pet +* [User](../src/User.cpp) - A User who is purchasing from the pet store diff --git a/samples/client/petstore/tizen/src/ApiResponse.cpp b/samples/client/petstore/tizen/src/ApiResponse.cpp index 815f87f93ac..bf5974f717c 100644 --- a/samples/client/petstore/tizen/src/ApiResponse.cpp +++ b/samples/client/petstore/tizen/src/ApiResponse.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include #include #include diff --git a/samples/client/petstore/tizen/src/ApiResponse.h b/samples/client/petstore/tizen/src/ApiResponse.h index 9ef20f7466c..025726c0b7d 100644 --- a/samples/client/petstore/tizen/src/ApiResponse.h +++ b/samples/client/petstore/tizen/src/ApiResponse.h @@ -1,23 +1,7 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - /* * ApiResponse.h * - * + * Describes the result of uploading an image resource */ #ifndef _ApiResponse_H_ @@ -31,7 +15,7 @@ namespace Tizen { namespace ArtikCloud { -/*! \brief +/*! \brief Describes the result of uploading an image resource * */ @@ -41,7 +25,7 @@ public: */ ApiResponse(); ApiResponse(char* str); - + /*! \brief Destructor. */ virtual ~ApiResponse(); @@ -82,7 +66,7 @@ private: std::string message; void __init(); void __cleanup(); - + }; } } diff --git a/samples/client/petstore/tizen/src/Category.cpp b/samples/client/petstore/tizen/src/Category.cpp index 0b5d3874de5..85262d29f14 100644 --- a/samples/client/petstore/tizen/src/Category.cpp +++ b/samples/client/petstore/tizen/src/Category.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include #include #include @@ -74,8 +58,8 @@ Category::fromJson(char* jsonStr) if (node !=NULL) { - if (isprimitive("long")) { - jsonToValue(&id, node, "long", ""); + if (isprimitive("long long")) { + jsonToValue(&id, node, "long long", ""); } else { } @@ -103,9 +87,9 @@ Category::toJson() { JsonObject *pJsonObject = json_object_new(); JsonNode *node; - if (isprimitive("long")) { - long obj = getId(); - node = converttoJson(&obj, "long", ""); + if (isprimitive("long long")) { + long long obj = getId(); + node = converttoJson(&obj, "long long", ""); } else { @@ -129,14 +113,14 @@ Category::toJson() return ret; } -long +long long Category::getId() { return id; } void -Category::setId(long id) +Category::setId(long long id) { this->id = id; } diff --git a/samples/client/petstore/tizen/src/Category.h b/samples/client/petstore/tizen/src/Category.h index acd170aa7ef..a675512a7fa 100644 --- a/samples/client/petstore/tizen/src/Category.h +++ b/samples/client/petstore/tizen/src/Category.h @@ -1,23 +1,7 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - /* * Category.h * - * + * A category for a pet */ #ifndef _Category_H_ @@ -31,7 +15,7 @@ namespace Tizen { namespace ArtikCloud { -/*! \brief +/*! \brief A category for a pet * */ @@ -41,7 +25,7 @@ public: */ Category(); Category(char* str); - + /*! \brief Destructor. */ virtual ~Category(); @@ -56,11 +40,11 @@ public: /*! \brief Get */ - long getId(); + long long getId(); /*! \brief Set */ - void setId(long id); + void setId(long long id); /*! \brief Get */ std::string getName(); @@ -70,11 +54,11 @@ public: void setName(std::string name); private: - long id; + long long id; std::string name; void __init(); void __cleanup(); - + }; } } diff --git a/samples/client/petstore/tizen/src/Error.cpp b/samples/client/petstore/tizen/src/Error.cpp index 0fb4199c185..04189730f61 100644 --- a/samples/client/petstore/tizen/src/Error.cpp +++ b/samples/client/petstore/tizen/src/Error.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include "Error.h" using namespace std; diff --git a/samples/client/petstore/tizen/src/Error.h b/samples/client/petstore/tizen/src/Error.h index cc6b9e59c1e..ef50b6ebfad 100644 --- a/samples/client/petstore/tizen/src/Error.h +++ b/samples/client/petstore/tizen/src/Error.h @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #ifndef _Error_H_ #define _Error_H_ #include diff --git a/samples/client/petstore/tizen/src/Helpers.cpp b/samples/client/petstore/tizen/src/Helpers.cpp index 3e938386937..1f50bcc3260 100644 --- a/samples/client/petstore/tizen/src/Helpers.cpp +++ b/samples/client/petstore/tizen/src/Helpers.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include #include #include @@ -123,10 +107,10 @@ converttoJson(void* ptr, string type, string containerType) node_temp = converttoJson(&b, type, ""); json_array_add_element(json_array, node_temp); } - } else if (strcmp("long", type.c_str()) == 0) { - list* new_list = static_cast*> (ptr); - for (list::iterator it = (*new_list).begin(); it != (*new_list).end(); it++) { - long b = *it; + } else if (strcmp("long long", type.c_str()) == 0) { + list* new_list = static_cast*> (ptr); + for (list::iterator it = (*new_list).begin(); it != (*new_list).end(); it++) { + long long b = *it; node_temp = converttoJson(&b, type, ""); json_array_add_element(json_array, node_temp); } @@ -159,56 +143,45 @@ converttoJson(void* ptr, string type, string containerType) return NULL; } else if (strcmp("std::string", type.c_str()) == 0) { JsonNode* node = json_node_alloc(); - string* v = static_cast (ptr); //const_gchar* b = v; - if(v!=NULL||v->empty()!=true){json_node_init(node, JSON_NODE_VALUE); - json_node_set_string(node, v->c_str()); - } + json_node_init(node, JSON_NODE_VALUE); + json_node_set_string(node, v->c_str()); return node; } else if (strcmp("int", type.c_str()) == 0) { JsonNode* node = json_node_alloc(); int* v = static_cast (ptr); gint b = *v; - if(v!=NULL){json_node_init(node, JSON_NODE_VALUE); - json_node_set_int(node, b); - } + json_node_init(node, JSON_NODE_VALUE); + json_node_set_int(node, b); return node; } else if (strcmp("float", type.c_str()) == 0) { JsonNode* node = json_node_alloc(); - float* v = static_cast (ptr); gdouble b = (double) *v; - if(v!=NULL){json_node_init(node, JSON_NODE_VALUE); - json_node_set_double(node, b); - } + json_node_init(node, JSON_NODE_VALUE); + json_node_set_double(node, b); return node; - } else if (strcmp("long", type.c_str()) == 0) { + } else if (strcmp("long long", type.c_str()) == 0) { JsonNode* node = json_node_alloc(); - long* v = static_cast (ptr); - gint b = (int) *v; - if(v!=NULL){ - json_node_init(node, JSON_NODE_VALUE); - json_node_set_int(node, b); - } + long long* v = static_cast (ptr); + gint64 b = (long long) *v; + json_node_init(node, JSON_NODE_VALUE); + json_node_set_int(node, b); return node; } else if (strcmp("double", type.c_str()) == 0) { JsonNode* node = json_node_alloc(); double* v = static_cast (ptr); gdouble b = *v; - if(v!=NULL){ - json_node_init(node, JSON_NODE_VALUE); - json_node_set_double(node, b); - } + json_node_init(node, JSON_NODE_VALUE); + json_node_set_double(node, b); return node; } else if (strcmp("bool", type.c_str()) == 0) { JsonNode* node = json_node_alloc(); bool* v = static_cast (ptr); gboolean b = *v; - if(v!=NULL){ - json_node_init(node, JSON_NODE_VALUE); - json_node_set_boolean(node, b); - } + json_node_init(node, JSON_NODE_VALUE); + json_node_set_boolean(node, b); return node; } else if (!isprimitive(type)) { @@ -285,9 +258,9 @@ jsonToValue(void* target, JsonNode* node, string type, string innerType) } else if (strcmp("float", type.c_str()) == 0) { float* val = static_cast (target); *val = (float)(json_node_get_double(node)); - } else if (strcmp("long", type.c_str()) == 0) { - long* val = static_cast (target); - *val = (long)(json_node_get_int(node)); + } else if (strcmp("long long", type.c_str()) == 0) { + long long* val = static_cast (target); + *val = (long long)(json_node_get_int(node)); } else if (strcmp("double", type.c_str()) == 0) { double* val = static_cast (target); *val = json_node_get_double(node); @@ -349,8 +322,8 @@ stringify(void* ptr, string type) ss << *pInt; string retval = ss.str(); return retval; - } else if (strcmp("long", type.c_str()) == 0) { - long* pLong = static_cast (ptr); + } else if (strcmp("long long", type.c_str()) == 0) { + long long* pLong = static_cast (ptr); stringstream ss; ss << *pLong; string retval = ss.str(); @@ -383,7 +356,7 @@ stringify(void* ptr, string type) bool isprimitive(string type){ if(strcmp("std::string", type.c_str()) == 0|| strcmp("int", type.c_str()) == 0|| - strcmp("long", type.c_str()) == 0|| + strcmp("long long", type.c_str()) == 0|| strcmp("double", type.c_str()) == 0|| strcmp("float", type.c_str()) == 0|| strcmp("bool", type.c_str()) == 0|| diff --git a/samples/client/petstore/tizen/src/Helpers.h b/samples/client/petstore/tizen/src/Helpers.h index 2dc5efa917a..31a8b42538b 100644 --- a/samples/client/petstore/tizen/src/Helpers.h +++ b/samples/client/petstore/tizen/src/Helpers.h @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #ifndef _HELPERS_H_ #define _HELPERS_H_ diff --git a/samples/client/petstore/tizen/src/NetClient.cpp b/samples/client/petstore/tizen/src/NetClient.cpp index 381a863d1d0..44a5e83c122 100644 --- a/samples/client/petstore/tizen/src/NetClient.cpp +++ b/samples/client/petstore/tizen/src/NetClient.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include "NetClient.h" using namespace std; @@ -316,13 +300,13 @@ int NetClient::easycurl(string host, string path, string method, std::map queryParams, string mBody, struct curl_slist* headerList, MemoryStruct_s* p_chunk, long* code, char* errormsg); diff --git a/samples/client/petstore/tizen/src/Object.h b/samples/client/petstore/tizen/src/Object.h index ef114ff59dc..fea929c3765 100644 --- a/samples/client/petstore/tizen/src/Object.h +++ b/samples/client/petstore/tizen/src/Object.h @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #ifndef _OBJECT_H_ #define _OBJECT_H_ diff --git a/samples/client/petstore/tizen/src/Order.cpp b/samples/client/petstore/tizen/src/Order.cpp index 0b1916ce5a9..f3e3a201d6b 100644 --- a/samples/client/petstore/tizen/src/Order.cpp +++ b/samples/client/petstore/tizen/src/Order.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include #include #include @@ -106,8 +90,8 @@ Order::fromJson(char* jsonStr) if (node !=NULL) { - if (isprimitive("long")) { - jsonToValue(&id, node, "long", ""); + if (isprimitive("long long")) { + jsonToValue(&id, node, "long long", ""); } else { } @@ -117,8 +101,8 @@ Order::fromJson(char* jsonStr) if (node !=NULL) { - if (isprimitive("long")) { - jsonToValue(&petId, node, "long", ""); + if (isprimitive("long long")) { + jsonToValue(&petId, node, "long long", ""); } else { } @@ -179,18 +163,18 @@ Order::toJson() { JsonObject *pJsonObject = json_object_new(); JsonNode *node; - if (isprimitive("long")) { - long obj = getId(); - node = converttoJson(&obj, "long", ""); + if (isprimitive("long long")) { + long long obj = getId(); + node = converttoJson(&obj, "long long", ""); } else { } const gchar *idKey = "id"; json_object_set_member(pJsonObject, idKey, node); - if (isprimitive("long")) { - long obj = getPetId(); - node = converttoJson(&obj, "long", ""); + if (isprimitive("long long")) { + long long obj = getPetId(); + node = converttoJson(&obj, "long long", ""); } else { @@ -241,26 +225,26 @@ Order::toJson() return ret; } -long +long long Order::getId() { return id; } void -Order::setId(long id) +Order::setId(long long id) { this->id = id; } -long +long long Order::getPetId() { return petId; } void -Order::setPetId(long petId) +Order::setPetId(long long petId) { this->petId = petId; } diff --git a/samples/client/petstore/tizen/src/Order.h b/samples/client/petstore/tizen/src/Order.h index 7b9a74c5309..7a3413f55da 100644 --- a/samples/client/petstore/tizen/src/Order.h +++ b/samples/client/petstore/tizen/src/Order.h @@ -1,23 +1,7 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - /* * Order.h * - * + * An order for a pets from the pet store */ #ifndef _Order_H_ @@ -31,7 +15,7 @@ namespace Tizen { namespace ArtikCloud { -/*! \brief +/*! \brief An order for a pets from the pet store * */ @@ -41,7 +25,7 @@ public: */ Order(); Order(char* str); - + /*! \brief Destructor. */ virtual ~Order(); @@ -56,18 +40,18 @@ public: /*! \brief Get */ - long getId(); + long long getId(); /*! \brief Set */ - void setId(long id); + void setId(long long id); /*! \brief Get */ - long getPetId(); + long long getPetId(); /*! \brief Set */ - void setPetId(long petId); + void setPetId(long long petId); /*! \brief Get */ int getQuantity(); @@ -98,15 +82,15 @@ public: void setComplete(bool complete); private: - long id; - long petId; + long long id; + long long petId; int quantity; std::string shipDate; std::string status; bool complete; void __init(); void __cleanup(); - + }; } } diff --git a/samples/client/petstore/tizen/src/Pet.cpp b/samples/client/petstore/tizen/src/Pet.cpp index 20d95112ec3..74f95f151ec 100644 --- a/samples/client/petstore/tizen/src/Pet.cpp +++ b/samples/client/petstore/tizen/src/Pet.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include #include #include @@ -106,8 +90,8 @@ Pet::fromJson(char* jsonStr) if (node !=NULL) { - if (isprimitive("long")) { - jsonToValue(&id, node, "long", ""); + if (isprimitive("long long")) { + jsonToValue(&id, node, "long long", ""); } else { } @@ -206,9 +190,9 @@ Pet::toJson() { JsonObject *pJsonObject = json_object_new(); JsonNode *node; - if (isprimitive("long")) { - long obj = getId(); - node = converttoJson(&obj, "long", ""); + if (isprimitive("long long")) { + long long obj = getId(); + node = converttoJson(&obj, "long long", ""); } else { @@ -295,14 +279,14 @@ Pet::toJson() return ret; } -long +long long Pet::getId() { return id; } void -Pet::setId(long id) +Pet::setId(long long id) { this->id = id; } diff --git a/samples/client/petstore/tizen/src/Pet.h b/samples/client/petstore/tizen/src/Pet.h index f6461812ea6..fe223a74d72 100644 --- a/samples/client/petstore/tizen/src/Pet.h +++ b/samples/client/petstore/tizen/src/Pet.h @@ -1,23 +1,7 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - /* * Pet.h * - * + * A pet for sale in the pet store */ #ifndef _Pet_H_ @@ -34,7 +18,7 @@ namespace Tizen { namespace ArtikCloud { -/*! \brief +/*! \brief A pet for sale in the pet store * */ @@ -44,7 +28,7 @@ public: */ Pet(); Pet(char* str); - + /*! \brief Destructor. */ virtual ~Pet(); @@ -59,11 +43,11 @@ public: /*! \brief Get */ - long getId(); + long long getId(); /*! \brief Set */ - void setId(long id); + void setId(long long id); /*! \brief Get */ Category getCategory(); @@ -101,7 +85,7 @@ public: void setStatus(std::string status); private: - long id; + long long id; Category category; std::string name; std::list photoUrls; @@ -109,7 +93,7 @@ private: std::string status; void __init(); void __cleanup(); - + }; } } diff --git a/samples/client/petstore/tizen/src/PetManager.cpp b/samples/client/petstore/tizen/src/PetManager.cpp index 7a9cc824c57..489c6663099 100644 --- a/samples/client/petstore/tizen/src/PetManager.cpp +++ b/samples/client/petstore/tizen/src/PetManager.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include #include @@ -236,7 +220,7 @@ bool deletePetProcessor(MemoryStruct_s p_chunk, long code, char* errormsg, void* } bool deletePetHelper(char * accessToken, - long petId, std::string apiKey, + long long petId, std::string apiKey, void(* handler)(Error, void* ) , void* userData, bool isAsync) { @@ -268,7 +252,7 @@ bool deletePetHelper(char * accessToken, s_petId.append("}"); pos = url.find(s_petId); url.erase(pos, s_petId.length()); - url.insert(pos, stringify(&petId, "long")); + url.insert(pos, stringify(&petId, "long long")); //TODO: free memory of errormsg, memorystruct MemoryStruct_s* p_chunk = new MemoryStruct_s(); @@ -316,7 +300,7 @@ bool deletePetHelper(char * accessToken, bool PetManager::deletePetAsync(char * accessToken, - long petId, std::string apiKey, + long long petId, std::string apiKey, void(* handler)(Error, void* ) , void* userData) { @@ -326,7 +310,7 @@ bool PetManager::deletePetAsync(char * accessToken, } bool PetManager::deletePetSync(char * accessToken, - long petId, std::string apiKey, + long long petId, std::string apiKey, void(* handler)(Error, void* ) , void* userData) { @@ -648,6 +632,13 @@ bool getPetByIdProcessor(MemoryStruct_s p_chunk, long code, char* errormsg, void pJson = json_from_string(data, NULL); jsonToValue(&out, pJson, "Pet", "Pet"); json_node_free(pJson); + + if ("Pet" == "std::string") { + string* val = (std::string*)(&out); + if (val->empty() && p_chunk.size>4) { + *val = string(p_chunk.memory, p_chunk.size); + } + } } else { out.fromJson(data); @@ -675,7 +666,7 @@ bool getPetByIdProcessor(MemoryStruct_s p_chunk, long code, char* errormsg, void } bool getPetByIdHelper(char * accessToken, - long petId, + long long petId, void(* handler)(Pet, Error, void* ) , void* userData, bool isAsync) { @@ -704,7 +695,7 @@ bool getPetByIdHelper(char * accessToken, s_petId.append("}"); pos = url.find(s_petId); url.erase(pos, s_petId.length()); - url.insert(pos, stringify(&petId, "long")); + url.insert(pos, stringify(&petId, "long long")); //TODO: free memory of errormsg, memorystruct MemoryStruct_s* p_chunk = new MemoryStruct_s(); @@ -752,7 +743,7 @@ bool getPetByIdHelper(char * accessToken, bool PetManager::getPetByIdAsync(char * accessToken, - long petId, + long long petId, void(* handler)(Pet, Error, void* ) , void* userData) { @@ -762,7 +753,7 @@ bool PetManager::getPetByIdAsync(char * accessToken, } bool PetManager::getPetByIdSync(char * accessToken, - long petId, + long long petId, void(* handler)(Pet, Error, void* ) , void* userData) { @@ -943,7 +934,7 @@ bool updatePetWithFormProcessor(MemoryStruct_s p_chunk, long code, char* errorms } bool updatePetWithFormHelper(char * accessToken, - long petId, std::string name, std::string status, + long long petId, std::string name, std::string status, void(* handler)(Error, void* ) , void* userData, bool isAsync) { @@ -972,7 +963,7 @@ bool updatePetWithFormHelper(char * accessToken, s_petId.append("}"); pos = url.find(s_petId); url.erase(pos, s_petId.length()); - url.insert(pos, stringify(&petId, "long")); + url.insert(pos, stringify(&petId, "long long")); //TODO: free memory of errormsg, memorystruct MemoryStruct_s* p_chunk = new MemoryStruct_s(); @@ -1020,7 +1011,7 @@ bool updatePetWithFormHelper(char * accessToken, bool PetManager::updatePetWithFormAsync(char * accessToken, - long petId, std::string name, std::string status, + long long petId, std::string name, std::string status, void(* handler)(Error, void* ) , void* userData) { @@ -1030,7 +1021,7 @@ bool PetManager::updatePetWithFormAsync(char * accessToken, } bool PetManager::updatePetWithFormSync(char * accessToken, - long petId, std::string name, std::string status, + long long petId, std::string name, std::string status, void(* handler)(Error, void* ) , void* userData) { @@ -1062,6 +1053,13 @@ bool uploadFileProcessor(MemoryStruct_s p_chunk, long code, char* errormsg, void pJson = json_from_string(data, NULL); jsonToValue(&out, pJson, "ApiResponse", "ApiResponse"); json_node_free(pJson); + + if ("ApiResponse" == "std::string") { + string* val = (std::string*)(&out); + if (val->empty() && p_chunk.size>4) { + *val = string(p_chunk.memory, p_chunk.size); + } + } } else { out.fromJson(data); @@ -1089,7 +1087,7 @@ bool uploadFileProcessor(MemoryStruct_s p_chunk, long code, char* errormsg, void } bool uploadFileHelper(char * accessToken, - long petId, std::string additionalMetadata, std::string file, + long long petId, std::string additionalMetadata, std::string file, void(* handler)(ApiResponse, Error, void* ) , void* userData, bool isAsync) { @@ -1118,7 +1116,7 @@ bool uploadFileHelper(char * accessToken, s_petId.append("}"); pos = url.find(s_petId); url.erase(pos, s_petId.length()); - url.insert(pos, stringify(&petId, "long")); + url.insert(pos, stringify(&petId, "long long")); //TODO: free memory of errormsg, memorystruct MemoryStruct_s* p_chunk = new MemoryStruct_s(); @@ -1166,7 +1164,7 @@ bool uploadFileHelper(char * accessToken, bool PetManager::uploadFileAsync(char * accessToken, - long petId, std::string additionalMetadata, std::string file, + long long petId, std::string additionalMetadata, std::string file, void(* handler)(ApiResponse, Error, void* ) , void* userData) { @@ -1176,7 +1174,7 @@ bool PetManager::uploadFileAsync(char * accessToken, } bool PetManager::uploadFileSync(char * accessToken, - long petId, std::string additionalMetadata, std::string file, + long long petId, std::string additionalMetadata, std::string file, void(* handler)(ApiResponse, Error, void* ) , void* userData) { diff --git a/samples/client/petstore/tizen/src/PetManager.h b/samples/client/petstore/tizen/src/PetManager.h index f596e084a71..12eeb70e572 100644 --- a/samples/client/petstore/tizen/src/PetManager.h +++ b/samples/client/petstore/tizen/src/PetManager.h @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #ifndef _PetManager_H_ #define _PetManager_H_ @@ -21,8 +5,8 @@ #include #include #include -#include "Pet.h" #include "ApiResponse.h" +#include "Pet.h" #include "Error.h" namespace Tizen{ @@ -67,7 +51,7 @@ bool addPetAsync(char * accessToken, * \param userData The user data to be passed to the callback function. */ bool deletePetSync(char * accessToken, - long petId, std::string apiKey, + long long petId, std::string apiKey, void(* handler)(Error, void* ) , void* userData); @@ -81,7 +65,7 @@ bool deletePetSync(char * accessToken, * \param userData The user data to be passed to the callback function. */ bool deletePetAsync(char * accessToken, - long petId, std::string apiKey, + long long petId, std::string apiKey, void(* handler)(Error, void* ) , void* userData); /*! \brief Finds Pets by status. *Synchronous* @@ -143,7 +127,7 @@ bool findPetsByTagsAsync(char * accessToken, * \param userData The user data to be passed to the callback function. */ bool getPetByIdSync(char * accessToken, - long petId, + long long petId, void(* handler)(Pet, Error, void* ) , void* userData); @@ -156,7 +140,7 @@ bool getPetByIdSync(char * accessToken, * \param userData The user data to be passed to the callback function. */ bool getPetByIdAsync(char * accessToken, - long petId, + long long petId, void(* handler)(Pet, Error, void* ) , void* userData); /*! \brief Update an existing pet. *Synchronous* @@ -195,7 +179,7 @@ bool updatePetAsync(char * accessToken, * \param userData The user data to be passed to the callback function. */ bool updatePetWithFormSync(char * accessToken, - long petId, std::string name, std::string status, + long long petId, std::string name, std::string status, void(* handler)(Error, void* ) , void* userData); @@ -210,7 +194,7 @@ bool updatePetWithFormSync(char * accessToken, * \param userData The user data to be passed to the callback function. */ bool updatePetWithFormAsync(char * accessToken, - long petId, std::string name, std::string status, + long long petId, std::string name, std::string status, void(* handler)(Error, void* ) , void* userData); /*! \brief uploads an image. *Synchronous* @@ -224,7 +208,7 @@ bool updatePetWithFormAsync(char * accessToken, * \param userData The user data to be passed to the callback function. */ bool uploadFileSync(char * accessToken, - long petId, std::string additionalMetadata, std::string file, + long long petId, std::string additionalMetadata, std::string file, void(* handler)(ApiResponse, Error, void* ) , void* userData); @@ -239,7 +223,7 @@ bool uploadFileSync(char * accessToken, * \param userData The user data to be passed to the callback function. */ bool uploadFileAsync(char * accessToken, - long petId, std::string additionalMetadata, std::string file, + long long petId, std::string additionalMetadata, std::string file, void(* handler)(ApiResponse, Error, void* ) , void* userData); diff --git a/samples/client/petstore/tizen/src/RequestInfo.h b/samples/client/petstore/tizen/src/RequestInfo.h index 2e84464e199..6424d6c856d 100644 --- a/samples/client/petstore/tizen/src/RequestInfo.h +++ b/samples/client/petstore/tizen/src/RequestInfo.h @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #ifndef _REQUESTINFO_H_ #define _REQUESTINFO_H_ @@ -42,7 +26,7 @@ public: RequestInfo(string host, string path, string method, map queryParams, string mBody, struct curl_slist* headerList, MemoryStruct_s* p_chunk, long* code, - char* errormsg, void* userData, void(* voidHandler)(), + char* errormsg, void* userData, void(* voidHandler)(), bool (*processor)(MemoryStruct_s, long, char*, void*, void(*)())) { this->host = host; @@ -72,7 +56,7 @@ public: if (this->errormsg) { free(this->errormsg); } - + } }; diff --git a/samples/client/petstore/tizen/src/StoreManager.cpp b/samples/client/petstore/tizen/src/StoreManager.cpp index 4ea8a2cdc9f..76ad0e8af5a 100644 --- a/samples/client/petstore/tizen/src/StoreManager.cpp +++ b/samples/client/petstore/tizen/src/StoreManager.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include #include @@ -342,6 +326,13 @@ bool getOrderByIdProcessor(MemoryStruct_s p_chunk, long code, char* errormsg, vo pJson = json_from_string(data, NULL); jsonToValue(&out, pJson, "Order", "Order"); json_node_free(pJson); + + if ("Order" == "std::string") { + string* val = (std::string*)(&out); + if (val->empty() && p_chunk.size>4) { + *val = string(p_chunk.memory, p_chunk.size); + } + } } else { out.fromJson(data); @@ -369,7 +360,7 @@ bool getOrderByIdProcessor(MemoryStruct_s p_chunk, long code, char* errormsg, vo } bool getOrderByIdHelper(char * accessToken, - long orderId, + long long orderId, void(* handler)(Order, Error, void* ) , void* userData, bool isAsync) { @@ -398,7 +389,7 @@ bool getOrderByIdHelper(char * accessToken, s_orderId.append("}"); pos = url.find(s_orderId); url.erase(pos, s_orderId.length()); - url.insert(pos, stringify(&orderId, "long")); + url.insert(pos, stringify(&orderId, "long long")); //TODO: free memory of errormsg, memorystruct MemoryStruct_s* p_chunk = new MemoryStruct_s(); @@ -446,7 +437,7 @@ bool getOrderByIdHelper(char * accessToken, bool StoreManager::getOrderByIdAsync(char * accessToken, - long orderId, + long long orderId, void(* handler)(Order, Error, void* ) , void* userData) { @@ -456,7 +447,7 @@ bool StoreManager::getOrderByIdAsync(char * accessToken, } bool StoreManager::getOrderByIdSync(char * accessToken, - long orderId, + long long orderId, void(* handler)(Order, Error, void* ) , void* userData) { @@ -488,6 +479,13 @@ bool placeOrderProcessor(MemoryStruct_s p_chunk, long code, char* errormsg, void pJson = json_from_string(data, NULL); jsonToValue(&out, pJson, "Order", "Order"); json_node_free(pJson); + + if ("Order" == "std::string") { + string* val = (std::string*)(&out); + if (val->empty() && p_chunk.size>4) { + *val = string(p_chunk.memory, p_chunk.size); + } + } } else { out.fromJson(data); diff --git a/samples/client/petstore/tizen/src/StoreManager.h b/samples/client/petstore/tizen/src/StoreManager.h index 527d128b28c..0d65e46b0de 100644 --- a/samples/client/petstore/tizen/src/StoreManager.h +++ b/samples/client/petstore/tizen/src/StoreManager.h @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #ifndef _StoreManager_H_ #define _StoreManager_H_ @@ -21,8 +5,8 @@ #include #include #include -#include #include "Order.h" +#include #include "Error.h" namespace Tizen{ @@ -89,7 +73,7 @@ bool getInventoryAsync(char * accessToken, * \param userData The user data to be passed to the callback function. */ bool getOrderByIdSync(char * accessToken, - long orderId, + long long orderId, void(* handler)(Order, Error, void* ) , void* userData); @@ -102,7 +86,7 @@ bool getOrderByIdSync(char * accessToken, * \param userData The user data to be passed to the callback function. */ bool getOrderByIdAsync(char * accessToken, - long orderId, + long long orderId, void(* handler)(Order, Error, void* ) , void* userData); /*! \brief Place an order for a pet. *Synchronous* diff --git a/samples/client/petstore/tizen/src/Tag.cpp b/samples/client/petstore/tizen/src/Tag.cpp index e4bf77412a2..d2b2ca7068d 100644 --- a/samples/client/petstore/tizen/src/Tag.cpp +++ b/samples/client/petstore/tizen/src/Tag.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include #include #include @@ -74,8 +58,8 @@ Tag::fromJson(char* jsonStr) if (node !=NULL) { - if (isprimitive("long")) { - jsonToValue(&id, node, "long", ""); + if (isprimitive("long long")) { + jsonToValue(&id, node, "long long", ""); } else { } @@ -103,9 +87,9 @@ Tag::toJson() { JsonObject *pJsonObject = json_object_new(); JsonNode *node; - if (isprimitive("long")) { - long obj = getId(); - node = converttoJson(&obj, "long", ""); + if (isprimitive("long long")) { + long long obj = getId(); + node = converttoJson(&obj, "long long", ""); } else { @@ -129,14 +113,14 @@ Tag::toJson() return ret; } -long +long long Tag::getId() { return id; } void -Tag::setId(long id) +Tag::setId(long long id) { this->id = id; } diff --git a/samples/client/petstore/tizen/src/Tag.h b/samples/client/petstore/tizen/src/Tag.h index 43f1adbdb93..c52192d0147 100644 --- a/samples/client/petstore/tizen/src/Tag.h +++ b/samples/client/petstore/tizen/src/Tag.h @@ -1,23 +1,7 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - /* * Tag.h * - * + * A tag for a pet */ #ifndef _Tag_H_ @@ -31,7 +15,7 @@ namespace Tizen { namespace ArtikCloud { -/*! \brief +/*! \brief A tag for a pet * */ @@ -41,7 +25,7 @@ public: */ Tag(); Tag(char* str); - + /*! \brief Destructor. */ virtual ~Tag(); @@ -56,11 +40,11 @@ public: /*! \brief Get */ - long getId(); + long long getId(); /*! \brief Set */ - void setId(long id); + void setId(long long id); /*! \brief Get */ std::string getName(); @@ -70,11 +54,11 @@ public: void setName(std::string name); private: - long id; + long long id; std::string name; void __init(); void __cleanup(); - + }; } } diff --git a/samples/client/petstore/tizen/src/User.cpp b/samples/client/petstore/tizen/src/User.cpp index a8aa6409100..d570641dde2 100644 --- a/samples/client/petstore/tizen/src/User.cpp +++ b/samples/client/petstore/tizen/src/User.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include #include #include @@ -122,8 +106,8 @@ User::fromJson(char* jsonStr) if (node !=NULL) { - if (isprimitive("long")) { - jsonToValue(&id, node, "long", ""); + if (isprimitive("long long")) { + jsonToValue(&id, node, "long long", ""); } else { } @@ -217,9 +201,9 @@ User::toJson() { JsonObject *pJsonObject = json_object_new(); JsonNode *node; - if (isprimitive("long")) { - long obj = getId(); - node = converttoJson(&obj, "long", ""); + if (isprimitive("long long")) { + long long obj = getId(); + node = converttoJson(&obj, "long long", ""); } else { @@ -297,14 +281,14 @@ User::toJson() return ret; } -long +long long User::getId() { return id; } void -User::setId(long id) +User::setId(long long id) { this->id = id; } diff --git a/samples/client/petstore/tizen/src/User.h b/samples/client/petstore/tizen/src/User.h index 14eb44e6ced..a0b401dda91 100644 --- a/samples/client/petstore/tizen/src/User.h +++ b/samples/client/petstore/tizen/src/User.h @@ -1,23 +1,7 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - /* * User.h * - * + * A User who is purchasing from the pet store */ #ifndef _User_H_ @@ -31,7 +15,7 @@ namespace Tizen { namespace ArtikCloud { -/*! \brief +/*! \brief A User who is purchasing from the pet store * */ @@ -41,7 +25,7 @@ public: */ User(); User(char* str); - + /*! \brief Destructor. */ virtual ~User(); @@ -56,11 +40,11 @@ public: /*! \brief Get */ - long getId(); + long long getId(); /*! \brief Set */ - void setId(long id); + void setId(long long id); /*! \brief Get */ std::string getUsername(); @@ -112,7 +96,7 @@ public: void setUserStatus(int userStatus); private: - long id; + long long id; std::string username; std::string firstName; std::string lastName; @@ -122,7 +106,7 @@ private: int userStatus; void __init(); void __cleanup(); - + }; } } diff --git a/samples/client/petstore/tizen/src/UserManager.cpp b/samples/client/petstore/tizen/src/UserManager.cpp index 3966174e184..389033e8592 100644 --- a/samples/client/petstore/tizen/src/UserManager.cpp +++ b/samples/client/petstore/tizen/src/UserManager.cpp @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #include #include @@ -652,6 +636,13 @@ bool getUserByNameProcessor(MemoryStruct_s p_chunk, long code, char* errormsg, v pJson = json_from_string(data, NULL); jsonToValue(&out, pJson, "User", "User"); json_node_free(pJson); + + if ("User" == "std::string") { + string* val = (std::string*)(&out); + if (val->empty() && p_chunk.size>4) { + *val = string(p_chunk.memory, p_chunk.size); + } + } } else { out.fromJson(data); @@ -798,6 +789,13 @@ bool loginUserProcessor(MemoryStruct_s p_chunk, long code, char* errormsg, void* pJson = json_from_string(data, NULL); jsonToValue(&out, pJson, "std::string", "std::string"); json_node_free(pJson); + + if ("std::string" == "std::string") { + string* val = (std::string*)(&out); + if (val->empty() && p_chunk.size>4) { + *val = string(p_chunk.memory, p_chunk.size); + } + } } else { } diff --git a/samples/client/petstore/tizen/src/UserManager.h b/samples/client/petstore/tizen/src/UserManager.h index 0e8706909f0..01c1a45368f 100644 --- a/samples/client/petstore/tizen/src/UserManager.h +++ b/samples/client/petstore/tizen/src/UserManager.h @@ -1,19 +1,3 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - #ifndef _UserManager_H_ #define _UserManager_H_ diff --git a/samples/client/petstore/typescript-angular2/npm/README.md b/samples/client/petstore/typescript-angular2/npm/README.md index b320f559464..b46649ebbcd 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.201702102323 +## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201703131805 ### 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.201702102323 --save +npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201703131805 --save ``` _unPublished (not recommended):_ diff --git a/samples/client/petstore/typescript-angular2/npm/package.json b/samples/client/petstore/typescript-angular2/npm/package.json index 1e14f0fb963..1665b2f9743 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.201702102323", + "version": "0.0.1-SNAPSHOT.201703131805", "description": "swagger client for @swagger/angular2-typescript-petstore", "author": "Swagger Codegen Contributors", "keywords": [ diff --git a/samples/client/petstore/typescript-fetch/builds/default/api.ts b/samples/client/petstore/typescript-fetch/builds/default/api.ts index 44cf16e2023..f873efb26ff 100644 --- a/samples/client/petstore/typescript-fetch/builds/default/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/default/api.ts @@ -134,7 +134,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -171,7 +171,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; fetchOptions.headers = assign({ "api_key": params["apiKey"], }, contentTypeHeader); @@ -205,7 +205,7 @@ export const PetApiFetchParamCreator = { }); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -239,7 +239,7 @@ export const PetApiFetchParamCreator = { }); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -271,7 +271,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -301,7 +301,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "PUT" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -339,7 +339,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; fetchOptions.body = querystring.stringify({ "name": params["name"], @@ -378,7 +378,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; fetchOptions.body = querystring.stringify({ "additionalMetadata": params["additionalMetadata"], @@ -721,7 +721,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -740,7 +740,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -771,7 +771,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -795,7 +795,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -979,7 +979,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -1007,7 +1007,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -1035,7 +1035,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -1064,7 +1064,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1089,7 +1089,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1122,7 +1122,7 @@ export const UserApiFetchParamCreator = { }); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1141,7 +1141,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1171,7 +1171,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "PUT" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts b/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts index 3d57ce98ffc..311fc40b097 100644 --- a/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/es6-target/api.ts @@ -133,7 +133,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -170,7 +170,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "DELETE" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; fetchOptions.headers = Object.assign({ "api_key": params["apiKey"], }, contentTypeHeader); @@ -204,7 +204,7 @@ export const PetApiFetchParamCreator = { }); let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -238,7 +238,7 @@ export const PetApiFetchParamCreator = { }); let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -270,7 +270,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -300,7 +300,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "PUT" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -338,7 +338,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; fetchOptions.body = querystring.stringify({ "name": params["name"], @@ -377,7 +377,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; fetchOptions.body = querystring.stringify({ "additionalMetadata": params["additionalMetadata"], @@ -720,7 +720,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "DELETE" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -739,7 +739,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -770,7 +770,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -794,7 +794,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -978,7 +978,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -1006,7 +1006,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -1034,7 +1034,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -1063,7 +1063,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "DELETE" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1088,7 +1088,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1121,7 +1121,7 @@ export const UserApiFetchParamCreator = { }); let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1140,7 +1140,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1170,7 +1170,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = Object.assign({}, { method: "PUT" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); diff --git a/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts b/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts index 44cf16e2023..f873efb26ff 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-npm-version/api.ts @@ -134,7 +134,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -171,7 +171,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; fetchOptions.headers = assign({ "api_key": params["apiKey"], }, contentTypeHeader); @@ -205,7 +205,7 @@ export const PetApiFetchParamCreator = { }); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -239,7 +239,7 @@ export const PetApiFetchParamCreator = { }); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -271,7 +271,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -301,7 +301,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "PUT" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -339,7 +339,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; fetchOptions.body = querystring.stringify({ "name": params["name"], @@ -378,7 +378,7 @@ export const PetApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/x-www-form-urlencoded" }; fetchOptions.body = querystring.stringify({ "additionalMetadata": params["additionalMetadata"], @@ -721,7 +721,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -740,7 +740,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -771,7 +771,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -795,7 +795,7 @@ export const StoreApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -979,7 +979,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -1007,7 +1007,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -1035,7 +1035,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "POST" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); @@ -1064,7 +1064,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "DELETE" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1089,7 +1089,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1122,7 +1122,7 @@ export const UserApiFetchParamCreator = { }); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1141,7 +1141,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "GET" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; if (contentTypeHeader) { fetchOptions.headers = contentTypeHeader; } @@ -1171,7 +1171,7 @@ export const UserApiFetchParamCreator = { let urlObj = url.parse(baseUrl, true); let fetchOptions: RequestInit = assign({}, { method: "PUT" }, options); - let contentTypeHeader: Dictionary; + let contentTypeHeader: Dictionary = {}; contentTypeHeader = { "Content-Type": "application/json" }; if (params["body"]) { fetchOptions.body = JSON.stringify(params["body"] || {}); diff --git a/samples/dynamic-html/.swagger-codegen-ignore b/samples/dynamic-html/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/dynamic-html/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/dynamic-html/docs/models/ApiResponse.html b/samples/dynamic-html/docs/models/ApiResponse.html index 8e7d4fa4785..fd457140380 100644 --- a/samples/dynamic-html/docs/models/ApiResponse.html +++ b/samples/dynamic-html/docs/models/ApiResponse.html @@ -1,17 +1,17 @@

ApiResponse

    -
  • code : Integer +
  • code : Integer
    -
  • type : String +
  • type : String
    -
  • message : String +
  • message : String
diff --git a/samples/dynamic-html/docs/models/Category.html b/samples/dynamic-html/docs/models/Category.html index 3c6da307af8..05f599edf39 100644 --- a/samples/dynamic-html/docs/models/Category.html +++ b/samples/dynamic-html/docs/models/Category.html @@ -1,12 +1,12 @@

Category

    -
  • id : Long +
  • id : Long
    -
  • name : String +
  • name : String
diff --git a/samples/dynamic-html/docs/models/Order.html b/samples/dynamic-html/docs/models/Order.html index 63d480f3e83..9a503647068 100644 --- a/samples/dynamic-html/docs/models/Order.html +++ b/samples/dynamic-html/docs/models/Order.html @@ -1,27 +1,27 @@

Order

    -
  • id : Long +
  • id : Long
    -
  • petId : Long +
  • petId : Long
    -
  • quantity : Integer +
  • quantity : Integer
    -
  • shipDate : Date +
  • shipDate : Date
    -
  • status : String +
  • status : String
    Order Status
    Enum: @@ -33,7 +33,7 @@
    -
  • complete : Boolean +
  • complete : Boolean
diff --git a/samples/dynamic-html/docs/models/Pet.html b/samples/dynamic-html/docs/models/Pet.html index e7adb8a05a0..2e7de709d87 100644 --- a/samples/dynamic-html/docs/models/Pet.html +++ b/samples/dynamic-html/docs/models/Pet.html @@ -1,12 +1,12 @@

Pet

    -
  • id : Long +
  • id : Long
    -
  • category : Category +
  • category : Category
@@ -21,12 +21,12 @@
    -
  • tags : List +
  • tags : List
    -
  • status : String +
  • status : String
    pet status in the store
    Enum: diff --git a/samples/dynamic-html/docs/models/Tag.html b/samples/dynamic-html/docs/models/Tag.html index a62d2f0128b..4560d4c8ed4 100644 --- a/samples/dynamic-html/docs/models/Tag.html +++ b/samples/dynamic-html/docs/models/Tag.html @@ -1,12 +1,12 @@

    Tag

      -
    • id : Long +
    • id : Long
      -
    • name : String +
    • name : String
    diff --git a/samples/dynamic-html/docs/models/User.html b/samples/dynamic-html/docs/models/User.html index 4659f77f8f4..4a5610b1af2 100644 --- a/samples/dynamic-html/docs/models/User.html +++ b/samples/dynamic-html/docs/models/User.html @@ -1,42 +1,42 @@

    User

      -
    • id : Long +
    • id : Long
      -
    • username : String +
    • username : String
      -
    • firstName : String +
    • firstName : String
      -
    • lastName : String +
    • lastName : String
      -
    • email : String +
    • email : String
      -
    • password : String +
    • password : String
      -
    • phone : String +
    • phone : String
      -
    • userStatus : Integer +
    • userStatus : Integer
      User Status
    diff --git a/samples/dynamic-html/docs/operations/PetApi.html b/samples/dynamic-html/docs/operations/PetApi.html index cf11a3814dc..b1fd0c7d62c 100644 --- a/samples/dynamic-html/docs/operations/PetApi.html +++ b/samples/dynamic-html/docs/operations/PetApi.html @@ -244,7 +244,7 @@ file - file + File

    file to upload

  • diff --git a/samples/html/index.html b/samples/html/index.html index 60e62451c1c..2230ecbbfd4 100644 --- a/samples/html/index.html +++ b/samples/html/index.html @@ -344,14 +344,14 @@ font-style: italic;

    Example data

    Content-Type: application/xml
    
    -  123456
    +  123456789
       doggie
       
    -    string
    +    aeiou
       
       
       
    -  string
    +  aeiou
     

    Example data

    Content-Type: application/json
    @@ -417,14 +417,14 @@ font-style: italic;

    Example data

    Content-Type: application/xml
    
    -  123456
    +  123456789
       doggie
       
    -    string
    +    aeiou
       
       
       
    -  string
    +  aeiou
     

    Example data

    Content-Type: application/json
    @@ -490,14 +490,14 @@ font-style: italic;

    Example data

    Content-Type: application/xml
    
    -  123456
    +  123456789
       doggie
       
    -    string
    +    aeiou
       
       
       
    -  string
    +  aeiou
     

    Example data

    Content-Type: application/json
    @@ -808,11 +808,11 @@ font-style: italic;

    Example data

    Content-Type: application/xml
    
    -  123456
    -  123456
    -  0
    +  123456789
    +  123456789
    +  123
       2000-01-23T04:56:07.000Z
    -  string
    +  aeiou
       true
     

    Example data

    @@ -877,11 +877,11 @@ font-style: italic;

    Example data

    Content-Type: application/xml
    
    -  123456
    -  123456
    -  0
    +  123456789
    +  123456789
    +  123
       2000-01-23T04:56:07.000Z
    -  string
    +  aeiou
       true
     

    Example data

    @@ -1097,14 +1097,14 @@ font-style: italic;

    Example data

    Content-Type: application/xml
    
    -  123456
    -  string
    -  string
    -  string
    -  string
    -  string
    -  string
    -  0
    +  123456789
    +  aeiou
    +  aeiou
    +  aeiou
    +  aeiou
    +  aeiou
    +  aeiou
    +  123
     

    Example data

    Content-Type: application/json
    @@ -1170,7 +1170,7 @@ font-style: italic;

    Example data

    Content-Type: application/xml
    -
    string
    +
    aeiou

    Example data

    Content-Type: application/json
    "aeiou"
    diff --git a/samples/html2/index.html b/samples/html2/index.html index bec62b55586..3e8795ff115 100644 --- a/samples/html2/index.html +++ b/samples/html2/index.html @@ -1555,7 +1555,7 @@ except ApiException as e: Name Description - apiKey + api_key @@ -4482,8 +4482,8 @@ except ApiException as e: "description" : "ID of pet that needs to be fetched", "required" : true, "type" : "integer", - "maximum" : 5.0, - "minimum" : 1.0, + "maximum" : 5, + "minimum" : 1, "format" : "int64" }; var schema = schemaWrapper; @@ -7112,7 +7112,7 @@ except ApiException as e:
    - Generated 2017-01-24T11:58:21.560-05:00 + Generated 2017-03-13T18:03:30.112+01:00
    diff --git a/samples/server/petstore/aspnetcore/IO.Swagger.sln b/samples/server/petstore/aspnetcore/IO.Swagger.sln index 866d0d2802c..4b5556c3c4e 100644 --- a/samples/server/petstore/aspnetcore/IO.Swagger.sln +++ b/samples/server/petstore/aspnetcore/IO.Swagger.sln @@ -7,7 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution global.json = global.json EndProjectSection EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.xproj", "{795C6B14-1C3E-45F5-AF6F-EE47B197FF1E}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.xproj", "{94E80C7B-1E0B-4A99-9EDC-AA6CADE4B45A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,10 +15,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {795C6B14-1C3E-45F5-AF6F-EE47B197FF1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {795C6B14-1C3E-45F5-AF6F-EE47B197FF1E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {795C6B14-1C3E-45F5-AF6F-EE47B197FF1E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {795C6B14-1C3E-45F5-AF6F-EE47B197FF1E}.Release|Any CPU.Build.0 = Release|Any CPU + {94E80C7B-1E0B-4A99-9EDC-AA6CADE4B45A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {94E80C7B-1E0B-4A99-9EDC-AA6CADE4B45A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {94E80C7B-1E0B-4A99-9EDC-AA6CADE4B45A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {94E80C7B-1E0B-4A99-9EDC-AA6CADE4B45A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/samples/server/petstore/aspnetcore/global.json b/samples/server/petstore/aspnetcore/global.json index ac4c4297ab6..175b2d57e38 100644 --- a/samples/server/petstore/aspnetcore/global.json +++ b/samples/server/petstore/aspnetcore/global.json @@ -1,7 +1,7 @@ { "projects": [ "src" ], "sdk": { - "version": "1.0.0-preview3-003171", + "version": "1.0.0-preview2-003121", "runtime": "coreclr" } } \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore/src/IO.Swagger/IO.Swagger.xproj b/samples/server/petstore/aspnetcore/src/IO.Swagger/IO.Swagger.xproj index 577ab91b009..c22ef91d084 100644 --- a/samples/server/petstore/aspnetcore/src/IO.Swagger/IO.Swagger.xproj +++ b/samples/server/petstore/aspnetcore/src/IO.Swagger/IO.Swagger.xproj @@ -6,7 +6,7 @@ - {795C6B14-1C3E-45F5-AF6F-EE47B197FF1E} + {94E80C7B-1E0B-4A99-9EDC-AA6CADE4B45A} IO.Swagger .\obj .\bin\ diff --git a/samples/server/petstore/erlang-server/priv/swagger.json b/samples/server/petstore/erlang-server/priv/swagger.json index de3bdd27a50..5b7ec78cf5a 100644 --- a/samples/server/petstore/erlang-server/priv/swagger.json +++ b/samples/server/petstore/erlang-server/priv/swagger.json @@ -1 +1 @@ -{"swagger":"2.0","info":{"description":"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.","version":"1.0.0","title":"Swagger Petstore","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"host":"petstore.swagger.io","basePath":"/v2","tags":[{"name":"pet","description":"Everything about your Pets","externalDocs":{"description":"Find out more","url":"http://swagger.io"}},{"name":"store","description":"Access to Petstore orders"},{"name":"user","description":"Operations about user","externalDocs":{"description":"Find out more about our store","url":"http://swagger.io"}}],"schemes":["http"],"paths":{"/pet":{"post":{"tags":["pet"],"summary":"Add a new pet to the store","description":"","operationId":"addPet","consumes":["application/json","application/xml"],"produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Pet object that needs to be added to the store","required":true,"schema":{"$ref":"#/definitions/Pet"}}],"responses":{"405":{"description":"Invalid input"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]},"put":{"tags":["pet"],"summary":"Update an existing pet","description":"","operationId":"updatePet","consumes":["application/json","application/xml"],"produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Pet object that needs to be added to the store","required":true,"schema":{"$ref":"#/definitions/Pet"}}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Pet not found"},"405":{"description":"Validation exception"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/findByStatus":{"get":{"tags":["pet"],"summary":"Finds Pets by status","description":"Multiple status values can be provided with comma separated strings","operationId":"findPetsByStatus","produces":["application/xml","application/json"],"parameters":[{"name":"status","in":"query","description":"Status values that need to be considered for filter","required":true,"type":"array","items":{"type":"string","default":"available","enum":["available","pending","sold"]},"collectionFormat":"csv"}],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/Pet"}}},"400":{"description":"Invalid status value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/findByTags":{"get":{"tags":["pet"],"summary":"Finds Pets by tags","description":"Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.","operationId":"findPetsByTags","produces":["application/xml","application/json"],"parameters":[{"name":"tags","in":"query","description":"Tags to filter by","required":true,"type":"array","items":{"type":"string"},"collectionFormat":"csv"}],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/Pet"}}},"400":{"description":"Invalid tag value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/{petId}":{"get":{"tags":["pet"],"summary":"Find pet by ID","description":"Returns a single pet","operationId":"getPetById","produces":["application/xml","application/json"],"parameters":[{"name":"petId","in":"path","description":"ID of pet to return","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/Pet"}},"400":{"description":"Invalid ID supplied"},"404":{"description":"Pet not found"}},"security":[{"api_key":[]}]},"post":{"tags":["pet"],"summary":"Updates a pet in the store with form data","description":"","operationId":"updatePetWithForm","consumes":["application/x-www-form-urlencoded"],"produces":["application/xml","application/json"],"parameters":[{"name":"petId","in":"path","description":"ID of pet that needs to be updated","required":true,"type":"integer","format":"int64"},{"name":"name","in":"formData","description":"Updated name of the pet","required":false,"type":"string"},{"name":"status","in":"formData","description":"Updated status of the pet","required":false,"type":"string"}],"responses":{"405":{"description":"Invalid input"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]},"delete":{"tags":["pet"],"summary":"Deletes a pet","description":"","operationId":"deletePet","produces":["application/xml","application/json"],"parameters":[{"name":"api_key","in":"header","required":false,"type":"string"},{"name":"petId","in":"path","description":"Pet id to delete","required":true,"type":"integer","format":"int64"}],"responses":{"400":{"description":"Invalid pet value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/{petId}/uploadImage":{"post":{"tags":["pet"],"summary":"uploads an image","description":"","operationId":"uploadFile","consumes":["multipart/form-data"],"produces":["application/json"],"parameters":[{"name":"petId","in":"path","description":"ID of pet to update","required":true,"type":"integer","format":"int64"},{"name":"additionalMetadata","in":"formData","description":"Additional data to pass to server","required":false,"type":"string"},{"name":"file","in":"formData","description":"file to upload","required":false,"type":"file"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiResponse"}}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/store/inventory":{"get":{"tags":["store"],"summary":"Returns pet inventories by status","description":"Returns a map of status codes to quantities","operationId":"getInventory","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"object","additionalProperties":{"type":"integer","format":"int32"}}}},"security":[{"api_key":[]}]}},"/store/order":{"post":{"tags":["store"],"summary":"Place an order for a pet","description":"","operationId":"placeOrder","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"order placed for purchasing the pet","required":true,"schema":{"$ref":"#/definitions/Order"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/Order"}},"400":{"description":"Invalid Order"}}}},"/store/order/{orderId}":{"get":{"tags":["store"],"summary":"Find purchase order by ID","description":"For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions","operationId":"getOrderById","produces":["application/xml","application/json"],"parameters":[{"name":"orderId","in":"path","description":"ID of pet that needs to be fetched","required":true,"type":"integer","maximum":5.0,"minimum":1.0,"format":"int64"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/Order"}},"400":{"description":"Invalid ID supplied"},"404":{"description":"Order not found"}}},"delete":{"tags":["store"],"summary":"Delete purchase order by ID","description":"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors","operationId":"deleteOrder","produces":["application/xml","application/json"],"parameters":[{"name":"orderId","in":"path","description":"ID of the order that needs to be deleted","required":true,"type":"string","minimum":1.0}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Order not found"}}}},"/user":{"post":{"tags":["user"],"summary":"Create user","description":"This can only be done by the logged in user.","operationId":"createUser","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Created user object","required":true,"schema":{"$ref":"#/definitions/User"}}],"responses":{"default":{"description":"successful operation"}}}},"/user/createWithArray":{"post":{"tags":["user"],"summary":"Creates list of users with given input array","description":"","operationId":"createUsersWithArrayInput","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"List of user object","required":true,"schema":{"type":"array","items":{"$ref":"#/definitions/User"}}}],"responses":{"default":{"description":"successful operation"}}}},"/user/createWithList":{"post":{"tags":["user"],"summary":"Creates list of users with given input array","description":"","operationId":"createUsersWithListInput","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"List of user object","required":true,"schema":{"type":"array","items":{"$ref":"#/definitions/User"}}}],"responses":{"default":{"description":"successful operation"}}}},"/user/login":{"get":{"tags":["user"],"summary":"Logs user into the system","description":"","operationId":"loginUser","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"query","description":"The user name for login","required":true,"type":"string"},{"name":"password","in":"query","description":"The password for login in clear text","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"type":"string"},"headers":{"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"},"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when toekn expires"}}},"400":{"description":"Invalid username/password supplied"}}}},"/user/logout":{"get":{"tags":["user"],"summary":"Logs out current logged in user session","description":"","operationId":"logoutUser","produces":["application/xml","application/json"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}},"/user/{username}":{"get":{"tags":["user"],"summary":"Get user by user name","description":"","operationId":"getUserByName","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"path","description":"The name that needs to be fetched. Use user1 for testing. ","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/User"}},"400":{"description":"Invalid username supplied"},"404":{"description":"User not found"}}},"put":{"tags":["user"],"summary":"Updated user","description":"This can only be done by the logged in user.","operationId":"updateUser","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"path","description":"name that need to be deleted","required":true,"type":"string"},{"in":"body","name":"body","description":"Updated user object","required":true,"schema":{"$ref":"#/definitions/User"}}],"responses":{"400":{"description":"Invalid user supplied"},"404":{"description":"User not found"}}},"delete":{"tags":["user"],"summary":"Delete user","description":"This can only be done by the logged in user.","operationId":"deleteUser","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"path","description":"The name that needs to be deleted","required":true,"type":"string"}],"responses":{"400":{"description":"Invalid username supplied"},"404":{"description":"User not found"}}}}},"securityDefinitions":{"api_key":{"type":"apiKey","name":"api_key","in":"header"},"petstore_auth":{"type":"oauth2","authorizationUrl":"http://petstore.swagger.io/api/oauth/dialog","flow":"implicit","scopes":{"write:pets":"modify pets in your account","read:pets":"read your pets"}}},"definitions":{"Order":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"petId":{"type":"integer","format":"int64"},"quantity":{"type":"integer","format":"int32"},"shipDate":{"type":"string","format":"date-time"},"status":{"type":"string","description":"Order Status","enum":["placed","approved","delivered"]},"complete":{"type":"boolean","default":false}},"xml":{"name":"Order"}},"Category":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}},"xml":{"name":"Category"}},"User":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"username":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"phone":{"type":"string"},"userStatus":{"type":"integer","format":"int32","description":"User Status"}},"xml":{"name":"User"}},"Tag":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}},"xml":{"name":"Tag"}},"Pet":{"type":"object","required":["name","photoUrls"],"properties":{"id":{"type":"integer","format":"int64"},"category":{"$ref":"#/definitions/Category"},"name":{"type":"string","example":"doggie"},"photoUrls":{"type":"array","xml":{"name":"photoUrl","wrapped":true},"items":{"type":"string"}},"tags":{"type":"array","xml":{"name":"tag","wrapped":true},"items":{"$ref":"#/definitions/Tag"}},"status":{"type":"string","description":"pet status in the store","enum":["available","pending","sold"]}},"xml":{"name":"Pet"}},"ApiResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"type":{"type":"string"},"message":{"type":"string"}}}},"externalDocs":{"description":"Find out more about Swagger","url":"http://swagger.io"}} +{"swagger":"2.0","info":{"description":"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.","version":"1.0.0","title":"Swagger Petstore","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"host":"petstore.swagger.io","basePath":"/v2","tags":[{"name":"pet","description":"Everything about your Pets","externalDocs":{"description":"Find out more","url":"http://swagger.io"}},{"name":"store","description":"Access to Petstore orders"},{"name":"user","description":"Operations about user","externalDocs":{"description":"Find out more about our store","url":"http://swagger.io"}}],"schemes":["http"],"paths":{"/pet":{"post":{"tags":["pet"],"summary":"Add a new pet to the store","description":"","operationId":"addPet","consumes":["application/json","application/xml"],"produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Pet object that needs to be added to the store","required":true,"schema":{"$ref":"#/definitions/Pet"}}],"responses":{"405":{"description":"Invalid input"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]},"put":{"tags":["pet"],"summary":"Update an existing pet","description":"","operationId":"updatePet","consumes":["application/json","application/xml"],"produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Pet object that needs to be added to the store","required":true,"schema":{"$ref":"#/definitions/Pet"}}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Pet not found"},"405":{"description":"Validation exception"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/findByStatus":{"get":{"tags":["pet"],"summary":"Finds Pets by status","description":"Multiple status values can be provided with comma separated strings","operationId":"findPetsByStatus","produces":["application/xml","application/json"],"parameters":[{"name":"status","in":"query","description":"Status values that need to be considered for filter","required":true,"type":"array","items":{"type":"string","enum":["available","pending","sold"],"default":"available"},"collectionFormat":"csv"}],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/Pet"}}},"400":{"description":"Invalid status value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/findByTags":{"get":{"tags":["pet"],"summary":"Finds Pets by tags","description":"Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.","operationId":"findPetsByTags","produces":["application/xml","application/json"],"parameters":[{"name":"tags","in":"query","description":"Tags to filter by","required":true,"type":"array","items":{"type":"string"},"collectionFormat":"csv"}],"responses":{"200":{"description":"successful operation","schema":{"type":"array","items":{"$ref":"#/definitions/Pet"}}},"400":{"description":"Invalid tag value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/{petId}":{"get":{"tags":["pet"],"summary":"Find pet by ID","description":"Returns a single pet","operationId":"getPetById","produces":["application/xml","application/json"],"parameters":[{"name":"petId","in":"path","description":"ID of pet to return","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/Pet"}},"400":{"description":"Invalid ID supplied"},"404":{"description":"Pet not found"}},"security":[{"api_key":[]}]},"post":{"tags":["pet"],"summary":"Updates a pet in the store with form data","description":"","operationId":"updatePetWithForm","consumes":["application/x-www-form-urlencoded"],"produces":["application/xml","application/json"],"parameters":[{"name":"petId","in":"path","description":"ID of pet that needs to be updated","required":true,"type":"integer","format":"int64"},{"name":"name","in":"formData","description":"Updated name of the pet","required":false,"type":"string"},{"name":"status","in":"formData","description":"Updated status of the pet","required":false,"type":"string"}],"responses":{"405":{"description":"Invalid input"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]},"delete":{"tags":["pet"],"summary":"Deletes a pet","description":"","operationId":"deletePet","produces":["application/xml","application/json"],"parameters":[{"name":"api_key","in":"header","required":false,"type":"string"},{"name":"petId","in":"path","description":"Pet id to delete","required":true,"type":"integer","format":"int64"}],"responses":{"400":{"description":"Invalid pet value"}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/pet/{petId}/uploadImage":{"post":{"tags":["pet"],"summary":"uploads an image","description":"","operationId":"uploadFile","consumes":["multipart/form-data"],"produces":["application/json"],"parameters":[{"name":"petId","in":"path","description":"ID of pet to update","required":true,"type":"integer","format":"int64"},{"name":"additionalMetadata","in":"formData","description":"Additional data to pass to server","required":false,"type":"string"},{"name":"file","in":"formData","description":"file to upload","required":false,"type":"file"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/ApiResponse"}}},"security":[{"petstore_auth":["write:pets","read:pets"]}]}},"/store/inventory":{"get":{"tags":["store"],"summary":"Returns pet inventories by status","description":"Returns a map of status codes to quantities","operationId":"getInventory","produces":["application/json"],"parameters":[],"responses":{"200":{"description":"successful operation","schema":{"type":"object","additionalProperties":{"type":"integer","format":"int32"}}}},"security":[{"api_key":[]}]}},"/store/order":{"post":{"tags":["store"],"summary":"Place an order for a pet","description":"","operationId":"placeOrder","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"order placed for purchasing the pet","required":true,"schema":{"$ref":"#/definitions/Order"}}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/Order"}},"400":{"description":"Invalid Order"}}}},"/store/order/{orderId}":{"get":{"tags":["store"],"summary":"Find purchase order by ID","description":"For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions","operationId":"getOrderById","produces":["application/xml","application/json"],"parameters":[{"name":"orderId","in":"path","description":"ID of pet that needs to be fetched","required":true,"type":"integer","maximum":5,"minimum":1,"format":"int64"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/Order"}},"400":{"description":"Invalid ID supplied"},"404":{"description":"Order not found"}}},"delete":{"tags":["store"],"summary":"Delete purchase order by ID","description":"For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors","operationId":"deleteOrder","produces":["application/xml","application/json"],"parameters":[{"name":"orderId","in":"path","description":"ID of the order that needs to be deleted","required":true,"type":"string"}],"responses":{"400":{"description":"Invalid ID supplied"},"404":{"description":"Order not found"}}}},"/user":{"post":{"tags":["user"],"summary":"Create user","description":"This can only be done by the logged in user.","operationId":"createUser","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"Created user object","required":true,"schema":{"$ref":"#/definitions/User"}}],"responses":{"default":{"description":"successful operation"}}}},"/user/createWithArray":{"post":{"tags":["user"],"summary":"Creates list of users with given input array","description":"","operationId":"createUsersWithArrayInput","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"List of user object","required":true,"schema":{"type":"array","items":{"$ref":"#/definitions/User"}}}],"responses":{"default":{"description":"successful operation"}}}},"/user/createWithList":{"post":{"tags":["user"],"summary":"Creates list of users with given input array","description":"","operationId":"createUsersWithListInput","produces":["application/xml","application/json"],"parameters":[{"in":"body","name":"body","description":"List of user object","required":true,"schema":{"type":"array","items":{"$ref":"#/definitions/User"}}}],"responses":{"default":{"description":"successful operation"}}}},"/user/login":{"get":{"tags":["user"],"summary":"Logs user into the system","description":"","operationId":"loginUser","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"query","description":"The user name for login","required":true,"type":"string"},{"name":"password","in":"query","description":"The password for login in clear text","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"type":"string"},"headers":{"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"},"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when toekn expires"}}},"400":{"description":"Invalid username/password supplied"}}}},"/user/logout":{"get":{"tags":["user"],"summary":"Logs out current logged in user session","description":"","operationId":"logoutUser","produces":["application/xml","application/json"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}},"/user/{username}":{"get":{"tags":["user"],"summary":"Get user by user name","description":"","operationId":"getUserByName","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"path","description":"The name that needs to be fetched. Use user1 for testing. ","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","schema":{"$ref":"#/definitions/User"}},"400":{"description":"Invalid username supplied"},"404":{"description":"User not found"}}},"put":{"tags":["user"],"summary":"Updated user","description":"This can only be done by the logged in user.","operationId":"updateUser","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"path","description":"name that need to be deleted","required":true,"type":"string"},{"in":"body","name":"body","description":"Updated user object","required":true,"schema":{"$ref":"#/definitions/User"}}],"responses":{"400":{"description":"Invalid user supplied"},"404":{"description":"User not found"}}},"delete":{"tags":["user"],"summary":"Delete user","description":"This can only be done by the logged in user.","operationId":"deleteUser","produces":["application/xml","application/json"],"parameters":[{"name":"username","in":"path","description":"The name that needs to be deleted","required":true,"type":"string"}],"responses":{"400":{"description":"Invalid username supplied"},"404":{"description":"User not found"}}}}},"securityDefinitions":{"petstore_auth":{"type":"oauth2","authorizationUrl":"http://petstore.swagger.io/api/oauth/dialog","flow":"implicit","scopes":{"write:pets":"modify pets in your account","read:pets":"read your pets"}},"api_key":{"type":"apiKey","name":"api_key","in":"header"}},"definitions":{"Order":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"petId":{"type":"integer","format":"int64"},"quantity":{"type":"integer","format":"int32"},"shipDate":{"type":"string","format":"date-time"},"status":{"type":"string","description":"Order Status","enum":["placed","approved","delivered"]},"complete":{"type":"boolean","default":false}},"title":"Pet Order","description":"An order for a pets from the pet store","xml":{"name":"Order"}},"Category":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}},"title":"Pet catehgry","description":"A category for a pet","xml":{"name":"Category"}},"User":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"username":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"phone":{"type":"string"},"userStatus":{"type":"integer","format":"int32","description":"User Status"}},"title":"a User","description":"A User who is purchasing from the pet store","xml":{"name":"User"}},"Tag":{"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"}},"title":"Pet Tag","description":"A tag for a pet","xml":{"name":"Tag"}},"Pet":{"type":"object","required":["name","photoUrls"],"properties":{"id":{"type":"integer","format":"int64"},"category":{"$ref":"#/definitions/Category"},"name":{"type":"string","example":"doggie"},"photoUrls":{"type":"array","xml":{"name":"photoUrl","wrapped":true},"items":{"type":"string"}},"tags":{"type":"array","xml":{"name":"tag","wrapped":true},"items":{"$ref":"#/definitions/Tag"}},"status":{"type":"string","description":"pet status in the store","enum":["available","pending","sold"]}},"title":"a Pet","description":"A pet for sale in the pet store","xml":{"name":"Pet"}},"ApiResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"type":{"type":"string"},"message":{"type":"string"}},"title":"An uploaded response","description":"Describes the result of uploading an image resource"}},"externalDocs":{"description":"Find out more about Swagger","url":"http://swagger.io"}} diff --git a/samples/server/petstore/erlang-server/src/swagger_api.erl b/samples/server/petstore/erlang-server/src/swagger_api.erl index b3020fbbf69..2fbc055ad08 100644 --- a/samples/server/petstore/erlang-server/src/swagger_api.erl +++ b/samples/server/petstore/erlang-server/src/swagger_api.erl @@ -271,7 +271,6 @@ request_param_info('DeleteOrder', 'orderId') -> source => binding , rules => [ {type, 'binary'}, - {min, 1.0 }, required ] }; @@ -281,8 +280,8 @@ request_param_info('GetOrderById', 'orderId') -> source => binding , rules => [ {type, 'integer'}, - {max, 5.0 }, - {min, 1.0 }, + {max, 5 }, + {min, 1 }, required ] }; diff --git a/samples/server/petstore/finch/src/main/scala/DataAccessor.scala b/samples/server/petstore/finch/src/main/scala/DataAccessor.scala index bcbd036637c..83aa56a1468 100644 --- a/samples/server/petstore/finch/src/main/scala/DataAccessor.scala +++ b/samples/server/petstore/finch/src/main/scala/DataAccessor.scala @@ -7,127 +7,127 @@ import java.util.Date import io.swagger.petstore.models._ trait DataAccessor { - // TODO: apiInfo -> apis -> operations = ??? - // NOTE: ??? throws a not implemented exception + // TODO: apiInfo -> apis -> operations = ??? + // NOTE: ??? throws a not implemented exception - /** - * - * @return A Unit - */ - def Pet_addPet(body: Pet): Unit = ??? + /** + * + * @return A Unit + */ + def Pet_addPet(body: Pet): Unit = ??? - /** - * - * @return A Unit - */ - def Pet_deletePet(petId: Long, apiKey: String): Unit = ??? + /** + * + * @return A Unit + */ + def Pet_deletePet(petId: Long, apiKey: String): Unit = ??? - /** - * - * @return A Seq[Pet] - */ - def Pet_findPetsByStatus(status: Seq[String]): Seq[Pet] = ??? + /** + * + * @return A Seq[Pet] + */ + def Pet_findPetsByStatus(status: Seq[String]): Seq[Pet] = ??? - /** - * - * @return A Seq[Pet] - */ - def Pet_findPetsByTags(tags: Seq[String]): Seq[Pet] = ??? + /** + * + * @return A Seq[Pet] + */ + def Pet_findPetsByTags(tags: Seq[String]): Seq[Pet] = ??? - /** - * - * @return A Pet - */ - def Pet_getPetById(petId: Long): Pet = ??? + /** + * + * @return A Pet + */ + def Pet_getPetById(petId: Long): Pet = ??? - /** - * - * @return A Unit - */ - def Pet_updatePet(body: Pet): Unit = ??? + /** + * + * @return A Unit + */ + def Pet_updatePet(body: Pet): Unit = ??? - /** - * - * @return A Unit - */ - def Pet_updatePetWithForm(petId: Long, name: String, status: String): Unit = ??? + /** + * + * @return A Unit + */ + def Pet_updatePetWithForm(petId: Long, name: String, status: String): Unit = ??? - /** - * - * @return A ApiResponse - */ - def Pet_uploadFile(petId: Long, additionalMetadata: String, file: File): ApiResponse = ??? + /** + * + * @return A ApiResponse + */ + def Pet_uploadFile(petId: Long, additionalMetadata: String, file: File): ApiResponse = ??? - /** - * - * @return A Unit - */ - def Store_deleteOrder(orderId: String): Unit = ??? + /** + * + * @return A Unit + */ + def Store_deleteOrder(orderId: String): Unit = ??? - /** - * - * @return A Map[String, Int] - */ - def Store_getInventory(): Map[String, Int] = ??? + /** + * + * @return A Map[String, Int] + */ + def Store_getInventory(): Map[String, Int] = ??? - /** - * - * @return A Order - */ - def Store_getOrderById(orderId: Long): Order = ??? + /** + * + * @return A Order + */ + def Store_getOrderById(orderId: Long): Order = ??? - /** - * - * @return A Order - */ - def Store_placeOrder(body: Order): Order = ??? + /** + * + * @return A Order + */ + def Store_placeOrder(body: Order): Order = ??? - /** - * - * @return A Unit - */ - def User_createUser(body: User): Unit = ??? + /** + * + * @return A Unit + */ + def User_createUser(body: User): Unit = ??? - /** - * - * @return A Unit - */ - def User_createUsersWithArrayInput(body: Seq[User]): Unit = ??? + /** + * + * @return A Unit + */ + def User_createUsersWithArrayInput(body: Seq[User]): Unit = ??? - /** - * - * @return A Unit - */ - def User_createUsersWithListInput(body: Seq[User]): Unit = ??? + /** + * + * @return A Unit + */ + def User_createUsersWithListInput(body: Seq[User]): Unit = ??? - /** - * - * @return A Unit - */ - def User_deleteUser(username: String): Unit = ??? + /** + * + * @return A Unit + */ + def User_deleteUser(username: String): Unit = ??? - /** - * - * @return A User - */ - def User_getUserByName(username: String): User = ??? + /** + * + * @return A User + */ + def User_getUserByName(username: String): User = ??? - /** - * - * @return A String - */ - def User_loginUser(username: String, password: String): String = ??? + /** + * + * @return A String + */ + def User_loginUser(username: String, password: String): String = ??? - /** - * - * @return A Unit - */ - def User_logoutUser(): Unit = ??? + /** + * + * @return A Unit + */ + def User_logoutUser(): Unit = ??? - /** - * - * @return A Unit - */ - def User_updateUser(username: String, body: User): Unit = ??? + /** + * + * @return A Unit + */ + def User_updateUser(username: String, body: User): Unit = ??? } \ No newline at end of file diff --git a/samples/server/petstore/finch/src/main/scala/Server.scala b/samples/server/petstore/finch/src/main/scala/Server.scala index 716b6eae52e..f5f4957b069 100644 --- a/samples/server/petstore/finch/src/main/scala/Server.scala +++ b/samples/server/petstore/finch/src/main/scala/Server.scala @@ -2,21 +2,22 @@ package io.swagger.petstore import io.finch._ import io.finch.circe._ -import io.circe.{ Decoder, ObjectEncoder } +import io.circe.{Decoder, ObjectEncoder} import io.circe.generic.auto._ import io.circe.generic.semiauto import io.circe.generic.semiauto._ import io.circe.java8.time._ import com.twitter.finagle.Http import com.twitter.finagle.util.LoadService -import com.twitter.util.{ Await, Future } +import com.twitter.util.{Await, Future} + class Server { // Loads implementation defined in resources/META-INF/services/io.swagger.petstore.DataAccessor val db = LoadService[DataAccessor]() match { case accessor :: _ => accessor - case _ => new DataAccessor {} + case _ => new DataAccessor { } } val service = endpoint.makeService(db) diff --git a/samples/server/petstore/finch/src/main/scala/endpoint.scala b/samples/server/petstore/finch/src/main/scala/endpoint.scala index df0093b7b13..6c914c131f0 100644 --- a/samples/server/petstore/finch/src/main/scala/endpoint.scala +++ b/samples/server/petstore/finch/src/main/scala/endpoint.scala @@ -1,11 +1,11 @@ package io.swagger.petstore import com.twitter.finagle.Service -import com.twitter.finagle.http.{ Request, Response } +import com.twitter.finagle.http.{Request, Response} import com.twitter.finagle.http.exp.Multipart.FileUpload import com.twitter.util.Future import io.finch._, items._ -import io.circe.{ Encoder, Json } +import io.circe.{Encoder, Json} import io.finch.circe._ import io.circe.generic.semiauto._ @@ -17,32 +17,32 @@ import io.swagger.petstore.apis._ object endpoint { def errorToJson(e: Exception): Json = e match { - case Error.NotPresent(_) => - Json.obj("error" -> Json.fromString("something_not_present")) - case Error.NotParsed(_, _, _) => - Json.obj("error" -> Json.fromString("something_not_parsed")) - case Error.NotValid(_, _) => - Json.obj("error" -> Json.fromString("something_not_valid")) - case error: PetstoreError => - Json.obj("error" -> Json.fromString(error.message)) + case Error.NotPresent(_) => + Json.obj("error" -> Json.fromString("something_not_present")) + case Error.NotParsed(_, _, _) => + Json.obj("error" -> Json.fromString("something_not_parsed")) + case Error.NotValid(_, _) => + Json.obj("error" -> Json.fromString("something_not_valid")) + case error: PetstoreError => + Json.obj("error" -> Json.fromString(error.message)) } implicit val ee: Encoder[Exception] = Encoder.instance { - case e: Error => errorToJson(e) - case Errors(nel) => Json.arr(nel.toList.map(errorToJson): _*) + case e: Error => errorToJson(e) + case Errors(nel) => Json.arr(nel.toList.map(errorToJson): _*) } /** - * Compiles together all the endpoints relating to public service methods. - * - * @return A service that contains all provided endpoints of the API. - */ + * Compiles together all the endpoints relating to public service methods. + * + * @return A service that contains all provided endpoints of the API. + */ def makeService(da: DataAccessor): Service[Request, Response] = ( - PetApi.endpoints(da) :+: - StoreApi.endpoints(da) :+: - UserApi.endpoints(da) + PetApi.endpoints(da) :+: + StoreApi.endpoints(da) :+: + UserApi.endpoints(da) ).handle({ case e: PetstoreError => NotFound(e) - }).toService + }).toService } \ No newline at end of file diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/PetApi.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/PetApi.scala index 420279685d3..da83cbe3e47 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/PetApi.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/PetApi.scala @@ -4,145 +4,146 @@ import java.io._ import java.util.Date import io.swagger.petstore._ import io.swagger.petstore.models._ -import io.swagger.petstore.models.Pet -import java.io.File import io.swagger.petstore.models.ApiResponse +import java.io.File +import io.swagger.petstore.models.Pet import io.finch.circe._ import io.circe.generic.semiauto._ import com.twitter.concurrent.AsyncStream import com.twitter.finagle.Service import com.twitter.finagle.Http -import com.twitter.finagle.http.{ Request, Response } -import com.twitter.finagle.http.exp.Multipart.{ FileUpload, InMemoryFileUpload, OnDiskFileUpload } +import com.twitter.finagle.http.{Request, Response} +import com.twitter.finagle.http.exp.Multipart.{FileUpload, InMemoryFileUpload, OnDiskFileUpload} import com.twitter.util.Future import com.twitter.io.Buf import io.finch._, items._ import java.io.File object PetApi { - /** - * Compiles all service endpoints. - * @return Bundled compilation of all service endpoints. - */ - def endpoints(da: DataAccessor) = - addPet(da) :+: - deletePet(da) :+: - findPetsByStatus(da) :+: - findPetsByTags(da) :+: - getPetById(da) :+: - updatePet(da) :+: - updatePetWithForm(da) :+: - uploadFile(da) + /** + * Compiles all service endpoints. + * @return Bundled compilation of all service endpoints. + */ + def endpoints(da: DataAccessor) = + addPet(da) :+: + deletePet(da) :+: + findPetsByStatus(da) :+: + findPetsByTags(da) :+: + getPetById(da) :+: + updatePet(da) :+: + updatePetWithForm(da) :+: + uploadFile(da) - /** - * - * @return And endpoint representing a Unit - */ - private def addPet(da: DataAccessor): Endpoint[Unit] = - post("pet" :: jsonBody[Pet]) { (body: Pet) => - da.Pet_addPet(body) - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) + /** + * + * @return And endpoint representing a Unit + */ + private def addPet(da: DataAccessor): Endpoint[Unit] = + post("pet" :: jsonBody[Pet]) { (body: Pet) => + da.Pet_addPet(body) + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Unit + */ + private def deletePet(da: DataAccessor): Endpoint[Unit] = + delete("pet" :: long :: string) { (petId: Long, apiKey: String) => + da.Pet_deletePet(petId, apiKey) + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Seq[Pet] + */ + private def findPetsByStatus(da: DataAccessor): Endpoint[Seq[Pet]] = + get("pet" :: "findByStatus" :: params("status")) { (status: Seq[String]) => + Ok(da.Pet_findPetsByStatus(status)) + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Seq[Pet] + */ + private def findPetsByTags(da: DataAccessor): Endpoint[Seq[Pet]] = + get("pet" :: "findByTags" :: params("tags")) { (tags: Seq[String]) => + Ok(da.Pet_findPetsByTags(tags)) + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Pet + */ + private def getPetById(da: DataAccessor): Endpoint[Pet] = + get("pet" :: long ) { (petId: Long) => + Ok(da.Pet_getPetById(petId)) + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Unit + */ + private def updatePet(da: DataAccessor): Endpoint[Unit] = + put("pet" :: jsonBody[Pet]) { (body: Pet) => + da.Pet_updatePet(body) + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Unit + */ + private def updatePetWithForm(da: DataAccessor): Endpoint[Unit] = + post("pet" :: long :: string :: string) { (petId: Long, name: String, status: String) => + da.Pet_updatePetWithForm(petId, name, status) + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a ApiResponse + */ + private def uploadFile(da: DataAccessor): Endpoint[ApiResponse] = + post("pet" :: long :: "uploadImage" :: string :: fileUpload("file")) { (petId: Long, additionalMetadata: String, file: FileUpload) => + Ok(da.Pet_uploadFile(petId, additionalMetadata, file)) + } handle { + case e: Exception => BadRequest(e) + } + + + implicit private def fileUploadToFile(fileUpload: FileUpload) : File = { + fileUpload match { + case upload: InMemoryFileUpload => + bytesToFile(Buf.ByteArray.Owned.extract(upload.content)) + case upload: OnDiskFileUpload => + upload.content + case _ => null + } } - /** - * - * @return And endpoint representing a Unit - */ - private def deletePet(da: DataAccessor): Endpoint[Unit] = - delete("pet" :: long :: string) { (petId: Long, apiKey: String) => - da.Pet_deletePet(petId, apiKey) - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) + private def bytesToFile(input: Array[Byte]): java.io.File = { + val file = File.createTempFile("tmpPetApi", null) + val output = new FileOutputStream(file) + output.write(input) + file } - /** - * - * @return And endpoint representing a Seq[Pet] - */ - private def findPetsByStatus(da: DataAccessor): Endpoint[Seq[Pet]] = - get("pet" :: "findByStatus" :: params("status")) { (status: Seq[String]) => - Ok(da.Pet_findPetsByStatus(status)) - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a Seq[Pet] - */ - private def findPetsByTags(da: DataAccessor): Endpoint[Seq[Pet]] = - get("pet" :: "findByTags" :: params("tags")) { (tags: Seq[String]) => - Ok(da.Pet_findPetsByTags(tags)) - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a Pet - */ - private def getPetById(da: DataAccessor): Endpoint[Pet] = - get("pet" :: long) { (petId: Long) => - Ok(da.Pet_getPetById(petId)) - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a Unit - */ - private def updatePet(da: DataAccessor): Endpoint[Unit] = - put("pet" :: jsonBody[Pet]) { (body: Pet) => - da.Pet_updatePet(body) - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a Unit - */ - private def updatePetWithForm(da: DataAccessor): Endpoint[Unit] = - post("pet" :: long :: string :: string) { (petId: Long, name: String, status: String) => - da.Pet_updatePetWithForm(petId, name, status) - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a ApiResponse - */ - private def uploadFile(da: DataAccessor): Endpoint[ApiResponse] = - post("pet" :: long :: "uploadImage" :: string :: fileUpload("file")) { (petId: Long, additionalMetadata: String, file: FileUpload) => - Ok(da.Pet_uploadFile(petId, additionalMetadata, file)) - } handle { - case e: Exception => BadRequest(e) - } - - implicit private def fileUploadToFile(fileUpload: FileUpload): File = { - fileUpload match { - case upload: InMemoryFileUpload => - bytesToFile(Buf.ByteArray.Owned.extract(upload.content)) - case upload: OnDiskFileUpload => - upload.content - case _ => null - } - } - - private def bytesToFile(input: Array[Byte]): java.io.File = { - val file = File.createTempFile("tmpPetApi", null) - val output = new FileOutputStream(file) - output.write(input) - file - } - - // This assists in params(string) application (which must be Seq[A] in parameter list) when the param is used as a List[A] elsewhere. - implicit def seqList[A](input: Seq[A]): List[A] = input.toList + // This assists in params(string) application (which must be Seq[A] in parameter list) when the param is used as a List[A] elsewhere. + implicit def seqList[A](input: Seq[A]): List[A] = input.toList } diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/StoreApi.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/StoreApi.scala index 38dda7b4786..d61b88b32a4 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/StoreApi.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/StoreApi.scala @@ -10,86 +10,87 @@ import io.circe.generic.semiauto._ import com.twitter.concurrent.AsyncStream import com.twitter.finagle.Service import com.twitter.finagle.Http -import com.twitter.finagle.http.{ Request, Response } -import com.twitter.finagle.http.exp.Multipart.{ FileUpload, InMemoryFileUpload, OnDiskFileUpload } +import com.twitter.finagle.http.{Request, Response} +import com.twitter.finagle.http.exp.Multipart.{FileUpload, InMemoryFileUpload, OnDiskFileUpload} import com.twitter.util.Future import com.twitter.io.Buf import io.finch._, items._ import java.io.File object StoreApi { - /** - * Compiles all service endpoints. - * @return Bundled compilation of all service endpoints. - */ - def endpoints(da: DataAccessor) = - deleteOrder(da) :+: - getInventory(da) :+: - getOrderById(da) :+: - placeOrder(da) + /** + * Compiles all service endpoints. + * @return Bundled compilation of all service endpoints. + */ + def endpoints(da: DataAccessor) = + deleteOrder(da) :+: + getInventory(da) :+: + getOrderById(da) :+: + placeOrder(da) - /** - * - * @return And endpoint representing a Unit - */ - private def deleteOrder(da: DataAccessor): Endpoint[Unit] = - delete("store" :: "order" :: string) { (orderId: String) => - da.Store_deleteOrder(orderId) - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) + /** + * + * @return And endpoint representing a Unit + */ + private def deleteOrder(da: DataAccessor): Endpoint[Unit] = + delete("store" :: "order" :: string ) { (orderId: String) => + da.Store_deleteOrder(orderId) + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Map[String, Int] + */ + private def getInventory(da: DataAccessor): Endpoint[Map[String, Int]] = + get("store" :: "inventory" ) { + Ok(da.Store_getInventory()) + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Order + */ + private def getOrderById(da: DataAccessor): Endpoint[Order] = + get("store" :: "order" :: long ) { (orderId: Long) => + Ok(da.Store_getOrderById(orderId)) + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Order + */ + private def placeOrder(da: DataAccessor): Endpoint[Order] = + post("store" :: "order" :: jsonBody[Order]) { (body: Order) => + Ok(da.Store_placeOrder(body)) + } handle { + case e: Exception => BadRequest(e) + } + + + implicit private def fileUploadToFile(fileUpload: FileUpload) : File = { + fileUpload match { + case upload: InMemoryFileUpload => + bytesToFile(Buf.ByteArray.Owned.extract(upload.content)) + case upload: OnDiskFileUpload => + upload.content + case _ => null + } } - /** - * - * @return And endpoint representing a Map[String, Int] - */ - private def getInventory(da: DataAccessor): Endpoint[Map[String, Int]] = - get("store" :: "inventory") { - Ok(da.Store_getInventory()) - } handle { - case e: Exception => BadRequest(e) + private def bytesToFile(input: Array[Byte]): java.io.File = { + val file = File.createTempFile("tmpStoreApi", null) + val output = new FileOutputStream(file) + output.write(input) + file } - /** - * - * @return And endpoint representing a Order - */ - private def getOrderById(da: DataAccessor): Endpoint[Order] = - get("store" :: "order" :: long) { (orderId: Long) => - Ok(da.Store_getOrderById(orderId)) - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a Order - */ - private def placeOrder(da: DataAccessor): Endpoint[Order] = - post("store" :: "order" :: jsonBody[Order]) { (body: Order) => - Ok(da.Store_placeOrder(body)) - } handle { - case e: Exception => BadRequest(e) - } - - implicit private def fileUploadToFile(fileUpload: FileUpload): File = { - fileUpload match { - case upload: InMemoryFileUpload => - bytesToFile(Buf.ByteArray.Owned.extract(upload.content)) - case upload: OnDiskFileUpload => - upload.content - case _ => null - } - } - - private def bytesToFile(input: Array[Byte]): java.io.File = { - val file = File.createTempFile("tmpStoreApi", null) - val output = new FileOutputStream(file) - output.write(input) - file - } - - // This assists in params(string) application (which must be Seq[A] in parameter list) when the param is used as a List[A] elsewhere. - implicit def seqList[A](input: Seq[A]): List[A] = input.toList + // This assists in params(string) application (which must be Seq[A] in parameter list) when the param is used as a List[A] elsewhere. + implicit def seqList[A](input: Seq[A]): List[A] = input.toList } diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/UserApi.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/UserApi.scala index 560509a349c..a052a679a67 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/UserApi.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/apis/UserApi.scala @@ -4,146 +4,147 @@ import java.io._ import java.util.Date import io.swagger.petstore._ import io.swagger.petstore.models._ -import io.swagger.petstore.models.User import scala.collection.immutable.Seq +import io.swagger.petstore.models.User import io.finch.circe._ import io.circe.generic.semiauto._ import com.twitter.concurrent.AsyncStream import com.twitter.finagle.Service import com.twitter.finagle.Http -import com.twitter.finagle.http.{ Request, Response } -import com.twitter.finagle.http.exp.Multipart.{ FileUpload, InMemoryFileUpload, OnDiskFileUpload } +import com.twitter.finagle.http.{Request, Response} +import com.twitter.finagle.http.exp.Multipart.{FileUpload, InMemoryFileUpload, OnDiskFileUpload} import com.twitter.util.Future import com.twitter.io.Buf import io.finch._, items._ import java.io.File object UserApi { - /** - * Compiles all service endpoints. - * @return Bundled compilation of all service endpoints. - */ - def endpoints(da: DataAccessor) = - createUser(da) :+: - createUsersWithArrayInput(da) :+: - createUsersWithListInput(da) :+: - deleteUser(da) :+: - getUserByName(da) :+: - loginUser(da) :+: - logoutUser(da) :+: - updateUser(da) + /** + * Compiles all service endpoints. + * @return Bundled compilation of all service endpoints. + */ + def endpoints(da: DataAccessor) = + createUser(da) :+: + createUsersWithArrayInput(da) :+: + createUsersWithListInput(da) :+: + deleteUser(da) :+: + getUserByName(da) :+: + loginUser(da) :+: + logoutUser(da) :+: + updateUser(da) - /** - * - * @return And endpoint representing a Unit - */ - private def createUser(da: DataAccessor): Endpoint[Unit] = - post("user" :: jsonBody[User]) { (body: User) => - da.User_createUser(body) - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) + /** + * + * @return And endpoint representing a Unit + */ + private def createUser(da: DataAccessor): Endpoint[Unit] = + post("user" :: jsonBody[User]) { (body: User) => + da.User_createUser(body) + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Unit + */ + private def createUsersWithArrayInput(da: DataAccessor): Endpoint[Unit] = + post("user" :: "createWithArray" :: jsonBody[Seq[User]]) { (body: Seq[User]) => + da.User_createUsersWithArrayInput(body) + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Unit + */ + private def createUsersWithListInput(da: DataAccessor): Endpoint[Unit] = + post("user" :: "createWithList" :: jsonBody[Seq[User]]) { (body: Seq[User]) => + da.User_createUsersWithListInput(body) + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Unit + */ + private def deleteUser(da: DataAccessor): Endpoint[Unit] = + delete("user" :: string ) { (username: String) => + da.User_deleteUser(username) + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a User + */ + private def getUserByName(da: DataAccessor): Endpoint[User] = + get("user" :: string ) { (username: String) => + Ok(da.User_getUserByName(username)) + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a String + */ + private def loginUser(da: DataAccessor): Endpoint[String] = + get("user" :: "login" :: string :: string) { (username: String, password: String) => + Ok(da.User_loginUser(username, password)) + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Unit + */ + private def logoutUser(da: DataAccessor): Endpoint[Unit] = + get("user" :: "logout" ) { + da.User_logoutUser() + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + /** + * + * @return And endpoint representing a Unit + */ + private def updateUser(da: DataAccessor): Endpoint[Unit] = + put("user" :: string :: jsonBody[User]) { (username: String, body: User) => + da.User_updateUser(username, body) + NoContent[Unit] + } handle { + case e: Exception => BadRequest(e) + } + + + implicit private def fileUploadToFile(fileUpload: FileUpload) : File = { + fileUpload match { + case upload: InMemoryFileUpload => + bytesToFile(Buf.ByteArray.Owned.extract(upload.content)) + case upload: OnDiskFileUpload => + upload.content + case _ => null + } } - /** - * - * @return And endpoint representing a Unit - */ - private def createUsersWithArrayInput(da: DataAccessor): Endpoint[Unit] = - post("user" :: "createWithArray" :: jsonBody[Seq[User]]) { (body: Seq[User]) => - da.User_createUsersWithArrayInput(body) - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) + private def bytesToFile(input: Array[Byte]): java.io.File = { + val file = File.createTempFile("tmpUserApi", null) + val output = new FileOutputStream(file) + output.write(input) + file } - /** - * - * @return And endpoint representing a Unit - */ - private def createUsersWithListInput(da: DataAccessor): Endpoint[Unit] = - post("user" :: "createWithList" :: jsonBody[Seq[User]]) { (body: Seq[User]) => - da.User_createUsersWithListInput(body) - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a Unit - */ - private def deleteUser(da: DataAccessor): Endpoint[Unit] = - delete("user" :: string) { (username: String) => - da.User_deleteUser(username) - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a User - */ - private def getUserByName(da: DataAccessor): Endpoint[User] = - get("user" :: string) { (username: String) => - Ok(da.User_getUserByName(username)) - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a String - */ - private def loginUser(da: DataAccessor): Endpoint[String] = - get("user" :: "login" :: string :: string) { (username: String, password: String) => - Ok(da.User_loginUser(username, password)) - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a Unit - */ - private def logoutUser(da: DataAccessor): Endpoint[Unit] = - get("user" :: "logout") { - da.User_logoutUser() - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) - } - - /** - * - * @return And endpoint representing a Unit - */ - private def updateUser(da: DataAccessor): Endpoint[Unit] = - put("user" :: string :: jsonBody[User]) { (username: String, body: User) => - da.User_updateUser(username, body) - NoContent[Unit] - } handle { - case e: Exception => BadRequest(e) - } - - implicit private def fileUploadToFile(fileUpload: FileUpload): File = { - fileUpload match { - case upload: InMemoryFileUpload => - bytesToFile(Buf.ByteArray.Owned.extract(upload.content)) - case upload: OnDiskFileUpload => - upload.content - case _ => null - } - } - - private def bytesToFile(input: Array[Byte]): java.io.File = { - val file = File.createTempFile("tmpUserApi", null) - val output = new FileOutputStream(file) - output.write(input) - file - } - - // This assists in params(string) application (which must be Seq[A] in parameter list) when the param is used as a List[A] elsewhere. - implicit def seqList[A](input: Seq[A]): List[A] = input.toList + // This assists in params(string) application (which must be Seq[A] in parameter list) when the param is used as a List[A] elsewhere. + implicit def seqList[A](input: Seq[A]): List[A] = input.toList } diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/ApiResponse.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/ApiResponse.scala index 248833a4e75..06edf5b7c02 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/ApiResponse.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/ApiResponse.scala @@ -8,20 +8,19 @@ import io.swagger.petstore._ /** * Describes the result of uploading an image resource - * @param code - * @param _type - * @param message + * @param code + * @param _type + * @param message */ -case class ApiResponse( - code: Option[Int], - _type: Option[String], - message: Option[String] -) +case class ApiResponse(code: Option[Int], + _type: Option[String], + message: Option[String] + ) object ApiResponse { - /** - * Creates the codec for converting ApiResponse from and to JSON. - */ - implicit val decoder: Decoder[ApiResponse] = deriveDecoder - implicit val encoder: ObjectEncoder[ApiResponse] = deriveEncoder + /** + * Creates the codec for converting ApiResponse from and to JSON. + */ + implicit val decoder: Decoder[ApiResponse] = deriveDecoder + implicit val encoder: ObjectEncoder[ApiResponse] = deriveEncoder } diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Category.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Category.scala index ceb17f6b7e7..d3091295967 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Category.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Category.scala @@ -8,18 +8,17 @@ import io.swagger.petstore._ /** * A category for a pet - * @param id - * @param name + * @param id + * @param name */ -case class Category( - id: Option[Long], - name: Option[String] -) +case class Category(id: Option[Long], + name: Option[String] + ) object Category { - /** - * Creates the codec for converting Category from and to JSON. - */ - implicit val decoder: Decoder[Category] = deriveDecoder - implicit val encoder: ObjectEncoder[Category] = deriveEncoder + /** + * Creates the codec for converting Category from and to JSON. + */ + implicit val decoder: Decoder[Category] = deriveDecoder + implicit val encoder: ObjectEncoder[Category] = deriveEncoder } diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Order.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Order.scala index 08743ebbf13..a7b62ac0b5b 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Order.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Order.scala @@ -9,26 +9,25 @@ import java.time.LocalDateTime /** * An order for a pets from the pet store - * @param id - * @param petId - * @param quantity - * @param shipDate + * @param id + * @param petId + * @param quantity + * @param shipDate * @param status Order Status - * @param complete + * @param complete */ -case class Order( - id: Option[Long], - petId: Option[Long], - quantity: Option[Int], - shipDate: Option[LocalDateTime], - status: Option[String], - complete: Option[Boolean] -) +case class Order(id: Option[Long], + petId: Option[Long], + quantity: Option[Int], + shipDate: Option[LocalDateTime], + status: Option[String], + complete: Option[Boolean] + ) object Order { - /** - * Creates the codec for converting Order from and to JSON. - */ - implicit val decoder: Decoder[Order] = deriveDecoder - implicit val encoder: ObjectEncoder[Order] = deriveEncoder + /** + * Creates the codec for converting Order from and to JSON. + */ + implicit val decoder: Decoder[Order] = deriveDecoder + implicit val encoder: ObjectEncoder[Order] = deriveEncoder } diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Pet.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Pet.scala index 4a17021b726..0c4446ad925 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Pet.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Pet.scala @@ -11,26 +11,25 @@ import scala.collection.immutable.Seq /** * A pet for sale in the pet store - * @param id - * @param category - * @param name - * @param photoUrls - * @param tags + * @param id + * @param category + * @param name + * @param photoUrls + * @param tags * @param status pet status in the store */ -case class Pet( - id: Option[Long], - category: Option[Category], - name: String, - photoUrls: Seq[String], - tags: Option[Seq[Tag]], - status: Option[String] -) +case class Pet(id: Option[Long], + category: Option[Category], + name: String, + photoUrls: Seq[String], + tags: Option[Seq[Tag]], + status: Option[String] + ) object Pet { - /** - * Creates the codec for converting Pet from and to JSON. - */ - implicit val decoder: Decoder[Pet] = deriveDecoder - implicit val encoder: ObjectEncoder[Pet] = deriveEncoder + /** + * Creates the codec for converting Pet from and to JSON. + */ + implicit val decoder: Decoder[Pet] = deriveDecoder + implicit val encoder: ObjectEncoder[Pet] = deriveEncoder } diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Tag.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Tag.scala index 5fb213c0c3f..d514e9f5633 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Tag.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/Tag.scala @@ -8,18 +8,17 @@ import io.swagger.petstore._ /** * A tag for a pet - * @param id - * @param name + * @param id + * @param name */ -case class Tag( - id: Option[Long], - name: Option[String] -) +case class Tag(id: Option[Long], + name: Option[String] + ) object Tag { - /** - * Creates the codec for converting Tag from and to JSON. - */ - implicit val decoder: Decoder[Tag] = deriveDecoder - implicit val encoder: ObjectEncoder[Tag] = deriveEncoder + /** + * Creates the codec for converting Tag from and to JSON. + */ + implicit val decoder: Decoder[Tag] = deriveDecoder + implicit val encoder: ObjectEncoder[Tag] = deriveEncoder } diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/User.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/User.scala index 6556cdb437a..c78d145e4fa 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/User.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/petstore/models/User.scala @@ -8,30 +8,29 @@ import io.swagger.petstore._ /** * A User who is purchasing from the pet store - * @param id - * @param username - * @param firstName - * @param lastName - * @param email - * @param password - * @param phone + * @param id + * @param username + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone * @param userStatus User Status */ -case class User( - id: Option[Long], - username: Option[String], - firstName: Option[String], - lastName: Option[String], - email: Option[String], - password: Option[String], - phone: Option[String], - userStatus: Option[Int] -) +case class User(id: Option[Long], + username: Option[String], + firstName: Option[String], + lastName: Option[String], + email: Option[String], + password: Option[String], + phone: Option[String], + userStatus: Option[Int] + ) object User { - /** - * Creates the codec for converting User from and to JSON. - */ - implicit val decoder: Decoder[User] = deriveDecoder - implicit val encoder: ObjectEncoder[User] = deriveEncoder + /** + * Creates the codec for converting User from and to JSON. + */ + implicit val decoder: Decoder[User] = deriveDecoder + implicit val encoder: ObjectEncoder[User] = deriveEncoder } diff --git a/samples/server/petstore/flaskConnexion-python2/swagger_server/models/category.py b/samples/server/petstore/flaskConnexion-python2/swagger_server/models/category.py index 440b19f7a82..fd702edf6fe 100644 --- a/samples/server/petstore/flaskConnexion-python2/swagger_server/models/category.py +++ b/samples/server/petstore/flaskConnexion-python2/swagger_server/models/category.py @@ -17,12 +17,12 @@ class Category(Model): Category - a model defined in Swagger :param id: The id of this Category. - :type id: int + :type id: long :param name: The name of this Category. :type name: str """ self.swagger_types = { - 'id': int, + 'id': long, 'name': str } @@ -52,7 +52,7 @@ class Category(Model): Gets the id of this Category. :return: The id of this Category. - :rtype: int + :rtype: long """ return self._id @@ -62,7 +62,7 @@ class Category(Model): Sets the id of this Category. :param id: The id of this Category. - :type id: int + :type id: long """ self._id = id diff --git a/samples/server/petstore/flaskConnexion-python2/swagger_server/models/order.py b/samples/server/petstore/flaskConnexion-python2/swagger_server/models/order.py index a3cb599defa..9574a16fb46 100644 --- a/samples/server/petstore/flaskConnexion-python2/swagger_server/models/order.py +++ b/samples/server/petstore/flaskConnexion-python2/swagger_server/models/order.py @@ -17,9 +17,9 @@ class Order(Model): Order - a model defined in Swagger :param id: The id of this Order. - :type id: int + :type id: long :param pet_id: The pet_id of this Order. - :type pet_id: int + :type pet_id: long :param quantity: The quantity of this Order. :type quantity: int :param ship_date: The ship_date of this Order. @@ -30,8 +30,8 @@ class Order(Model): :type complete: bool """ self.swagger_types = { - 'id': int, - 'pet_id': int, + 'id': long, + 'pet_id': long, 'quantity': int, 'ship_date': datetime, 'status': str, @@ -72,7 +72,7 @@ class Order(Model): Gets the id of this Order. :return: The id of this Order. - :rtype: int + :rtype: long """ return self._id @@ -82,7 +82,7 @@ class Order(Model): Sets the id of this Order. :param id: The id of this Order. - :type id: int + :type id: long """ self._id = id @@ -93,7 +93,7 @@ class Order(Model): Gets the pet_id of this Order. :return: The pet_id of this Order. - :rtype: int + :rtype: long """ return self._pet_id @@ -103,7 +103,7 @@ class Order(Model): Sets the pet_id of this Order. :param pet_id: The pet_id of this Order. - :type pet_id: int + :type pet_id: long """ self._pet_id = pet_id diff --git a/samples/server/petstore/flaskConnexion-python2/swagger_server/models/pet.py b/samples/server/petstore/flaskConnexion-python2/swagger_server/models/pet.py index 074f5d2366c..0ecf301be64 100644 --- a/samples/server/petstore/flaskConnexion-python2/swagger_server/models/pet.py +++ b/samples/server/petstore/flaskConnexion-python2/swagger_server/models/pet.py @@ -19,7 +19,7 @@ class Pet(Model): Pet - a model defined in Swagger :param id: The id of this Pet. - :type id: int + :type id: long :param category: The category of this Pet. :type category: Category :param name: The name of this Pet. @@ -32,7 +32,7 @@ class Pet(Model): :type status: str """ self.swagger_types = { - 'id': int, + 'id': long, 'category': Category, 'name': str, 'photo_urls': List[str], @@ -74,7 +74,7 @@ class Pet(Model): Gets the id of this Pet. :return: The id of this Pet. - :rtype: int + :rtype: long """ return self._id @@ -84,7 +84,7 @@ class Pet(Model): Sets the id of this Pet. :param id: The id of this Pet. - :type id: int + :type id: long """ self._id = id diff --git a/samples/server/petstore/flaskConnexion-python2/swagger_server/models/tag.py b/samples/server/petstore/flaskConnexion-python2/swagger_server/models/tag.py index 6ff4243a1a4..76b4c15c97e 100644 --- a/samples/server/petstore/flaskConnexion-python2/swagger_server/models/tag.py +++ b/samples/server/petstore/flaskConnexion-python2/swagger_server/models/tag.py @@ -17,12 +17,12 @@ class Tag(Model): Tag - a model defined in Swagger :param id: The id of this Tag. - :type id: int + :type id: long :param name: The name of this Tag. :type name: str """ self.swagger_types = { - 'id': int, + 'id': long, 'name': str } @@ -52,7 +52,7 @@ class Tag(Model): Gets the id of this Tag. :return: The id of this Tag. - :rtype: int + :rtype: long """ return self._id @@ -62,7 +62,7 @@ class Tag(Model): Sets the id of this Tag. :param id: The id of this Tag. - :type id: int + :type id: long """ self._id = id diff --git a/samples/server/petstore/flaskConnexion-python2/swagger_server/models/user.py b/samples/server/petstore/flaskConnexion-python2/swagger_server/models/user.py index 715832d2f01..27f215ef61c 100644 --- a/samples/server/petstore/flaskConnexion-python2/swagger_server/models/user.py +++ b/samples/server/petstore/flaskConnexion-python2/swagger_server/models/user.py @@ -17,7 +17,7 @@ class User(Model): User - a model defined in Swagger :param id: The id of this User. - :type id: int + :type id: long :param username: The username of this User. :type username: str :param first_name: The first_name of this User. @@ -34,7 +34,7 @@ class User(Model): :type user_status: int """ self.swagger_types = { - 'id': int, + 'id': long, 'username': str, 'first_name': str, 'last_name': str, @@ -82,7 +82,7 @@ class User(Model): Gets the id of this User. :return: The id of this User. - :rtype: int + :rtype: long """ return self._id @@ -92,7 +92,7 @@ class User(Model): Sets the id of this User. :param id: The id of this User. - :type id: int + :type id: long """ self._id = id diff --git a/samples/server/petstore/flaskConnexion-python2/swagger_server/swagger/swagger.yaml b/samples/server/petstore/flaskConnexion-python2/swagger_server/swagger/swagger.yaml index 9d948b2124f..92590b31bc1 100644 --- a/samples/server/petstore/flaskConnexion-python2/swagger_server/swagger/swagger.yaml +++ b/samples/server/petstore/flaskConnexion-python2/swagger_server/swagger/swagger.yaml @@ -356,8 +356,8 @@ paths: description: "ID of pet that needs to be fetched" required: true type: "integer" - maximum: 5.0 - minimum: 1.0 + maximum: 5 + minimum: 1 format: "int64" responses: 200: @@ -385,7 +385,6 @@ paths: description: "ID of the order that needs to be deleted" required: true type: "string" - minimum: 1.0 responses: 400: description: "Invalid ID supplied" diff --git a/samples/server/petstore/flaskConnexion/README.md b/samples/server/petstore/flaskConnexion/README.md index 91b687abcf4..32f6b03b0e0 100644 --- a/samples/server/petstore/flaskConnexion/README.md +++ b/samples/server/petstore/flaskConnexion/README.md @@ -28,6 +28,6 @@ http://localhost:8080/v2/swagger.json To launch the integration tests, use tox: ``` -sudo pip install tox +sudo pip install tox tox ``` diff --git a/samples/server/petstore/flaskConnexion/swagger_server/swagger/swagger.yaml b/samples/server/petstore/flaskConnexion/swagger_server/swagger/swagger.yaml index 9d948b2124f..92590b31bc1 100644 --- a/samples/server/petstore/flaskConnexion/swagger_server/swagger/swagger.yaml +++ b/samples/server/petstore/flaskConnexion/swagger_server/swagger/swagger.yaml @@ -356,8 +356,8 @@ paths: description: "ID of pet that needs to be fetched" required: true type: "integer" - maximum: 5.0 - minimum: 1.0 + maximum: 5 + minimum: 1 format: "int64" responses: 200: @@ -385,7 +385,6 @@ paths: description: "ID of the order that needs to be deleted" required: true type: "string" - minimum: 1.0 responses: 400: description: "Invalid ID supplied" diff --git a/samples/server/petstore/go-api-server/go/README.md b/samples/server/petstore/go-api-server/go/README.md index 63bee39fdf0..b8846a07424 100644 --- a/samples/server/petstore/go-api-server/go/README.md +++ b/samples/server/petstore/go-api-server/go/README.md @@ -13,7 +13,7 @@ To see how to make this your own, look here: [README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md) - API version: 1.0.0 -- Build date: 2016-07-20T10:23:02.662-07:00 +- Build date: 2017-03-13T18:03:25.386+01:00 ### Running the server diff --git a/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/Types.hs b/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/Types.hs index 4207fbc90c6..2beb5cdfa31 100644 --- a/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/Types.hs +++ b/samples/server/petstore/haskell-servant/lib/SwaggerPetstore/Types.hs @@ -22,10 +22,10 @@ import GHC.Generics (Generic) import Data.Function ((&)) --- | +-- | Describes the result of uploading an image resource data ApiResponse = ApiResponse { apiResponseCode :: Int -- ^ - , apiResponseType_ :: Text -- ^ + , apiResponseType :: Text -- ^ , apiResponseMessage :: Text -- ^ } deriving (Show, Eq, Generic) @@ -34,7 +34,7 @@ instance FromJSON ApiResponse where instance ToJSON ApiResponse where toJSON = genericToJSON (removeFieldLabelPrefix False "apiResponse") --- | +-- | A category for a pet data Category = Category { categoryId :: Integer -- ^ , categoryName :: Text -- ^ @@ -45,7 +45,7 @@ instance FromJSON Category where instance ToJSON Category where toJSON = genericToJSON (removeFieldLabelPrefix False "category") --- | +-- | An order for a pets from the pet store data Order = Order { orderId :: Integer -- ^ , orderPetId :: Integer -- ^ @@ -60,7 +60,7 @@ instance FromJSON Order where instance ToJSON Order where toJSON = genericToJSON (removeFieldLabelPrefix False "order") --- | +-- | A pet for sale in the pet store data Pet = Pet { petId :: Integer -- ^ , petCategory :: Category -- ^ @@ -75,7 +75,7 @@ instance FromJSON Pet where instance ToJSON Pet where toJSON = genericToJSON (removeFieldLabelPrefix False "pet") --- | +-- | A tag for a pet data Tag = Tag { tagId :: Integer -- ^ , tagName :: Text -- ^ @@ -86,7 +86,7 @@ instance FromJSON Tag where instance ToJSON Tag where toJSON = genericToJSON (removeFieldLabelPrefix False "tag") --- | +-- | A User who is purchasing from the pet store data User = User { userId :: Integer -- ^ , userUsername :: Text -- ^ @@ -112,7 +112,7 @@ removeFieldLabelPrefix forParsing prefix = } where replaceSpecialChars field = foldl (&) field (map mkCharReplacement specialChars) - specialChars = [("#", "'Hash"), ("!", "'Exclamation"), ("&", "'Ampersand"), ("@", "'At"), ("$", "'Dollar"), ("%", "'Percent"), ("*", "'Star"), ("+", "'Plus"), (">=", "'Greater_Than_Or_Equal_To"), ("-", "'Dash"), ("<=", "'Less_Than_Or_Equal_To"), ("!=", "'Greater_Than_Or_Equal_To"), (":", "'Colon"), ("^", "'Caret"), ("|", "'Pipe"), (">", "'GreaterThan"), ("=", "'Equal"), ("<", "'LessThan")] + specialChars = [("@", "'At"), ("<=", "'Less_Than_Or_Equal_To"), ("[", "'Left_Square_Bracket"), ("\", "'Back_Slash"), ("]", "'Right_Square_Bracket"), ("^", "'Caret"), ("_", "'Underscore"), ("`", "'Backtick"), ("!", "'Exclamation"), (""", "'Double_Quote"), ("#", "'Hash"), ("$", "'Dollar"), ("%", "'Percent"), ("&", "'Ampersand"), ("'", "'Quote"), ("(", "'Left_Parenthesis"), (")", "'Right_Parenthesis"), ("*", "'Star"), ("+", "'Plus"), (",", "'Comma"), ("-", "'Dash"), (".", "'Period"), ("/", "'Slash"), (":", "'Colon"), ("{", "'Left_Curly_Bracket"), ("|", "'Pipe"), ("<", "'LessThan"), ("!=", "'Not_Equal"), ("=", "'Equal"), ("}", "'Right_Curly_Bracket"), (">", "'GreaterThan"), ("~", "'Tilde"), ("?", "'Question_Mark"), (">=", "'Greater_Than_Or_Equal_To")] mkCharReplacement (replaceStr, searchStr) = T.unpack . replacer (T.pack searchStr) (T.pack replaceStr) . T.pack replacer = if forParsing then flip T.replace else T.replace diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/handler/StringUtil.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/handler/StringUtil.java index 337a801a13d..380f7d7218e 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/handler/StringUtil.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/handler/StringUtil.java @@ -1,6 +1,6 @@ package io.swagger.handler; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java index 9755503f600..82dacf2d11d 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java @@ -13,7 +13,7 @@ import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class AdditionalPropertiesClass { @JsonProperty("map_property") private Map mapProperty = new HashMap(); diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Animal.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Animal.java index 87ebd2daa69..b0c05d39996 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Animal.java @@ -3,6 +3,8 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -10,7 +12,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class Animal { @JsonProperty("className") private String className = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/AnimalFarm.java index dfe4c29628d..e554a13d279 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/AnimalFarm.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/AnimalFarm.java @@ -9,7 +9,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class AnimalFarm extends ArrayList { @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index 37b5df65826..37db09679b1 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -13,7 +13,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class ArrayOfArrayOfNumberOnly { @JsonProperty("ArrayArrayNumber") private List> arrayArrayNumber = new ArrayList>(); diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java index 706d077179c..d849acda59a 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java @@ -13,7 +13,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class ArrayOfNumberOnly { @JsonProperty("ArrayNumber") private List arrayNumber = new ArrayList(); diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayTest.java index 423f536df40..fb3f05c80c1 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ArrayTest.java @@ -13,7 +13,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class ArrayTest { @JsonProperty("array_of_string") private List arrayOfString = new ArrayList(); diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Capitalization.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Capitalization.java new file mode 100644 index 00000000000..cb513f2a5ac --- /dev/null +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Capitalization.java @@ -0,0 +1,185 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + + + + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") +public class Capitalization { + @JsonProperty("smallCamel") + private String smallCamel = null; + + @JsonProperty("CapitalCamel") + private String capitalCamel = null; + + @JsonProperty("small_Snake") + private String smallSnake = null; + + @JsonProperty("Capital_Snake") + private String capitalSnake = null; + + @JsonProperty("SCA_ETH_Flow_Points") + private String scAETHFlowPoints = null; + + @JsonProperty("ATT_NAME") + private String ATT_NAME = null; + + /** + **/ + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("smallCamel") + public String getSmallCamel() { + return smallCamel; + } + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + /** + **/ + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("CapitalCamel") + public String getCapitalCamel() { + return capitalCamel; + } + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + /** + **/ + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("small_Snake") + public String getSmallSnake() { + return smallSnake; + } + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + /** + **/ + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("Capital_Snake") + public String getCapitalSnake() { + return capitalSnake; + } + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + /** + **/ + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("SCA_ETH_Flow_Points") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + /** + * Name of the pet + **/ + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + + @ApiModelProperty(example = "null", value = "Name of the pet ") + @JsonProperty("ATT_NAME") + public String getATTNAME() { + return ATT_NAME; + } + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(smallCamel, capitalization.smallCamel) && + Objects.equals(capitalCamel, capitalization.capitalCamel) && + Objects.equals(smallSnake, capitalization.smallSnake) && + Objects.equals(capitalSnake, capitalization.capitalSnake) && + Objects.equals(scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Cat.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Cat.java index 865008e47c8..b65cc5df294 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Cat.java @@ -11,7 +11,7 @@ import io.swagger.model.Animal; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class Cat extends Animal { @JsonProperty("declawed") private Boolean declawed = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Category.java index ff244e9e5ae..53a92fac88f 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Category.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class Category { @JsonProperty("id") private Long id = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ClassModel.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ClassModel.java new file mode 100644 index 00000000000..09bb88ab85a --- /dev/null +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ClassModel.java @@ -0,0 +1,77 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + + + +/** + * Model for testing model with \"_class\" property + **/ + +@ApiModel(description = "Model for testing model with \"_class\" property") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") +public class ClassModel { + @JsonProperty("_class") + private String propertyClass = null; + + /** + **/ + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("_class") + public String getPropertyClass() { + return propertyClass; + } + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Client.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Client.java index 0f4b7b6bd0b..286431567aa 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Client.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Client.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class Client { @JsonProperty("client") private String client = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Dog.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Dog.java index ddc5b138ec5..eed51286331 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Dog.java @@ -11,7 +11,7 @@ import io.swagger.model.Animal; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class Dog extends Animal { @JsonProperty("breed") private String breed = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/EnumArrays.java index 1e0dc66db47..97783f1dfdb 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/EnumArrays.java @@ -13,7 +13,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class EnumArrays { /** * Gets or Sets justSymbol diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/EnumTest.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/EnumTest.java index 9a0c2fb6107..9822455dd04 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/EnumTest.java @@ -6,12 +6,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.OuterEnum; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class EnumTest { /** * Gets or Sets enumString @@ -117,6 +118,9 @@ public class EnumTest { @JsonProperty("enum_number") private EnumNumberEnum enumNumber = null; + @JsonProperty("outerEnum") + private OuterEnum outerEnum = null; + /** **/ public EnumTest enumString(EnumStringEnum enumString) { @@ -168,6 +172,23 @@ public class EnumTest { this.enumNumber = enumNumber; } + /** + **/ + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("outerEnum") + public OuterEnum getOuterEnum() { + return outerEnum; + } + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + @Override public boolean equals(Object o) { @@ -180,12 +201,13 @@ public class EnumTest { EnumTest enumTest = (EnumTest) o; return Objects.equals(enumString, enumTest.enumString) && Objects.equals(enumInteger, enumTest.enumInteger) && - Objects.equals(enumNumber, enumTest.enumNumber); + Objects.equals(enumNumber, enumTest.enumNumber) && + Objects.equals(outerEnum, enumTest.outerEnum); } @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber); + return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); } @Override @@ -196,6 +218,7 @@ public class EnumTest { sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/FormatTest.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/FormatTest.java index 7535534538c..705a3f94347 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/FormatTest.java @@ -7,12 +7,13 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.Date; +import java.util.UUID; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class FormatTest { @JsonProperty("integer") private Integer integer = null; @@ -48,14 +49,14 @@ public class FormatTest { private Date dateTime = null; @JsonProperty("uuid") - private String uuid = null; + private UUID uuid = null; @JsonProperty("password") private String password = null; /** - * minimum: 10.0 - * maximum: 100.0 + * minimum: 10 + * maximum: 100 **/ public FormatTest integer(Integer integer) { this.integer = integer; @@ -73,8 +74,8 @@ public class FormatTest { } /** - * minimum: 20.0 - * maximum: 200.0 + * minimum: 20 + * maximum: 200 **/ public FormatTest int32(Integer int32) { this.int32 = int32; @@ -252,7 +253,7 @@ public class FormatTest { /** **/ - public FormatTest uuid(String uuid) { + public FormatTest uuid(UUID uuid) { this.uuid = uuid; return this; } @@ -260,10 +261,10 @@ public class FormatTest { @ApiModelProperty(example = "null", value = "") @JsonProperty("uuid") - public String getUuid() { + public UUID getUuid() { return uuid; } - public void setUuid(String uuid) { + public void setUuid(UUID uuid) { this.uuid = uuid; } diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/HasOnlyReadOnly.java index 990188118de..9eba6671c7a 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/HasOnlyReadOnly.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class HasOnlyReadOnly { @JsonProperty("bar") private String bar = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/MapTest.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/MapTest.java index e3e1a7b8753..c39b0ab1178 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/MapTest.java @@ -14,7 +14,7 @@ import java.util.Map; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class MapTest { @JsonProperty("map_map_of_string") private Map> mapMapOfString = new HashMap>(); diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index ab28e910981..f6ef8f80cf5 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -10,15 +10,16 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private String uuid = null; + private UUID uuid = null; @JsonProperty("dateTime") private Date dateTime = null; @@ -28,7 +29,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { /** **/ - public MixedPropertiesAndAdditionalPropertiesClass uuid(String uuid) { + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { this.uuid = uuid; return this; } @@ -36,10 +37,10 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(example = "null", value = "") @JsonProperty("uuid") - public String getUuid() { + public UUID getUuid() { return uuid; } - public void setUuid(String uuid) { + public void setUuid(UUID uuid) { this.uuid = uuid; } diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Model200Response.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Model200Response.java index b669912e402..ae366f9a406 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Model200Response.java @@ -13,13 +13,13 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Model for testing model name starting with number") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class Model200Response { @JsonProperty("name") private Integer name = null; @JsonProperty("class") - private String PropertyClass = null; + private String propertyClass = null; /** **/ @@ -40,8 +40,8 @@ public class Model200Response { /** **/ - public Model200Response PropertyClass(String PropertyClass) { - this.PropertyClass = PropertyClass; + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; return this; } @@ -49,10 +49,10 @@ public class Model200Response { @ApiModelProperty(example = "null", value = "") @JsonProperty("class") public String getPropertyClass() { - return PropertyClass; + return propertyClass; } - public void setPropertyClass(String PropertyClass) { - this.PropertyClass = PropertyClass; + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; } @@ -66,12 +66,12 @@ public class Model200Response { } Model200Response _200Response = (Model200Response) o; return Objects.equals(name, _200Response.name) && - Objects.equals(PropertyClass, _200Response.PropertyClass); + Objects.equals(propertyClass, _200Response.propertyClass); } @Override public int hashCode() { - return Objects.hash(name, PropertyClass); + return Objects.hash(name, propertyClass); } @Override @@ -80,7 +80,7 @@ public class Model200Response { sb.append("class Model200Response {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" PropertyClass: ").append(toIndentedString(PropertyClass)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ModelApiResponse.java index d2cf14c4833..d1b213e2f4c 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class ModelApiResponse { @JsonProperty("code") private Integer code = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ModelReturn.java index b240e33ad2f..99fe97cb84f 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ModelReturn.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Model for testing reserved words") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class ModelReturn { @JsonProperty("return") private Integer _return = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Name.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Name.java index 2c1e02dbf3e..29b15048b4d 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Name.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Name.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Model for testing model name same as property name") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class Name { @JsonProperty("name") private Integer name = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/NumberOnly.java index 33566fcb99c..83578310038 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/NumberOnly.java @@ -11,7 +11,7 @@ import java.math.BigDecimal; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class NumberOnly { @JsonProperty("JustNumber") private BigDecimal justNumber = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Order.java index 55d84c48fff..f4c99226e23 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Order.java @@ -12,7 +12,7 @@ import java.util.Date; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class Order { @JsonProperty("id") private Long id = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/OuterEnum.java new file mode 100644 index 00000000000..8b7e863f8fb --- /dev/null +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/OuterEnum.java @@ -0,0 +1,44 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; + + + +import com.fasterxml.jackson.annotation.JsonCreator; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String text) { + for (OuterEnum b : OuterEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + + diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Pet.java index c1b1942400b..d7c44ad66a0 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Pet.java @@ -15,7 +15,7 @@ import java.util.List; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class Pet { @JsonProperty("id") private Long id = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ReadOnlyFirst.java index 8dc882acafc..53ed9ff761b 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/ReadOnlyFirst.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class ReadOnlyFirst { @JsonProperty("bar") private String bar = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/SpecialModelName.java index 5503a673041..5f16f49f6c0 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/SpecialModelName.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class SpecialModelName { @JsonProperty("$special[property.name]") private Long specialPropertyName = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Tag.java index 26fa90e969e..a52baec4b85 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/Tag.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class Tag { @JsonProperty("id") private Long id = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/User.java index f6e1584d8b0..0694a78a29e 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/User.java @@ -10,7 +10,7 @@ import io.swagger.annotations.ApiModelProperty; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class User { @JsonProperty("id") private Long id = null; diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeClassnameTestController.java b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeClassnameTestController.java new file mode 100644 index 00000000000..00dde060394 --- /dev/null +++ b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeClassnameTestController.java @@ -0,0 +1,30 @@ +package io.swagger.handler; + +import io.swagger.inflector.models.RequestContext; +import io.swagger.inflector.models.ResponseContext; +import javax.ws.rs.core.Response.Status; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import java.io.File; +import java.util.List; + +import io.swagger.model.*; + +import io.swagger.model.Client; + +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") +public class FakeClassnameTestController { + /** + * Uncomment and implement as you see fit. These operations will map + * Directly to operation calls from the routing logic. Because the inflector + * Code allows you to implement logic incrementally, they are disabled. + **/ + + /* + public ResponseContext testClassname(RequestContext request , Client body) { + return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" ); + } + */ + +} + diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeController.java b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeController.java index 752414ff9ce..0652b7e21be 100644 --- a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeController.java +++ b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeController.java @@ -10,11 +10,11 @@ import java.util.List; import io.swagger.model.*; +import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; -import java.math.BigDecimal; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class FakeController { /** * Uncomment and implement as you see fit. These operations will map @@ -29,13 +29,13 @@ public class FakeController { */ /* - public ResponseContext testEndpointParameters(RequestContext request , BigDecimal number, Double _double, String string, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, byte[] binary, Date date, Date dateTime, String password) { + public ResponseContext testEndpointParameters(RequestContext request , BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, Date date, Date dateTime, String password, String paramCallback) { return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" ); } */ /* - public ResponseContext testEnumParameters(RequestContext request , List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble) { + public ResponseContext testEnumParameters(RequestContext request , List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble) { return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" ); } */ diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/PetController.java b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/PetController.java index d1bf6b1b589..a402cc9292a 100644 --- a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/PetController.java +++ b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/PetController.java @@ -10,11 +10,11 @@ import java.util.List; import io.swagger.model.*; -import io.swagger.model.Pet; import java.io.File; import io.swagger.model.ModelApiResponse; +import io.swagger.model.Pet; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class PetController { /** * Uncomment and implement as you see fit. These operations will map diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/StoreController.java b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/StoreController.java index ee1a74508f0..1c95a866021 100644 --- a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/StoreController.java +++ b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/StoreController.java @@ -13,7 +13,7 @@ import io.swagger.model.*; import java.util.Map; import io.swagger.model.Order; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class StoreController { /** * Uncomment and implement as you see fit. These operations will map diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/UserController.java b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/UserController.java index a5ff27d10ba..eace3c481a4 100644 --- a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/UserController.java +++ b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/UserController.java @@ -10,10 +10,10 @@ import java.util.List; import io.swagger.model.*; -import io.swagger.model.User; import java.util.List; +import io.swagger.model.User; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-08-20T17:24:26.037+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2017-03-14T12:36:06.442+01:00") public class UserController { /** * Uncomment and implement as you see fit. These operations will map diff --git a/samples/server/petstore/java-inflector/src/main/swagger/swagger.yaml b/samples/server/petstore/java-inflector/src/main/swagger/swagger.yaml index cef4a8e8100..8d99b18ee6d 100644 --- a/samples/server/petstore/java-inflector/src/main/swagger/swagger.yaml +++ b/samples/server/petstore/java-inflector/src/main/swagger/swagger.yaml @@ -30,221 +30,6 @@ tags: schemes: - "http" paths: - /fake: - get: - tags: - - "fake" - summary: "To test enum parameters" - operationId: "testEnumParameters" - consumes: - - "application/json" - produces: - - "application/json" - parameters: - - name: "enum_form_string_array" - in: "formData" - description: "Form parameter enum test (string array)" - required: false - type: "array" - - name: "enum_form_string" - in: "formData" - description: "Form parameter enum test (string)" - required: false - type: "string" - default: "-efg" - enum: - - "_abc" - - "-efg" - - "(xyz)" - - name: "enum_header_string_array" - in: "header" - description: "Header parameter enum test (string array)" - required: false - type: "array" - - name: "enum_header_string" - in: "header" - description: "Header parameter enum test (string)" - required: false - type: "string" - default: "-efg" - enum: - - "_abc" - - "-efg" - - "(xyz)" - - name: "enum_query_string_array" - in: "query" - description: "Query parameter enum test (string array)" - required: false - type: "array" - items: - type: "string" - default: "$" - enum: - - ">" - - "$" - - name: "enum_query_string" - in: "query" - description: "Query parameter enum test (string)" - required: false - type: "string" - default: "-efg" - enum: - - "_abc" - - "-efg" - - "(xyz)" - - name: "enum_query_integer" - in: "query" - description: "Query parameter enum test (double)" - required: false - type: "number" - format: "int32" - enum: - - null - - null - - name: "enum_query_double" - in: "formData" - description: "Query parameter enum test (double)" - required: false - type: "number" - format: "double" - enum: - - null - - null - responses: - 400: - description: "Invalid request" - 404: - description: "Not found" - x-contentType: "application/json" - x-accepts: "application/json" - post: - tags: - - "fake" - summary: "Fake endpoint for testing various parameters\n假端點\n偽のエンドポイント\n가짜 엔\ - 드 포인트\n" - description: "Fake endpoint for testing various parameters\n假端點\n偽のエンドポイント\n\ - 가짜 엔드 포인트\n" - operationId: "testEndpointParameters" - consumes: - - "application/xml; charset=utf-8" - - "application/json; charset=utf-8" - produces: - - "application/xml; charset=utf-8" - - "application/json; charset=utf-8" - parameters: - - name: "integer" - in: "formData" - description: "None" - required: false - type: "integer" - maximum: 100.0 - minimum: 10.0 - - name: "int32" - in: "formData" - description: "None" - required: false - type: "integer" - maximum: 200.0 - minimum: 20.0 - format: "int32" - - name: "int64" - in: "formData" - description: "None" - required: false - type: "integer" - format: "int64" - - name: "number" - in: "formData" - description: "None" - required: true - type: "number" - maximum: 543.2 - minimum: 32.1 - - name: "float" - in: "formData" - description: "None" - required: false - type: "number" - maximum: 987.6 - format: "float" - - name: "double" - in: "formData" - description: "None" - required: true - type: "number" - maximum: 123.4 - minimum: 67.8 - format: "double" - - name: "string" - in: "formData" - description: "None" - required: true - type: "string" - pattern: "/[a-z]/i" - - name: "byte" - in: "formData" - description: "None" - required: true - type: "string" - format: "byte" - - name: "binary" - in: "formData" - description: "None" - required: false - type: "string" - format: "binary" - - name: "date" - in: "formData" - description: "None" - required: false - type: "string" - format: "date" - - name: "dateTime" - in: "formData" - description: "None" - required: false - type: "string" - format: "date-time" - - name: "password" - in: "formData" - description: "None" - required: false - type: "string" - maxLength: 64 - minLength: 10 - format: "password" - responses: - 400: - description: "Invalid username supplied" - 404: - description: "User not found" - security: - - http_basic_test: [] - x-contentType: "application/xml; charset=utf-8" - x-accepts: "application/xml; charset=utf-8,application/json; charset=utf-8" - patch: - tags: - - "fake" - summary: "To test \"client\" model" - operationId: "testClientModel" - consumes: - - "application/json" - produces: - - "application/json" - parameters: - - in: "body" - name: "body" - description: "client model" - required: true - schema: - $ref: "#/definitions/Client" - responses: - 200: - description: "successful operation" - schema: - $ref: "#/definitions/Client" - x-contentType: "application/json" - x-accepts: "application/json" /pet: post: tags: @@ -324,11 +109,11 @@ paths: type: "array" items: type: "string" - default: "available" enum: - "available" - "pending" - "sold" + default: "available" collectionFormat: "csv" responses: 200: @@ -580,8 +365,8 @@ paths: description: "ID of pet that needs to be fetched" required: true type: "integer" - maximum: 5.0 - minimum: 1.0 + maximum: 5 + minimum: 1 format: "int64" responses: 200: @@ -610,7 +395,6 @@ paths: description: "ID of the order that needs to be deleted" required: true type: "string" - minimum: 1.0 responses: 400: description: "Invalid ID supplied" @@ -820,11 +604,271 @@ paths: description: "User not found" x-contentType: "application/json" x-accepts: "application/json" + /fake_classname_test: + patch: + tags: + - "fake_classname_tags 123#$%^" + summary: "To test class name in snake case" + operationId: "testClassname" + consumes: + - "application/json" + produces: + - "application/json" + parameters: + - in: "body" + name: "body" + description: "client model" + required: true + schema: + $ref: "#/definitions/Client" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/Client" + x-contentType: "application/json" + x-accepts: "application/json" + /fake: + get: + tags: + - "fake" + summary: "To test enum parameters" + description: "To test enum parameters" + operationId: "testEnumParameters" + consumes: + - "*/*" + produces: + - "*/*" + parameters: + - name: "enum_form_string_array" + in: "formData" + description: "Form parameter enum test (string array)" + required: false + type: "array" + items: + type: "string" + enum: + - ">" + - "$" + default: "$" + - name: "enum_form_string" + in: "formData" + description: "Form parameter enum test (string)" + required: false + type: "string" + default: "-efg" + enum: + - "_abc" + - "-efg" + - "(xyz)" + - name: "enum_header_string_array" + in: "header" + description: "Header parameter enum test (string array)" + required: false + type: "array" + items: + type: "string" + enum: + - ">" + - "$" + default: "$" + - name: "enum_header_string" + in: "header" + description: "Header parameter enum test (string)" + required: false + type: "string" + default: "-efg" + enum: + - "_abc" + - "-efg" + - "(xyz)" + - name: "enum_query_string_array" + in: "query" + description: "Query parameter enum test (string array)" + required: false + type: "array" + items: + type: "string" + enum: + - ">" + - "$" + default: "$" + - name: "enum_query_string" + in: "query" + description: "Query parameter enum test (string)" + required: false + type: "string" + default: "-efg" + enum: + - "_abc" + - "-efg" + - "(xyz)" + - name: "enum_query_integer" + in: "query" + description: "Query parameter enum test (double)" + required: false + type: "integer" + format: "int32" + enum: + - 1 + - -2 + - name: "enum_query_double" + in: "formData" + description: "Query parameter enum test (double)" + required: false + type: "number" + format: "double" + enum: + - 1.1 + - -1.2 + responses: + 400: + description: "Invalid request" + 404: + description: "Not found" + x-contentType: "*/*" + x-accepts: "*/*" + post: + tags: + - "fake" + summary: "Fake endpoint for testing various parameters\n假端點\n偽のエンドポイント\n가짜 엔\ + 드 포인트\n" + description: "Fake endpoint for testing various parameters\n假端點\n偽のエンドポイント\n\ + 가짜 엔드 포인트\n" + operationId: "testEndpointParameters" + consumes: + - "application/xml; charset=utf-8" + - "application/json; charset=utf-8" + produces: + - "application/xml; charset=utf-8" + - "application/json; charset=utf-8" + parameters: + - name: "integer" + in: "formData" + description: "None" + required: false + type: "integer" + maximum: 100 + minimum: 10 + - name: "int32" + in: "formData" + description: "None" + required: false + type: "integer" + maximum: 200 + minimum: 20 + format: "int32" + - name: "int64" + in: "formData" + description: "None" + required: false + type: "integer" + format: "int64" + - name: "number" + in: "formData" + description: "None" + required: true + type: "number" + maximum: 543.2 + minimum: 32.1 + - name: "float" + in: "formData" + description: "None" + required: false + type: "number" + maximum: 987.6 + format: "float" + - name: "double" + in: "formData" + description: "None" + required: true + type: "number" + maximum: 123.4 + minimum: 67.8 + format: "double" + - name: "string" + in: "formData" + description: "None" + required: false + type: "string" + pattern: "/[a-z]/i" + - name: "pattern_without_delimiter" + in: "formData" + description: "None" + required: true + type: "string" + pattern: "^[A-Z].*" + - name: "byte" + in: "formData" + description: "None" + required: true + type: "string" + format: "byte" + - name: "binary" + in: "formData" + description: "None" + required: false + type: "string" + format: "binary" + - name: "date" + in: "formData" + description: "None" + required: false + type: "string" + format: "date" + - name: "dateTime" + in: "formData" + description: "None" + required: false + type: "string" + format: "date-time" + - name: "password" + in: "formData" + description: "None" + required: false + type: "string" + maxLength: 64 + minLength: 10 + format: "password" + - name: "callback" + in: "formData" + description: "None" + required: false + type: "string" + responses: + 400: + description: "Invalid username supplied" + 404: + description: "User not found" + security: + - http_basic_test: [] + x-contentType: "application/xml; charset=utf-8" + x-accepts: "application/xml; charset=utf-8,application/json; charset=utf-8" + patch: + tags: + - "fake" + summary: "To test \"client\" model" + description: "To test \"client\" model" + operationId: "testClientModel" + consumes: + - "application/json" + produces: + - "application/json" + parameters: + - in: "body" + name: "body" + description: "client model" + required: true + schema: + $ref: "#/definitions/Client" + responses: + 200: + description: "successful operation" + schema: + $ref: "#/definitions/Client" + x-contentType: "application/json" + x-accepts: "application/json" securityDefinitions: - api_key: - type: "apiKey" - name: "api_key" - in: "header" petstore_auth: type: "oauth2" authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" @@ -832,6 +876,10 @@ securityDefinitions: scopes: write:pets: "modify pets in your account" read:pets: "read your pets" + api_key: + type: "apiKey" + name: "api_key" + in: "header" http_basic_test: type: "basic" definitions: @@ -999,6 +1047,11 @@ definitions: description: "Model for testing model name starting with number" xml: name: "Name" + ClassModel: + properties: + _class: + type: "string" + description: "Model for testing model with \"_class\" property" Dog: allOf: - $ref: "#/definitions/Animal" @@ -1038,13 +1091,13 @@ definitions: properties: integer: type: "integer" - minimum: 10.0 - maximum: 100.0 + minimum: 10 + maximum: 100 int32: type: "integer" format: "int32" - minimum: 20.0 - maximum: 200.0 + minimum: 20 + maximum: 200 int64: type: "integer" format: "int64" @@ -1113,6 +1166,8 @@ definitions: enum: - 1.1 - -1.2 + outerEnum: + $ref: "#/definitions/OuterEnum" AdditionalPropertiesClass: type: "object" properties: @@ -1166,6 +1221,22 @@ definitions: foo: type: "string" readOnly: true + Capitalization: + type: "object" + properties: + smallCamel: + type: "string" + CapitalCamel: + type: "string" + small_Snake: + type: "string" + Capital_Snake: + type: "string" + SCA_ETH_Flow_Points: + type: "string" + ATT_NAME: + type: "string" + description: "Name of the pet\n" MapTest: type: "object" properties: @@ -1238,6 +1309,12 @@ definitions: enum: - "fish" - "crab" + OuterEnum: + type: "string" + enum: + - "placed" + - "approved" + - "delivered" externalDocs: description: "Find out more about Swagger" url: "http://swagger.io" diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java index 1ff18daec25..dab091c6a19 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java @@ -7,9 +7,9 @@ import io.swagger.api.factories.FakeApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; +import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; -import java.math.BigDecimal; import java.util.List; import io.swagger.api.NotFoundException; @@ -36,7 +36,7 @@ public class FakeApi { @Consumes({ "application/json" }) @Produces({ "application/json" }) - @io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "", response = Client.class, tags={ "fake", }) + @io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) public Response testClientModel(@ApiParam(value = "client model" ,required=true) Client body @@ -75,9 +75,9 @@ public class FakeApi { } @GET - @Consumes({ "application/json" }) - @Produces({ "application/json" }) - @io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "", response = void.class, tags={ "fake", }) + @Consumes({ "*/*" }) + @Produces({ "*/*" }) + @io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = void.class), @@ -88,8 +88,8 @@ public class FakeApi { ,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString ,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List enumQueryStringArray ,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString -,@ApiParam(value = "Query parameter enum test (double)") @QueryParam("enum_query_integer") BigDecimal enumQueryInteger -,@ApiParam(value = "Query parameter enum test (double)") @FormParam("enum_query_double") Double enumQueryDouble +,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger +,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @FormParam("enum_query_double") Double enumQueryDouble ) throws NotFoundException { return delegate.testEnumParameters(enumFormStringArray,enumFormString,enumHeaderStringArray,enumHeaderString,enumQueryStringArray,enumQueryString,enumQueryInteger,enumQueryDouble); diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java index 33a0ff02d3c..1b1e4b8603a 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java @@ -6,9 +6,9 @@ import io.swagger.model.*; import org.wso2.msf4j.formparam.FormDataParam; import org.wso2.msf4j.formparam.FileInfo; +import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; -import java.math.BigDecimal; import java.util.List; import io.swagger.api.NotFoundException; @@ -43,7 +43,7 @@ public abstract class FakeApiService { ,String enumHeaderString ,List enumQueryStringArray ,String enumQueryString - ,BigDecimal enumQueryInteger + ,Integer enumQueryInteger ,Double enumQueryDouble ) throws NotFoundException; } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeClassnameTestApi.java new file mode 100644 index 00000000000..e9ef534e111 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeClassnameTestApi.java @@ -0,0 +1,45 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.FakeClassnameTestApiService; +import io.swagger.api.factories.FakeClassnameTestApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/fake_classname_test") + + +@io.swagger.annotations.Api(description = "the fake_classname_test API") + +public class FakeClassnameTestApi { + private final FakeClassnameTestApiService delegate = FakeClassnameTestApiServiceFactory.getFakeClassnameTestApi(); + + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Response testClassname(@ApiParam(value = "client model" ,required=true) Client body +) + throws NotFoundException { + return delegate.testClassname(body); + } +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeClassnameTestApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeClassnameTestApiService.java new file mode 100644 index 00000000000..895e8b8f49b --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeClassnameTestApiService.java @@ -0,0 +1,23 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public abstract class FakeClassnameTestApiService { + public abstract Response testClassname(Client body + ) throws NotFoundException; +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java index a6b77ddc778..09c5be96450 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java @@ -7,9 +7,9 @@ import io.swagger.api.factories.PetApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import io.swagger.model.Pet; import java.io.File; import io.swagger.model.ModelApiResponse; +import io.swagger.model.Pet; import java.util.List; import io.swagger.api.NotFoundException; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java index f96a1305859..1aab66fe31b 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java @@ -6,9 +6,9 @@ import io.swagger.model.*; import org.wso2.msf4j.formparam.FormDataParam; import org.wso2.msf4j.formparam.FileInfo; -import io.swagger.model.Pet; import java.io.File; import io.swagger.model.ModelApiResponse; +import io.swagger.model.Pet; import java.util.List; import io.swagger.api.NotFoundException; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java index fe7159324b9..b09b2a52187 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java @@ -7,8 +7,8 @@ import io.swagger.api.factories.UserApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import io.swagger.model.User; import java.util.List; +import io.swagger.model.User; import java.util.List; import io.swagger.api.NotFoundException; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java index 5042a551342..a92e18276c6 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java @@ -6,8 +6,8 @@ import io.swagger.model.*; import org.wso2.msf4j.formparam.FormDataParam; import org.wso2.msf4j.formparam.FileInfo; -import io.swagger.model.User; import java.util.List; +import io.swagger.model.User; import java.util.List; import io.swagger.api.NotFoundException; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Animal.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Animal.java index de739ed501c..60aaf82231f 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Animal.java @@ -3,6 +3,8 @@ package io.swagger.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Capitalization.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Capitalization.java new file mode 100644 index 00000000000..94cb9977104 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Capitalization.java @@ -0,0 +1,189 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Capitalization + */ + +public class Capitalization { + @JsonProperty("smallCamel") + private String smallCamel = null; + + @JsonProperty("CapitalCamel") + private String capitalCamel = null; + + @JsonProperty("small_Snake") + private String smallSnake = null; + + @JsonProperty("Capital_Snake") + private String capitalSnake = null; + + @JsonProperty("SCA_ETH_Flow_Points") + private String scAETHFlowPoints = null; + + @JsonProperty("ATT_NAME") + private String ATT_NAME = null; + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @ApiModelProperty(value = "") + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @ApiModelProperty(value = "") + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @ApiModelProperty(value = "") + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @ApiModelProperty(value = "") + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @ApiModelProperty(value = "") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @ApiModelProperty(value = "Name of the pet ") + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ClassModel.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ClassModel.java new file mode 100644 index 00000000000..16c743e4f32 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ClassModel.java @@ -0,0 +1,75 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") + +public class ClassModel { + @JsonProperty("_class") + private String propertyClass = null; + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumTest.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumTest.java index dc00d569c7e..d081e726855 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumTest.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.OuterEnum; /** * EnumTest @@ -116,6 +117,9 @@ public class EnumTest { @JsonProperty("enum_number") private EnumNumberEnum enumNumber = null; + @JsonProperty("outerEnum") + private OuterEnum outerEnum = null; + public EnumTest enumString(EnumStringEnum enumString) { this.enumString = enumString; return this; @@ -170,6 +174,24 @@ public class EnumTest { this.enumNumber = enumNumber; } + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @ApiModelProperty(value = "") + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + @Override public boolean equals(java.lang.Object o) { @@ -182,12 +204,13 @@ public class EnumTest { EnumTest enumTest = (EnumTest) o; return Objects.equals(this.enumString, enumTest.enumString) && Objects.equals(this.enumInteger, enumTest.enumInteger) && - Objects.equals(this.enumNumber, enumTest.enumNumber); + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum); } @Override public int hashCode() { - return Objects.hash(enumString, enumInteger, enumNumber); + return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); } @Override @@ -198,6 +221,7 @@ public class EnumTest { sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/FormatTest.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/FormatTest.java index 7c882eb3fee..4c4968d4aee 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/FormatTest.java @@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.Date; +import java.util.UUID; /** * FormatTest @@ -47,7 +48,7 @@ public class FormatTest { private Date dateTime = null; @JsonProperty("uuid") - private String uuid = null; + private UUID uuid = null; @JsonProperty("password") private String password = null; @@ -59,8 +60,8 @@ public class FormatTest { /** * Get integer - * minimum: 10.0 - * maximum: 100.0 + * minimum: 10 + * maximum: 100 * @return integer **/ @ApiModelProperty(value = "") @@ -79,8 +80,8 @@ public class FormatTest { /** * Get int32 - * minimum: 20.0 - * maximum: 200.0 + * minimum: 20 + * maximum: 200 * @return int32 **/ @ApiModelProperty(value = "") @@ -260,7 +261,7 @@ public class FormatTest { this.dateTime = dateTime; } - public FormatTest uuid(String uuid) { + public FormatTest uuid(UUID uuid) { this.uuid = uuid; return this; } @@ -270,11 +271,11 @@ public class FormatTest { * @return uuid **/ @ApiModelProperty(value = "") - public String getUuid() { + public UUID getUuid() { return uuid; } - public void setUuid(String uuid) { + public void setUuid(UUID uuid) { this.uuid = uuid; } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index 5a55ab81d68..0a1edad338e 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -10,6 +10,7 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; /** * MixedPropertiesAndAdditionalPropertiesClass @@ -17,7 +18,7 @@ import java.util.Map; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private String uuid = null; + private UUID uuid = null; @JsonProperty("dateTime") private Date dateTime = null; @@ -25,7 +26,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("map") private Map map = new HashMap(); - public MixedPropertiesAndAdditionalPropertiesClass uuid(String uuid) { + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { this.uuid = uuid; return this; } @@ -35,11 +36,11 @@ public class MixedPropertiesAndAdditionalPropertiesClass { * @return uuid **/ @ApiModelProperty(value = "") - public String getUuid() { + public UUID getUuid() { return uuid; } - public void setUuid(String uuid) { + public void setUuid(UUID uuid) { this.uuid = uuid; } diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/OuterEnum.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/OuterEnum.java new file mode 100644 index 00000000000..0abc3d063b5 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/OuterEnum.java @@ -0,0 +1,41 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String text) { + for (OuterEnum b : OuterEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/FakeClassnameTestApiServiceFactory.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/FakeClassnameTestApiServiceFactory.java new file mode 100644 index 00000000000..de3eca91816 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/FakeClassnameTestApiServiceFactory.java @@ -0,0 +1,12 @@ +package io.swagger.api.factories; + +import io.swagger.api.FakeClassnameTestApiService; +import io.swagger.api.impl.FakeClassnameTestApiServiceImpl; + +public class FakeClassnameTestApiServiceFactory { + private final static FakeClassnameTestApiService service = new FakeClassnameTestApiServiceImpl(); + + public static FakeClassnameTestApiService getFakeClassnameTestApi() { + return service; + } +} diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java index 43e07c14462..36f2787cd1f 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java @@ -3,9 +3,9 @@ package io.swagger.api.impl; import io.swagger.api.*; import io.swagger.model.*; +import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; -import java.math.BigDecimal; import java.util.List; import io.swagger.api.NotFoundException; @@ -52,7 +52,7 @@ public class FakeApiServiceImpl extends FakeApiService { , String enumHeaderString , List enumQueryStringArray , String enumQueryString -, BigDecimal enumQueryInteger +, Integer enumQueryInteger , Double enumQueryDouble ) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeClassnameTestApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeClassnameTestApiServiceImpl.java new file mode 100644 index 00000000000..62ffc95e626 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeClassnameTestApiServiceImpl.java @@ -0,0 +1,27 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.wso2.msf4j.formparam.FormDataParam; +import org.wso2.msf4j.formparam.FileInfo; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public class FakeClassnameTestApiServiceImpl extends FakeClassnameTestApiService { + @Override + public Response testClassname(Client body + ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java index ea6b7553a52..d298d1e45d2 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java @@ -3,9 +3,9 @@ package io.swagger.api.impl; import io.swagger.api.*; import io.swagger.model.*; -import io.swagger.model.Pet; import java.io.File; import io.swagger.model.ModelApiResponse; +import io.swagger.model.Pet; import java.util.List; import io.swagger.api.NotFoundException; diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java index babd595dca8..044080093b8 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java @@ -3,8 +3,8 @@ package io.swagger.api.impl; import io.swagger.api.*; import io.swagger.model.*; -import io.swagger.model.User; import java.util.List; +import io.swagger.model.User; import java.util.List; import io.swagger.api.NotFoundException; diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/PetApi.java index 524bc0085c1..ede723f3935 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/PetApi.java @@ -15,6 +15,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.jaxrs.PATCH; +import javax.validation.constraints.*; @Path("/v2") @Api(value = "/", description = "") @@ -37,13 +39,13 @@ public interface PetApi { @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Finds Pets by status", tags={ "pet", }) - public List findPetsByStatus(@QueryParam("status")List status); + public List findPetsByStatus(@QueryParam("status") @NotNull List status); @GET @Path("/pet/findByTags") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Finds Pets by tags", tags={ "pet", }) - public List findPetsByTags(@QueryParam("tags")List tags); + public List findPetsByTags(@QueryParam("tags") @NotNull List tags); @GET @Path("/pet/{petId}") diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/StoreApi.java index 747f772dad3..8462b041b30 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/StoreApi.java @@ -14,6 +14,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.jaxrs.PATCH; +import javax.validation.constraints.*; @Path("/v2") @Api(value = "/", description = "") diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/UserApi.java index 94d94a703fa..a6d362e3775 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/api/UserApi.java @@ -14,6 +14,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.jaxrs.PATCH; +import javax.validation.constraints.*; @Path("/v2") @Api(value = "/", description = "") @@ -53,7 +55,7 @@ public interface UserApi { @Path("/user/login") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Logs user into the system", tags={ "user", }) - public String loginUser(@QueryParam("username")String username, @QueryParam("password")String password); + public String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password); @GET @Path("/user/logout") diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Category.java index 591a6e22a69..0308c93eaf6 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Category.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -26,9 +27,16 @@ public class Category { public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public Category id(Long id) { + this.id = id; + return this; + } + /** * Get name * @return name @@ -36,10 +44,17 @@ public class Category { public String getName() { return name; } + public void setName(String name) { this.name = name; } + public Category name(String name) { + this.name = name; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/ModelApiResponse.java index f3c6f56cfc4..512f77e3c5a 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -28,9 +29,16 @@ public class ModelApiResponse { public Integer getCode() { return code; } + public void setCode(Integer code) { this.code = code; } + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + /** * Get type * @return type @@ -38,9 +46,16 @@ public class ModelApiResponse { public String getType() { return type; } + public void setType(String type) { this.type = type; } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + /** * Get message * @return message @@ -48,10 +63,17 @@ public class ModelApiResponse { public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Order.java index af6f5e0e38e..fd7aaf2729e 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Order.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -27,7 +28,7 @@ public class Order { @XmlEnum(String.class) public enum StatusEnum { - @XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") DELIVERED(String.valueOf("delivered")); +@XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") DELIVERED(String.valueOf("delivered")); private String value; @@ -67,9 +68,16 @@ public enum StatusEnum { public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public Order id(Long id) { + this.id = id; + return this; + } + /** * Get petId * @return petId @@ -77,9 +85,16 @@ public enum StatusEnum { public Long getPetId() { return petId; } + public void setPetId(Long petId) { this.petId = petId; } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + /** * Get quantity * @return quantity @@ -87,9 +102,16 @@ public enum StatusEnum { public Integer getQuantity() { return quantity; } + public void setQuantity(Integer quantity) { this.quantity = quantity; } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + /** * Get shipDate * @return shipDate @@ -97,9 +119,16 @@ public enum StatusEnum { public javax.xml.datatype.XMLGregorianCalendar getShipDate() { return shipDate; } + public void setShipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) { this.shipDate = shipDate; } + + public Order shipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) { + this.shipDate = shipDate; + return this; + } + /** * Order Status * @return status @@ -107,9 +136,16 @@ public enum StatusEnum { public StatusEnum getStatus() { return status; } + public void setStatus(StatusEnum status) { this.status = status; } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + /** * Get complete * @return complete @@ -117,10 +153,17 @@ public enum StatusEnum { public Boolean getComplete() { return complete; } + public void setComplete(Boolean complete) { this.complete = complete; } + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Pet.java index 0cfc0a30ee0..b4e4cab2fe7 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Pet.java @@ -5,6 +5,7 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -33,7 +34,7 @@ public class Pet { @XmlEnum(String.class) public enum StatusEnum { - @XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") SOLD(String.valueOf("sold")); +@XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") SOLD(String.valueOf("sold")); private String value; @@ -71,9 +72,16 @@ public enum StatusEnum { public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public Pet id(Long id) { + this.id = id; + return this; + } + /** * Get category * @return category @@ -81,29 +89,57 @@ public enum StatusEnum { public Category getCategory() { return category; } + public void setCategory(Category category) { this.category = category; } + + public Pet category(Category category) { + this.category = category; + return this; + } + /** * Get name * @return name **/ + @NotNull public String getName() { return name; } + public void setName(String name) { this.name = name; } + + public Pet name(String name) { + this.name = name; + return this; + } + /** * Get photoUrls * @return photoUrls **/ + @NotNull public List getPhotoUrls() { return photoUrls; } + public void setPhotoUrls(List photoUrls) { this.photoUrls = photoUrls; } + + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + /** * Get tags * @return tags @@ -111,9 +147,21 @@ public enum StatusEnum { public List getTags() { return tags; } + public void setTags(List tags) { this.tags = tags; } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + this.tags.add(tagsItem); + return this; + } + /** * pet status in the store * @return status @@ -121,10 +169,17 @@ public enum StatusEnum { public StatusEnum getStatus() { return status; } + public void setStatus(StatusEnum status) { this.status = status; } + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Tag.java index 4eb99ad2fc1..0db61292657 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/Tag.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -26,9 +27,16 @@ public class Tag { public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public Tag id(Long id) { + this.id = id; + return this; + } + /** * Get name * @return name @@ -36,10 +44,17 @@ public class Tag { public String getName() { return name; } + public void setName(String name) { this.name = name; } + public Tag name(String name) { + this.name = name; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/User.java index 005d9aa8c74..355c1ef9a42 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/io/swagger/model/User.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -38,9 +39,16 @@ public class User { public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public User id(Long id) { + this.id = id; + return this; + } + /** * Get username * @return username @@ -48,9 +56,16 @@ public class User { public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } + + public User username(String username) { + this.username = username; + return this; + } + /** * Get firstName * @return firstName @@ -58,9 +73,16 @@ public class User { public String getFirstName() { return firstName; } + public void setFirstName(String firstName) { this.firstName = firstName; } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + /** * Get lastName * @return lastName @@ -68,9 +90,16 @@ public class User { public String getLastName() { return lastName; } + public void setLastName(String lastName) { this.lastName = lastName; } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + /** * Get email * @return email @@ -78,9 +107,16 @@ public class User { public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } + + public User email(String email) { + this.email = email; + return this; + } + /** * Get password * @return password @@ -88,9 +124,16 @@ public class User { public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } + + public User password(String password) { + this.password = password; + return this; + } + /** * Get phone * @return phone @@ -98,9 +141,16 @@ public class User { public String getPhone() { return phone; } + public void setPhone(String phone) { this.phone = phone; } + + public User phone(String phone) { + this.phone = phone; + return this; + } + /** * User Status * @return userStatus @@ -108,10 +158,17 @@ public class User { public Integer getUserStatus() { return userStatus; } + public void setUserStatus(Integer userStatus) { this.userStatus = userStatus; } + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-cdi/swagger.json b/samples/server/petstore/jaxrs-cxf-cdi/swagger.json index 18ccb05b4ba..df8ae51dbf4 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/swagger.json +++ b/samples/server/petstore/jaxrs-cxf-cdi/swagger.json @@ -108,8 +108,8 @@ "type" : "array", "items" : { "type" : "string", - "default" : "available", - "enum" : [ "available", "pending", "sold" ] + "enum" : [ "available", "pending", "sold" ], + "default" : "available" }, "collectionFormat" : "csv" } ], diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/PetApi.java index 4ef2db0e204..d42bf02c74f 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/PetApi.java @@ -15,6 +15,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.jaxrs.PATCH; +import javax.validation.constraints.*; @Path("/") @Api(value = "/", description = "") @@ -37,13 +39,13 @@ public interface PetApi { @Path("/pet/findByStatus") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Finds Pets by status", tags={ "pet", }) - public List findPetsByStatus(@QueryParam("status")List status); + public List findPetsByStatus(@QueryParam("status") @NotNull List status); @GET @Path("/pet/findByTags") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Finds Pets by tags", tags={ "pet", }) - public List findPetsByTags(@QueryParam("tags")List tags); + public List findPetsByTags(@QueryParam("tags") @NotNull List tags); @GET @Path("/pet/{petId}") diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/StoreApi.java index e26c47769b4..4a3ffd1020b 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/StoreApi.java @@ -14,6 +14,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.jaxrs.PATCH; +import javax.validation.constraints.*; @Path("/") @Api(value = "/", description = "") diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/UserApi.java index a51b1fe0c70..a28cc95b58d 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/api/UserApi.java @@ -14,6 +14,8 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.jaxrs.PATCH; +import javax.validation.constraints.*; @Path("/") @Api(value = "/", description = "") @@ -53,7 +55,7 @@ public interface UserApi { @Path("/user/login") @Produces({ "application/xml", "application/json" }) @ApiOperation(value = "Logs user into the system", tags={ "user", }) - public String loginUser(@QueryParam("username")String username, @QueryParam("password")String password); + public String loginUser(@QueryParam("username") @NotNull String username, @QueryParam("password") @NotNull String password); @GET @Path("/user/logout") diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Category.java index 591a6e22a69..0308c93eaf6 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Category.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Category.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -26,9 +27,16 @@ public class Category { public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public Category id(Long id) { + this.id = id; + return this; + } + /** * Get name * @return name @@ -36,10 +44,17 @@ public class Category { public String getName() { return name; } + public void setName(String name) { this.name = name; } + public Category name(String name) { + this.name = name; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/ModelApiResponse.java index f3c6f56cfc4..512f77e3c5a 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -28,9 +29,16 @@ public class ModelApiResponse { public Integer getCode() { return code; } + public void setCode(Integer code) { this.code = code; } + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + /** * Get type * @return type @@ -38,9 +46,16 @@ public class ModelApiResponse { public String getType() { return type; } + public void setType(String type) { this.type = type; } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + /** * Get message * @return message @@ -48,10 +63,17 @@ public class ModelApiResponse { public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Order.java index af6f5e0e38e..fd7aaf2729e 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Order.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Order.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -27,7 +28,7 @@ public class Order { @XmlEnum(String.class) public enum StatusEnum { - @XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") DELIVERED(String.valueOf("delivered")); +@XmlEnumValue("placed") PLACED(String.valueOf("placed")), @XmlEnumValue("approved") APPROVED(String.valueOf("approved")), @XmlEnumValue("delivered") DELIVERED(String.valueOf("delivered")); private String value; @@ -67,9 +68,16 @@ public enum StatusEnum { public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public Order id(Long id) { + this.id = id; + return this; + } + /** * Get petId * @return petId @@ -77,9 +85,16 @@ public enum StatusEnum { public Long getPetId() { return petId; } + public void setPetId(Long petId) { this.petId = petId; } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + /** * Get quantity * @return quantity @@ -87,9 +102,16 @@ public enum StatusEnum { public Integer getQuantity() { return quantity; } + public void setQuantity(Integer quantity) { this.quantity = quantity; } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + /** * Get shipDate * @return shipDate @@ -97,9 +119,16 @@ public enum StatusEnum { public javax.xml.datatype.XMLGregorianCalendar getShipDate() { return shipDate; } + public void setShipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) { this.shipDate = shipDate; } + + public Order shipDate(javax.xml.datatype.XMLGregorianCalendar shipDate) { + this.shipDate = shipDate; + return this; + } + /** * Order Status * @return status @@ -107,9 +136,16 @@ public enum StatusEnum { public StatusEnum getStatus() { return status; } + public void setStatus(StatusEnum status) { this.status = status; } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + /** * Get complete * @return complete @@ -117,10 +153,17 @@ public enum StatusEnum { public Boolean getComplete() { return complete; } + public void setComplete(Boolean complete) { this.complete = complete; } + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Pet.java index 0cfc0a30ee0..b4e4cab2fe7 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Pet.java @@ -5,6 +5,7 @@ import io.swagger.model.Category; import io.swagger.model.Tag; import java.util.ArrayList; import java.util.List; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -33,7 +34,7 @@ public class Pet { @XmlEnum(String.class) public enum StatusEnum { - @XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") SOLD(String.valueOf("sold")); +@XmlEnumValue("available") AVAILABLE(String.valueOf("available")), @XmlEnumValue("pending") PENDING(String.valueOf("pending")), @XmlEnumValue("sold") SOLD(String.valueOf("sold")); private String value; @@ -71,9 +72,16 @@ public enum StatusEnum { public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public Pet id(Long id) { + this.id = id; + return this; + } + /** * Get category * @return category @@ -81,29 +89,57 @@ public enum StatusEnum { public Category getCategory() { return category; } + public void setCategory(Category category) { this.category = category; } + + public Pet category(Category category) { + this.category = category; + return this; + } + /** * Get name * @return name **/ + @NotNull public String getName() { return name; } + public void setName(String name) { this.name = name; } + + public Pet name(String name) { + this.name = name; + return this; + } + /** * Get photoUrls * @return photoUrls **/ + @NotNull public List getPhotoUrls() { return photoUrls; } + public void setPhotoUrls(List photoUrls) { this.photoUrls = photoUrls; } + + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + /** * Get tags * @return tags @@ -111,9 +147,21 @@ public enum StatusEnum { public List getTags() { return tags; } + public void setTags(List tags) { this.tags = tags; } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + this.tags.add(tagsItem); + return this; + } + /** * pet status in the store * @return status @@ -121,10 +169,17 @@ public enum StatusEnum { public StatusEnum getStatus() { return status; } + public void setStatus(StatusEnum status) { this.status = status; } + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Tag.java index 4eb99ad2fc1..0db61292657 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/Tag.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -26,9 +27,16 @@ public class Tag { public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public Tag id(Long id) { + this.id = id; + return this; + } + /** * Get name * @return name @@ -36,10 +44,17 @@ public class Tag { public String getName() { return name; } + public void setName(String name) { this.name = name; } + public Tag name(String name) { + this.name = name; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/User.java index 005d9aa8c74..355c1ef9a42 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/User.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/io/swagger/model/User.java @@ -1,6 +1,7 @@ package io.swagger.model; import io.swagger.annotations.ApiModel; +import javax.validation.constraints.*; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; @@ -38,9 +39,16 @@ public class User { public Long getId() { return id; } + public void setId(Long id) { this.id = id; } + + public User id(Long id) { + this.id = id; + return this; + } + /** * Get username * @return username @@ -48,9 +56,16 @@ public class User { public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } + + public User username(String username) { + this.username = username; + return this; + } + /** * Get firstName * @return firstName @@ -58,9 +73,16 @@ public class User { public String getFirstName() { return firstName; } + public void setFirstName(String firstName) { this.firstName = firstName; } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + /** * Get lastName * @return lastName @@ -68,9 +90,16 @@ public class User { public String getLastName() { return lastName; } + public void setLastName(String lastName) { this.lastName = lastName; } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + /** * Get email * @return email @@ -78,9 +107,16 @@ public class User { public String getEmail() { return email; } + public void setEmail(String email) { this.email = email; } + + public User email(String email) { + this.email = email; + return this; + } + /** * Get password * @return password @@ -88,9 +124,16 @@ public class User { public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } + + public User password(String password) { + this.password = password; + return this; + } + /** * Get phone * @return phone @@ -98,9 +141,16 @@ public class User { public String getPhone() { return phone; } + public void setPhone(String phone) { this.phone = phone; } + + public User phone(String phone) { + this.phone = phone; + return this; + } + /** * User Status * @return userStatus @@ -108,10 +158,17 @@ public class User { public Integer getUserStatus() { return userStatus; } + public void setUserStatus(Integer userStatus) { this.userStatus = userStatus; } + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeClassnameTags123Api.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..ebf2a57ebf7 --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeClassnameTags123Api.java @@ -0,0 +1,30 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.jaxrs.PATCH; +import javax.validation.constraints.*; + +@Path("/") +@Api(value = "/", description = "") +public interface FakeClassnameTags123Api { + + @PATCH + @Path("/fake_classname_test") + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test class name in snake case", tags={ "fake_classname_tags 123#$%^" }) + public Client testClassname(Client body); +} + diff --git a/samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/FakeClassnameTags123ApiServiceImpl.java b/samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/FakeClassnameTags123ApiServiceImpl.java new file mode 100644 index 00000000000..539edc610d9 --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/FakeClassnameTags123ApiServiceImpl.java @@ -0,0 +1,27 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.Client; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.model.wadl.Description; +import org.apache.cxf.jaxrs.model.wadl.DocTarget; + +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; + +public class FakeClassnameTags123ApiServiceImpl implements FakeClassnameTags123Api { + public Client testClassname(Client body) { + // TODO: Implement... + + return null; + } + +} + diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/FakeClassnameTags123ApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..0cbd5df920a --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/io/swagger/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,88 @@ +/** + * 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: \" \\ + * + * 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. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package io.swagger.api; + +import io.swagger.model.Client; +import org.junit.Test; +import org.junit.Before; +import static org.junit.Assert.*; + +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; + + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + + + +/** + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + + private FakeClassnameTags123Api api; + + @Before + public void setup() { + JacksonJsonProvider provider = new JacksonJsonProvider(); + List providers = new ArrayList(); + providers.add(provider); + + api = JAXRSClientFactory.create("http://petstore.swagger.io/v2", FakeClassnameTags123Api.class, providers); + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); + + ClientConfiguration config = WebClient.getConfig(client); + } + + + /** + * To test class name in snake case + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void testClassnameTest() { + Client body = null; + //Client response = api.testClassname(body); + //assertNotNull(response); + // TODO: test validations + + + } + +} diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/api/FakeClassnameTestApi.java new file mode 100644 index 00000000000..8aee5ba7a4c --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/api/FakeClassnameTestApi.java @@ -0,0 +1,33 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +import io.swagger.annotations.*; + +import java.util.List; +import javax.validation.constraints.*; + +@Path("/fake_classname_test") + +@Api(description = "the fake_classname_test API") + + + + +public class FakeClassnameTestApi { + + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^" }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Response testClassname(Client body) { + return Response.ok().entity("magic!").build(); + } +} + diff --git a/samples/server/petstore/jaxrs-spec/swagger.json b/samples/server/petstore/jaxrs-spec/swagger.json index 24eecd9e3ae..3900da4fdc1 100644 --- a/samples/server/petstore/jaxrs-spec/swagger.json +++ b/samples/server/petstore/jaxrs-spec/swagger.json @@ -108,8 +108,8 @@ "type" : "array", "items" : { "type" : "string", - "default" : "available", - "enum" : [ "available", "pending", "sold" ] + "enum" : [ "available", "pending", "sold" ], + "default" : "available" }, "collectionFormat" : "csv" } ], @@ -375,8 +375,8 @@ "description" : "ID of pet that needs to be fetched", "required" : true, "type" : "integer", - "maximum" : 5.0, - "minimum" : 1.0, + "maximum" : 5, + "minimum" : 1, "format" : "int64" } ], "responses" : { @@ -634,6 +634,32 @@ } } }, + "/fake_classname_test" : { + "patch" : { + "tags" : [ "fake_classname_tags 123#$%^" ], + "summary" : "To test class name in snake case", + "operationId" : "testClassname", + "consumes" : [ "application/json" ], + "produces" : [ "application/json" ], + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "client model", + "required" : true, + "schema" : { + "$ref" : "#/definitions/Client" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "schema" : { + "$ref" : "#/definitions/Client" + } + } + } + } + }, "/fake" : { "get" : { "tags" : [ "fake" ], @@ -650,8 +676,8 @@ "type" : "array", "items" : { "type" : "string", - "default" : "$", - "enum" : [ ">", "$" ] + "enum" : [ ">", "$" ], + "default" : "$" } }, { "name" : "enum_form_string", @@ -669,8 +695,8 @@ "type" : "array", "items" : { "type" : "string", - "default" : "$", - "enum" : [ ">", "$" ] + "enum" : [ ">", "$" ], + "default" : "$" } }, { "name" : "enum_header_string", @@ -688,8 +714,8 @@ "type" : "array", "items" : { "type" : "string", - "default" : "$", - "enum" : [ ">", "$" ] + "enum" : [ ">", "$" ], + "default" : "$" } }, { "name" : "enum_query_string", @@ -705,14 +731,16 @@ "description" : "Query parameter enum test (double)", "required" : false, "type" : "integer", - "format" : "int32" + "format" : "int32", + "enum" : [ 1, -2 ] }, { "name" : "enum_query_double", "in" : "formData", "description" : "Query parameter enum test (double)", "required" : false, "type" : "number", - "format" : "double" + "format" : "double", + "enum" : [ 1.1, -1.2 ] } ], "responses" : { "400" : { @@ -736,16 +764,16 @@ "description" : "None", "required" : false, "type" : "integer", - "maximum" : 100.0, - "minimum" : 10.0 + "maximum" : 100, + "minimum" : 10 }, { "name" : "int32", "in" : "formData", "description" : "None", "required" : false, "type" : "integer", - "maximum" : 200.0, - "minimum" : 20.0, + "maximum" : 200, + "minimum" : 20, "format" : "int32" }, { "name" : "int64", @@ -886,13 +914,13 @@ "read:pets" : "read your pets" } }, - "http_basic_test" : { - "type" : "basic" - }, "api_key" : { "type" : "apiKey", "name" : "api_key", "in" : "header" + }, + "http_basic_test" : { + "type" : "basic" } }, "definitions" : { diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApi.java index ed62cb80017..29311ed5be8 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApi.java @@ -92,8 +92,8 @@ public class FakeApi { @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)") @QueryParam("enum_query_integer") Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)") @FormParam("enum_query_double") Double enumQueryDouble, + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @FormParam("enum_query_double") Double enumQueryDouble, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testEnumParameters(enumFormStringArray,enumFormString,enumHeaderStringArray,enumHeaderString,enumQueryStringArray,enumQueryString,enumQueryInteger,enumQueryDouble,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeClassnameTestApi.java new file mode 100644 index 00000000000..75efdcb2f90 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeClassnameTestApi.java @@ -0,0 +1,49 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.FakeClassnameTestApiService; +import io.swagger.api.factories.FakeClassnameTestApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import com.sun.jersey.multipart.FormDataParam; +import javax.validation.constraints.*; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/fake_classname_test") + + +@io.swagger.annotations.Api(description = "the fake_classname_test API") + +public class FakeClassnameTestApi { + private final FakeClassnameTestApiService delegate = FakeClassnameTestApiServiceFactory.getFakeClassnameTestApi(); + + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^" }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Response testClassname( + @ApiParam(value = "client model" ,required=true) Client body, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testClassname(body,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeClassnameTestApiService.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeClassnameTestApiService.java new file mode 100644 index 00000000000..7dd1c6de0e4 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeClassnameTestApiService.java @@ -0,0 +1,25 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import com.sun.jersey.multipart.FormDataParam; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public abstract class FakeClassnameTestApiService { + public abstract Response testClassname(Client body,SecurityContext securityContext) + throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/FakeClassnameTestApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/FakeClassnameTestApiServiceFactory.java new file mode 100644 index 00000000000..dc123113010 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/factories/FakeClassnameTestApiServiceFactory.java @@ -0,0 +1,13 @@ +package io.swagger.api.factories; + +import io.swagger.api.FakeClassnameTestApiService; +import io.swagger.api.impl.FakeClassnameTestApiServiceImpl; + + +public class FakeClassnameTestApiServiceFactory { + private final static FakeClassnameTestApiService service = new FakeClassnameTestApiServiceImpl(); + + public static FakeClassnameTestApiService getFakeClassnameTestApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/FakeClassnameTestApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/FakeClassnameTestApiServiceImpl.java new file mode 100644 index 00000000000..071dbe62e15 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/FakeClassnameTestApiServiceImpl.java @@ -0,0 +1,29 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import com.sun.jersey.multipart.FormDataParam; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import com.sun.jersey.core.header.FormDataContentDisposition; +import com.sun.jersey.multipart.FormDataParam; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public class FakeClassnameTestApiServiceImpl extends FakeClassnameTestApiService { + @Override + public Response testClassname(Client body, SecurityContext securityContext) + throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java index 16854fbaf4d..229e2781bd2 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java @@ -89,8 +89,8 @@ public class FakeApi { ,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString ,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List enumQueryStringArray ,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString -,@ApiParam(value = "Query parameter enum test (double)") @QueryParam("enum_query_integer") Integer enumQueryInteger -,@ApiParam(value = "Query parameter enum test (double)") @FormParam("enum_query_double") Double enumQueryDouble +,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger +,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @FormParam("enum_query_double") Double enumQueryDouble ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testEnumParameters(enumFormStringArray,enumFormString,enumHeaderStringArray,enumHeaderString,enumQueryStringArray,enumQueryString,enumQueryInteger,enumQueryDouble,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeClassnameTestApi.java new file mode 100644 index 00000000000..9340a5f6027 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeClassnameTestApi.java @@ -0,0 +1,46 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.FakeClassnameTestApiService; +import io.swagger.api.factories.FakeClassnameTestApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; +import javax.validation.constraints.*; + +@Path("/fake_classname_test") + + +@io.swagger.annotations.Api(description = "the fake_classname_test API") + +public class FakeClassnameTestApi { + private final FakeClassnameTestApiService delegate = FakeClassnameTestApiServiceFactory.getFakeClassnameTestApi(); + + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Response testClassname(@ApiParam(value = "client model" ,required=true) Client body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.testClassname(body,securityContext); + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeClassnameTestApiService.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeClassnameTestApiService.java new file mode 100644 index 00000000000..9bf76fef9ef --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeClassnameTestApiService.java @@ -0,0 +1,21 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public abstract class FakeClassnameTestApiService { + public abstract Response testClassname(Client body,SecurityContext securityContext) throws NotFoundException; +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/FakeClassnameTestApiServiceFactory.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/FakeClassnameTestApiServiceFactory.java new file mode 100644 index 00000000000..dc123113010 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/factories/FakeClassnameTestApiServiceFactory.java @@ -0,0 +1,13 @@ +package io.swagger.api.factories; + +import io.swagger.api.FakeClassnameTestApiService; +import io.swagger.api.impl.FakeClassnameTestApiServiceImpl; + + +public class FakeClassnameTestApiServiceFactory { + private final static FakeClassnameTestApiService service = new FakeClassnameTestApiServiceImpl(); + + public static FakeClassnameTestApiService getFakeClassnameTestApi() { + return service; + } +} diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/FakeClassnameTestApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/FakeClassnameTestApiServiceImpl.java new file mode 100644 index 00000000000..2d77e24e3e4 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/FakeClassnameTestApiServiceImpl.java @@ -0,0 +1,25 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import io.swagger.model.Client; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.validation.constraints.*; + +public class FakeClassnameTestApiServiceImpl extends FakeClassnameTestApiService { + @Override + public Response testClassname(Client body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/lumen/lib/app/Http/Controllers/FakeApi.php b/samples/server/petstore/lumen/lib/app/Http/Controllers/FakeApi.php index 4dbbb8e28f8..5015f10d5b6 100644 --- a/samples/server/petstore/lumen/lib/app/Http/Controllers/FakeApi.php +++ b/samples/server/petstore/lumen/lib/app/Http/Controllers/FakeApi.php @@ -101,19 +101,19 @@ class FakeApi extends Controller } $byte = $input['byte']; - if ($input['integer'] > 100.0) { - throw new \InvalidArgumentException('invalid value for $integer when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.0.'); + if ($input['integer'] > 100) { + throw new \InvalidArgumentException('invalid value for $integer when calling FakeApi.testEndpointParameters, must be smaller than or equal to 100.'); } - if ($input['integer'] < 10.0) { - throw new \InvalidArgumentException('invalid value for $integer when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.0.'); + if ($input['integer'] < 10) { + throw new \InvalidArgumentException('invalid value for $integer when calling FakeApi.testEndpointParameters, must be bigger than or equal to 10.'); } $integer = $input['integer']; - if ($input['int32'] > 200.0) { - throw new \InvalidArgumentException('invalid value for $int32 when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.0.'); + if ($input['int32'] > 200) { + throw new \InvalidArgumentException('invalid value for $int32 when calling FakeApi.testEndpointParameters, must be smaller than or equal to 200.'); } - if ($input['int32'] < 20.0) { - throw new \InvalidArgumentException('invalid value for $int32 when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.0.'); + if ($input['int32'] < 20) { + throw new \InvalidArgumentException('invalid value for $int32 when calling FakeApi.testEndpointParameters, must be bigger than or equal to 20.'); } $int32 = $input['int32']; diff --git a/samples/server/petstore/lumen/lib/app/Http/Controllers/Fake_classname_tags123Api.php b/samples/server/petstore/lumen/lib/app/Http/Controllers/Fake_classname_tags123Api.php new file mode 100644 index 00000000000..417d9b727b0 --- /dev/null +++ b/samples/server/petstore/lumen/lib/app/Http/Controllers/Fake_classname_tags123Api.php @@ -0,0 +1,53 @@ + 5.0) { - throw new \InvalidArgumentException('invalid value for $order_id when calling StoreApi.getOrderById, must be smaller than or equal to 5.0.'); + if ($order_id] > 5) { + throw new \InvalidArgumentException('invalid value for $order_id when calling StoreApi.getOrderById, must be smaller than or equal to 5.'); } - if ($order_id] < 1.0) { - throw new \InvalidArgumentException('invalid value for $order_id when calling StoreApi.getOrderById, must be bigger than or equal to 1.0.'); + if ($order_id] < 1) { + throw new \InvalidArgumentException('invalid value for $order_id when calling StoreApi.getOrderById, must be bigger than or equal to 1.'); } diff --git a/samples/server/petstore/lumen/lib/app/Http/routes.php b/samples/server/petstore/lumen/lib/app/Http/routes.php index f358d7e2c8c..b5ce5e4666c 100644 --- a/samples/server/petstore/lumen/lib/app/Http/routes.php +++ b/samples/server/petstore/lumen/lib/app/Http/routes.php @@ -24,7 +24,7 @@ $app->get('/', function () use ($app) { /** * PATCH testClientModel * Summary: To test \"client\" model - * Notes: + * Notes: To test \"client\" model * Output-Formats: [application/json] */ $app->PATCH('/v2/fake', 'FakeApi@testClientModel'); @@ -38,10 +38,17 @@ $app->POST('/v2/fake', 'FakeApi@testEndpointParameters'); /** * GET testEnumParameters * Summary: To test enum parameters - * Notes: + * Notes: To test enum parameters * Output-Formats: [*/*] */ $app->GET('/v2/fake', 'FakeApi@testEnumParameters'); +/** + * PATCH testClassname + * Summary: To test class name in snake case + * Notes: + * Output-Formats: [application/json] + */ +$app->PATCH('/v2/fake_classname_test', 'Fake_classname_tags123Api@testClassname'); /** * POST addPet * Summary: Add a new pet to the store diff --git a/samples/server/petstore/nancyfx/IO.Swagger.sln b/samples/server/petstore/nancyfx/IO.Swagger.sln index 38fb0ef476a..19c39f00b32 100644 --- a/samples/server/petstore/nancyfx/IO.Swagger.sln +++ b/samples/server/petstore/nancyfx/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{9A5C2190-C960-4808-93CB-8721C1022F9B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{919EE99D-6431-4ADA-AADF-E1F6D37925D3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -10,10 +10,10 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution -{9A5C2190-C960-4808-93CB-8721C1022F9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU -{9A5C2190-C960-4808-93CB-8721C1022F9B}.Debug|Any CPU.Build.0 = Debug|Any CPU -{9A5C2190-C960-4808-93CB-8721C1022F9B}.Release|Any CPU.ActiveCfg = Release|Any CPU -{9A5C2190-C960-4808-93CB-8721C1022F9B}.Release|Any CPU.Build.0 = Release|Any CPU +{919EE99D-6431-4ADA-AADF-E1F6D37925D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{919EE99D-6431-4ADA-AADF-E1F6D37925D3}.Debug|Any CPU.Build.0 = Debug|Any CPU +{919EE99D-6431-4ADA-AADF-E1F6D37925D3}.Release|Any CPU.ActiveCfg = Release|Any CPU +{919EE99D-6431-4ADA-AADF-E1F6D37925D3}.Release|Any CPU.Build.0 = Release|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj b/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj index 8bccfa94485..2af204e77f2 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - {9A5C2190-C960-4808-93CB-8721C1022F9B} + {919EE99D-6431-4ADA-AADF-E1F6D37925D3} Library Properties IO.Swagger.v2 diff --git a/samples/server/petstore/nodejs-google-cloud-functions/.swagger-codegen-ignore b/samples/server/petstore/nodejs-google-cloud-functions/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/server/petstore/nodejs-google-cloud-functions/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/nodejs-google-cloud-functions/api/swagger.yaml b/samples/server/petstore/nodejs-google-cloud-functions/api/swagger.yaml index b47e700ae1f..a2b8cd0f5cc 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/api/swagger.yaml +++ b/samples/server/petstore/nodejs-google-cloud-functions/api/swagger.yaml @@ -108,11 +108,11 @@ paths: type: "array" items: type: "string" - default: "available" enum: - "available" - "pending" - "sold" + default: "available" collectionFormat: "csv" responses: 200: @@ -385,7 +385,6 @@ paths: description: "ID of the order that needs to be deleted" required: true type: "string" - minimum: 1 responses: 400: description: "Invalid ID supplied" diff --git a/samples/server/petstore/nodejs-google-cloud-functions/controllers/Pet.js b/samples/server/petstore/nodejs-google-cloud-functions/controllers/Pet.js index 3748305bfbe..5ff24c0591f 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/controllers/Pet.js +++ b/samples/server/petstore/nodejs-google-cloud-functions/controllers/Pet.js @@ -2,10 +2,8 @@ var url = require('url'); - var Pet = require('./PetService'); - module.exports.addPet = function addPet (req, res, next) { Pet.addPet(req.swagger.params, res, next); }; diff --git a/samples/server/petstore/nodejs-google-cloud-functions/controllers/PetService.js b/samples/server/petstore/nodejs-google-cloud-functions/controllers/PetService.js index c8da68c1519..f9c7f30378b 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/controllers/PetService.js +++ b/samples/server/petstore/nodejs-google-cloud-functions/controllers/PetService.js @@ -2,29 +2,36 @@ exports.addPet = function(args, res, next) { /** - * parameters expected in the args: - * body (Pet) - **/ - // no response value expected for this operation + * Add a new pet to the store + * + * + * body Pet Pet object that needs to be added to the store + * no response value expected for this operation + **/ res.end(); } exports.deletePet = function(args, res, next) { /** - * parameters expected in the args: - * petId (Long) - * api_key (String) - **/ - // no response value expected for this operation + * Deletes a pet + * + * + * petId Long Pet id to delete + * api_key String (optional) + * no response value expected for this operation + **/ res.end(); } exports.findPetsByStatus = function(args, res, next) { /** - * parameters expected in the args: - * status (List) - **/ - var examples = {}; + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * + * status List Status values that need to be considered for filter + * returns List + **/ + var examples = {}; examples['application/json'] = [ { "photoUrls" : [ "aeiou" ], "name" : "doggie", @@ -39,22 +46,23 @@ exports.findPetsByStatus = function(args, res, next) { } ], "status" : "aeiou" } ]; - if(Object.keys(examples).length > 0) { + if (Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); - } - else { + } else { res.end(); } - } exports.findPetsByTags = function(args, res, next) { /** - * parameters expected in the args: - * tags (List) - **/ - var examples = {}; + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * tags List Tags to filter by + * returns List + **/ + var examples = {}; examples['application/json'] = [ { "photoUrls" : [ "aeiou" ], "name" : "doggie", @@ -69,22 +77,23 @@ exports.findPetsByTags = function(args, res, next) { } ], "status" : "aeiou" } ]; - if(Object.keys(examples).length > 0) { + if (Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); - } - else { + } else { res.end(); } - } exports.getPetById = function(args, res, next) { /** - * parameters expected in the args: - * petId (Long) - **/ - var examples = {}; + * Find pet by ID + * Returns a single pet + * + * petId Long ID of pet to return + * returns Pet + **/ + var examples = {}; examples['application/json'] = { "photoUrls" : [ "aeiou" ], "name" : "doggie", @@ -99,56 +108,59 @@ exports.getPetById = function(args, res, next) { } ], "status" : "aeiou" }; - if(Object.keys(examples).length > 0) { + if (Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); - } - else { + } else { res.end(); } - } exports.updatePet = function(args, res, next) { /** - * parameters expected in the args: - * body (Pet) - **/ - // no response value expected for this operation + * Update an existing pet + * + * + * body Pet Pet object that needs to be added to the store + * no response value expected for this operation + **/ res.end(); } exports.updatePetWithForm = function(args, res, next) { /** - * parameters expected in the args: - * petId (Long) - * name (String) - * status (String) - **/ - // no response value expected for this operation + * Updates a pet in the store with form data + * + * + * petId Long ID of pet that needs to be updated + * name String Updated name of the pet (optional) + * status String Updated status of the pet (optional) + * no response value expected for this operation + **/ res.end(); } exports.uploadFile = function(args, res, next) { /** - * parameters expected in the args: - * petId (Long) - * additionalMetadata (String) - * file (File) - **/ - var examples = {}; + * uploads an image + * + * + * petId Long ID of pet to update + * additionalMetadata String Additional data to pass to server (optional) + * file File file to upload (optional) + * returns ApiResponse + **/ + var examples = {}; examples['application/json'] = { "code" : 123, "type" : "aeiou", "message" : "aeiou" }; - if(Object.keys(examples).length > 0) { + if (Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); - } - else { + } else { res.end(); } - } diff --git a/samples/server/petstore/nodejs-google-cloud-functions/controllers/Store.js b/samples/server/petstore/nodejs-google-cloud-functions/controllers/Store.js index ac67c740d29..94d86b7b590 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/controllers/Store.js +++ b/samples/server/petstore/nodejs-google-cloud-functions/controllers/Store.js @@ -2,10 +2,8 @@ var url = require('url'); - var Store = require('./StoreService'); - module.exports.deleteOrder = function deleteOrder (req, res, next) { Store.deleteOrder(req.swagger.params, res, next); }; diff --git a/samples/server/petstore/nodejs-google-cloud-functions/controllers/StoreService.js b/samples/server/petstore/nodejs-google-cloud-functions/controllers/StoreService.js index aed5113a915..d56502daf03 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/controllers/StoreService.js +++ b/samples/server/petstore/nodejs-google-cloud-functions/controllers/StoreService.js @@ -2,37 +2,43 @@ exports.deleteOrder = function(args, res, next) { /** - * parameters expected in the args: - * orderId (String) - **/ - // no response value expected for this operation + * Delete purchase order by ID + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * orderId String ID of the order that needs to be deleted + * no response value expected for this operation + **/ res.end(); } exports.getInventory = function(args, res, next) { /** - * parameters expected in the args: - **/ - var examples = {}; + * Returns pet inventories by status + * Returns a map of status codes to quantities + * + * returns Map + **/ + var examples = {}; examples['application/json'] = { "key" : 123 }; - if(Object.keys(examples).length > 0) { + if (Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); - } - else { + } else { res.end(); } - } exports.getOrderById = function(args, res, next) { /** - * parameters expected in the args: - * orderId (Long) - **/ - var examples = {}; + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * orderId Long ID of pet that needs to be fetched + * returns Order + **/ + var examples = {}; examples['application/json'] = { "petId" : 123456789, "quantity" : 123, @@ -41,22 +47,23 @@ exports.getOrderById = function(args, res, next) { "complete" : true, "status" : "aeiou" }; - if(Object.keys(examples).length > 0) { + if (Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); - } - else { + } else { res.end(); } - } exports.placeOrder = function(args, res, next) { /** - * parameters expected in the args: - * body (Order) - **/ - var examples = {}; + * Place an order for a pet + * + * + * body Order order placed for purchasing the pet + * returns Order + **/ + var examples = {}; examples['application/json'] = { "petId" : 123456789, "quantity" : 123, @@ -65,13 +72,11 @@ exports.placeOrder = function(args, res, next) { "complete" : true, "status" : "aeiou" }; - if(Object.keys(examples).length > 0) { + if (Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); - } - else { + } else { res.end(); } - } diff --git a/samples/server/petstore/nodejs-google-cloud-functions/controllers/User.js b/samples/server/petstore/nodejs-google-cloud-functions/controllers/User.js index bac1d7f6a88..4b118e8211d 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/controllers/User.js +++ b/samples/server/petstore/nodejs-google-cloud-functions/controllers/User.js @@ -2,10 +2,8 @@ var url = require('url'); - var User = require('./UserService'); - module.exports.createUser = function createUser (req, res, next) { User.createUser(req.swagger.params, res, next); }; diff --git a/samples/server/petstore/nodejs-google-cloud-functions/controllers/UserService.js b/samples/server/petstore/nodejs-google-cloud-functions/controllers/UserService.js index 3a62feeaf3f..5b4fe750d7d 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/controllers/UserService.js +++ b/samples/server/petstore/nodejs-google-cloud-functions/controllers/UserService.js @@ -2,46 +2,57 @@ exports.createUser = function(args, res, next) { /** - * parameters expected in the args: - * body (User) - **/ - // no response value expected for this operation + * Create user + * This can only be done by the logged in user. + * + * body User Created user object + * no response value expected for this operation + **/ res.end(); } exports.createUsersWithArrayInput = function(args, res, next) { /** - * parameters expected in the args: - * body (List) - **/ - // no response value expected for this operation + * Creates list of users with given input array + * + * + * body List List of user object + * no response value expected for this operation + **/ res.end(); } exports.createUsersWithListInput = function(args, res, next) { /** - * parameters expected in the args: - * body (List) - **/ - // no response value expected for this operation + * Creates list of users with given input array + * + * + * body List List of user object + * no response value expected for this operation + **/ res.end(); } exports.deleteUser = function(args, res, next) { /** - * parameters expected in the args: - * username (String) - **/ - // no response value expected for this operation + * Delete user + * This can only be done by the logged in user. + * + * username String The name that needs to be deleted + * no response value expected for this operation + **/ res.end(); } exports.getUserByName = function(args, res, next) { /** - * parameters expected in the args: - * username (String) - **/ - var examples = {}; + * Get user by user name + * + * + * username String The name that needs to be fetched. Use user1 for testing. + * returns User + **/ + var examples = {}; examples['application/json'] = { "firstName" : "aeiou", "lastName" : "aeiou", @@ -52,49 +63,52 @@ exports.getUserByName = function(args, res, next) { "email" : "aeiou", "username" : "aeiou" }; - if(Object.keys(examples).length > 0) { + if (Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); - } - else { + } else { res.end(); } - } exports.loginUser = function(args, res, next) { /** - * parameters expected in the args: - * username (String) - * password (String) - **/ - var examples = {}; + * Logs user into the system + * + * + * username String The user name for login + * password String The password for login in clear text + * returns String + **/ + var examples = {}; examples['application/json'] = "aeiou"; - if(Object.keys(examples).length > 0) { + if (Object.keys(examples).length > 0) { res.setHeader('Content-Type', 'application/json'); res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2)); - } - else { + } else { res.end(); } - } exports.logoutUser = function(args, res, next) { /** - * parameters expected in the args: - **/ - // no response value expected for this operation + * Logs out current logged in user session + * + * + * no response value expected for this operation + **/ res.end(); } exports.updateUser = function(args, res, next) { /** - * parameters expected in the args: - * username (String) - * body (User) - **/ - // no response value expected for this operation + * Updated user + * This can only be done by the logged in user. + * + * username String name that need to be deleted + * body User Updated user object + * no response value expected for this operation + **/ res.end(); } diff --git a/samples/server/petstore/nodejs/.swagger-codegen-ignore b/samples/server/petstore/nodejs/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/server/petstore/nodejs/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/nodejs/api/swagger.yaml b/samples/server/petstore/nodejs/api/swagger.yaml index 64049d2fdcc..a2b8cd0f5cc 100644 --- a/samples/server/petstore/nodejs/api/swagger.yaml +++ b/samples/server/petstore/nodejs/api/swagger.yaml @@ -108,11 +108,11 @@ paths: type: "array" items: type: "string" - default: "available" enum: - "available" - "pending" - "sold" + default: "available" collectionFormat: "csv" responses: 200: @@ -356,8 +356,8 @@ paths: description: "ID of pet that needs to be fetched" required: true type: "integer" - maximum: 5.0 - minimum: 1.0 + maximum: 5 + minimum: 1 format: "int64" responses: 200: @@ -586,10 +586,6 @@ paths: description: "User not found" x-swagger-router-controller: "User" securityDefinitions: - api_key: - type: "apiKey" - name: "api_key" - in: "header" petstore_auth: type: "oauth2" authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" @@ -597,6 +593,10 @@ securityDefinitions: scopes: write:pets: "modify pets in your account" read:pets: "read your pets" + api_key: + type: "apiKey" + name: "api_key" + in: "header" definitions: Order: type: "object" diff --git a/samples/server/petstore/nodejs/service/PetService.js b/samples/server/petstore/nodejs/service/PetService.js index b875a7d83b1..610a704542c 100644 --- a/samples/server/petstore/nodejs/service/PetService.js +++ b/samples/server/petstore/nodejs/service/PetService.js @@ -41,18 +41,18 @@ exports.findPetsByStatus = function(status) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = [ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" } ]; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); @@ -74,18 +74,18 @@ exports.findPetsByTags = function(tags) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = [ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" } ]; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); @@ -107,18 +107,18 @@ exports.getPetById = function(petId) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); @@ -172,9 +172,9 @@ exports.uploadFile = function(petId,additionalMetadata,file) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = { - "message" : "aeiou", "code" : 123, - "type" : "aeiou" + "type" : "aeiou", + "message" : "aeiou" }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); diff --git a/samples/server/petstore/nodejs/service/StoreService.js b/samples/server/petstore/nodejs/service/StoreService.js index 3bdcae7ad80..799e2638c33 100644 --- a/samples/server/petstore/nodejs/service/StoreService.js +++ b/samples/server/petstore/nodejs/service/StoreService.js @@ -47,12 +47,12 @@ exports.getOrderById = function(orderId) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = { - "id" : 123456789, "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+00:00" + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+00:00", + "complete" : true, + "status" : "aeiou" }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); @@ -74,12 +74,12 @@ exports.placeOrder = function(body) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = { - "id" : 123456789, "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+00:00" + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+00:00", + "complete" : true, + "status" : "aeiou" }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); diff --git a/samples/server/petstore/nodejs/service/UserService.js b/samples/server/petstore/nodejs/service/UserService.js index 6b15ac09636..4f4319c13db 100644 --- a/samples/server/petstore/nodejs/service/UserService.js +++ b/samples/server/petstore/nodejs/service/UserService.js @@ -68,14 +68,14 @@ exports.getUserByName = function(username) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = { - "id" : 123456789, - "lastName" : "aeiou", - "phone" : "aeiou", - "username" : "aeiou", - "email" : "aeiou", - "userStatus" : 123, "firstName" : "aeiou", - "password" : "aeiou" + "lastName" : "aeiou", + "password" : "aeiou", + "userStatus" : 123, + "phone" : "aeiou", + "id" : 123456789, + "email" : "aeiou", + "username" : "aeiou" }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); diff --git a/samples/server/petstore/rails5/README.md b/samples/server/petstore/rails5/README.md index 841b82ad656..91fe3051c49 100644 --- a/samples/server/petstore/rails5/README.md +++ b/samples/server/petstore/rails5/README.md @@ -1,6 +1,6 @@ # Swagger for Rails 5 -This is a project to provide Swagger support inside the [Sinatra](http://rubyonrails.org/) framework. +This is a project to provide Swagger support inside the [Ruby on Rails](http://rubyonrails.org/) framework. ## Prerequisites You need to install ruby >= 2.2.2 and run: diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/PetApi.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/PetApi.scala index 2353b35ff76..7c6d352ae5d 100644 --- a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/PetApi.scala +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/PetApi.scala @@ -63,7 +63,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet parameters(pathParam[Long]("petId").description(""), headerParam[String]("apiKey").description("").optional) ) - delete("/pet/{petId}",operation(deletePetOperation)) { + delete("/pet/:petId",operation(deletePetOperation)) { val petId = params.getOrElse("petId", halt(400)) @@ -131,7 +131,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet parameters(pathParam[Long]("petId").description("")) ) - get("/pet/{petId}",operation(getPetByIdOperation)) { + get("/pet/:petId",operation(getPetByIdOperation)) { val petId = params.getOrElse("petId", halt(400)) @@ -161,7 +161,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet parameters(pathParam[Long]("petId").description(""), formParam[String]("name").description("").optional, formParam[String]("status").description("").optional) ) - post("/pet/{petId}",operation(updatePetWithFormOperation)) { + post("/pet/:petId",operation(updatePetWithFormOperation)) { val petId = params.getOrElse("petId", halt(400)) @@ -186,7 +186,7 @@ class PetApi (implicit val swagger: Swagger) extends ScalatraServlet parameters(pathParam[Long]("petId").description(""), formParam[String]("additionalMetadata").description("").optional, formParam[File]("file").description("").optional) ) - post("/pet/{petId}/uploadImage",operation(uploadFileOperation)) { + post("/pet/:petId/uploadImage",operation(uploadFileOperation)) { val petId = params.getOrElse("petId", halt(400)) diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/StoreApi.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/StoreApi.scala index 44e41f4d1e8..58af1ba24f5 100644 --- a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/StoreApi.scala +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/StoreApi.scala @@ -46,7 +46,7 @@ class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet parameters(pathParam[String]("orderId").description("")) ) - delete("/store/order/{orderId}",operation(deleteOrderOperation)) { + delete("/store/order/:orderId",operation(deleteOrderOperation)) { val orderId = params.getOrElse("orderId", halt(400)) @@ -71,7 +71,7 @@ class StoreApi (implicit val swagger: Swagger) extends ScalatraServlet parameters(pathParam[Long]("orderId").description("")) ) - get("/store/order/{orderId}",operation(getOrderByIdOperation)) { + get("/store/order/:orderId",operation(getOrderByIdOperation)) { val orderId = params.getOrElse("orderId", halt(400)) diff --git a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/UserApi.scala b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/UserApi.scala index 8b8630675b1..8dfcc672c26 100644 --- a/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/UserApi.scala +++ b/samples/server/petstore/scalatra/src/main/scala/com/wordnik/client/api/UserApi.scala @@ -93,6 +93,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet delete("/user/:username",operation(deleteUserOperation)) { + val username = params.getOrElse("username", halt(400)) println("username: " + username) @@ -107,6 +108,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet get("/user/:username",operation(getUserByNameOperation)) { + val username = params.getOrElse("username", halt(400)) println("username: " + username) @@ -151,6 +153,7 @@ class UserApi (implicit val swagger: Swagger) extends ScalatraServlet put("/user/:username",operation(updateUserOperation)) { + val username = params.getOrElse("username", halt(400)) println("username: " + username) diff --git a/samples/server/petstore/sinatra/swagger.yaml b/samples/server/petstore/sinatra/swagger.yaml index 53ce6c55e97..60c76985c52 100644 --- a/samples/server/petstore/sinatra/swagger.yaml +++ b/samples/server/petstore/sinatra/swagger.yaml @@ -106,11 +106,11 @@ paths: type: "array" items: type: "string" - default: "available" enum: - "available" - "pending" - "sold" + default: "available" collectionFormat: "csv" responses: 200: @@ -346,8 +346,8 @@ paths: description: "ID of pet that needs to be fetched" required: true type: "integer" - maximum: 5.0 - minimum: 1.0 + maximum: 5 + minimum: 1 format: "int64" responses: 200: @@ -374,7 +374,6 @@ paths: description: "ID of the order that needs to be deleted" required: true type: "string" - minimum: 1.0 responses: 400: description: "Invalid ID supplied" @@ -567,10 +566,6 @@ paths: 404: description: "User not found" securityDefinitions: - api_key: - type: "apiKey" - name: "api_key" - in: "header" petstore_auth: type: "oauth2" authorizationUrl: "http://petstore.swagger.io/api/oauth/dialog" @@ -578,6 +573,10 @@ securityDefinitions: scopes: write:pets: "modify pets in your account" read:pets: "read your pets" + api_key: + type: "apiKey" + name: "api_key" + in: "header" definitions: Order: type: "object" 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 9590001aab3..3a94a4839ea 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 @@ -80,8 +80,8 @@ public interface FakeApi { @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { // do some magic! return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); } 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 2feb92b12e5..ea1d9adad60 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 @@ -72,7 +72,7 @@ public interface FakeApi { @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble); + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enumQueryDouble", 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 c984ea73b68..246ea137663 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 @@ -55,8 +55,8 @@ public class FakeApiController implements FakeApi { @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enumQueryDouble", 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/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java index cbdd93952b8..d0971e67319 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 @@ -79,8 +79,8 @@ public interface FakeApi { @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enumQueryDouble", 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 6e162ee2183..3270b147f4d 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 @@ -60,8 +60,8 @@ public class FakeApiController implements FakeApi { @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { // do some magic! return delegate.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApi.java new file mode 100644 index 00000000000..52cb57fec1f --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApi.java @@ -0,0 +1,35 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +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.util.List; +import javax.validation.constraints.*; + +@Api(value = "fake_classname_test", description = "the fake_classname_test API") +public interface FakeClassnameTestApi { + + @ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake_classname_test", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + default ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + +} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApiController.java new file mode 100644 index 00000000000..f336b2738f2 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApiController.java @@ -0,0 +1,36 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +import javax.validation.constraints.*; + +@Controller +public class FakeClassnameTestApiController implements FakeClassnameTestApi { + private final FakeClassnameTestApiDelegate delegate; + + @org.springframework.beans.factory.annotation.Autowired + FakeClassnameTestApiController(FakeClassnameTestApiDelegate delegate) { + this.delegate = delegate; + } + + + public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body) { + // do some magic! + return delegate.testClassname(body); + } + +} diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApiDelegate.java new file mode 100644 index 00000000000..4177e820636 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeClassnameTestApiDelegate.java @@ -0,0 +1,28 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + * A delegate to be called by the {@link FakeClassnameTestApiController}}. + * Should be implemented as a controller but without the {@link org.springframework.stereotype.Controller} annotation. + * Instead, use spring to autowire this class into the {@link FakeClassnameTestApiController}. + */ + +public interface FakeClassnameTestApiDelegate { + + /** + * @see FakeClassnameTestApi#testClassname + */ + default ResponseEntity testClassname(Client body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + +} 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 2feb92b12e5..ea1d9adad60 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 @@ -72,7 +72,7 @@ public interface FakeApi { @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble); + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enumQueryDouble", 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 1162a0ba093..c4cb7e66869 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 @@ -60,8 +60,8 @@ public class FakeApiController implements FakeApi { @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { // do some magic! return delegate.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApi.java new file mode 100644 index 00000000000..bf962faa6fd --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApi.java @@ -0,0 +1,31 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +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.util.List; +import javax.validation.constraints.*; + +@Api(value = "fake_classname_test", description = "the fake_classname_test API") +public interface FakeClassnameTestApi { + + @ApiOperation(value = "To test class name in snake case", notes = "", response = Client.class, tags={ "fake_classname_tags 123#$%^", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake_classname_test", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body); + +} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApiController.java new file mode 100644 index 00000000000..f336b2738f2 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApiController.java @@ -0,0 +1,36 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +import javax.validation.constraints.*; + +@Controller +public class FakeClassnameTestApiController implements FakeClassnameTestApi { + private final FakeClassnameTestApiDelegate delegate; + + @org.springframework.beans.factory.annotation.Autowired + FakeClassnameTestApiController(FakeClassnameTestApiDelegate delegate) { + this.delegate = delegate; + } + + + public ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body) { + // do some magic! + return delegate.testClassname(body); + } + +} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApiDelegate.java new file mode 100644 index 00000000000..35615202ad3 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeClassnameTestApiDelegate.java @@ -0,0 +1,24 @@ +package io.swagger.api; + +import io.swagger.model.Client; + +import io.swagger.annotations.*; +import org.springframework.http.ResponseEntity; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + * A delegate to be called by the {@link FakeClassnameTestApiController}}. + * Should be implemented as a controller but without the {@link org.springframework.stereotype.Controller} annotation. + * Instead, use spring to autowire this class into the {@link FakeClassnameTestApiController}. + */ + +public interface FakeClassnameTestApiDelegate { + + /** + * @see FakeClassnameTestApi#testClassname + */ + ResponseEntity testClassname(Client body); + +} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/configuration/CustomInstantDeserializer.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/configuration/CustomInstantDeserializer.java new file mode 100644 index 00000000000..c8894e9a562 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/configuration/CustomInstantDeserializer.java @@ -0,0 +1,232 @@ +package io.swagger.configuration; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonTokenId; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils; +import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; +import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; +import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; +import com.fasterxml.jackson.datatype.threetenbp.function.Function; +import org.threeten.bp.DateTimeException; +import org.threeten.bp.Instant; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZoneId; +import org.threeten.bp.ZonedDateTime; +import org.threeten.bp.format.DateTimeFormatter; +import org.threeten.bp.temporal.Temporal; +import org.threeten.bp.temporal.TemporalAccessor; + +import java.io.IOException; +import java.math.BigDecimal; + +/** + * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. + * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. + * + * @author Nick Williams + */ +public class CustomInstantDeserializer + extends ThreeTenDateTimeDeserializerBase { + private static final long serialVersionUID = 1L; + + public static final CustomInstantDeserializer INSTANT = new CustomInstantDeserializer( + Instant.class, DateTimeFormatter.ISO_INSTANT, + new Function() { + @Override + public Instant apply(TemporalAccessor temporalAccessor) { + return Instant.from(temporalAccessor); + } + }, + new Function() { + @Override + public Instant apply(FromIntegerArguments a) { + return Instant.ofEpochMilli(a.value); + } + }, + new Function() { + @Override + public Instant apply(FromDecimalArguments a) { + return Instant.ofEpochSecond(a.integer, a.fraction); + } + }, + null + ); + + public static final CustomInstantDeserializer OFFSET_DATE_TIME = new CustomInstantDeserializer( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + new Function() { + @Override + public OffsetDateTime apply(TemporalAccessor temporalAccessor) { + return OffsetDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromIntegerArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromDecimalArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { + return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); + } + } + ); + + public static final CustomInstantDeserializer ZONED_DATE_TIME = new CustomInstantDeserializer( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + new Function() { + @Override + public ZonedDateTime apply(TemporalAccessor temporalAccessor) { + return ZonedDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromIntegerArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromDecimalArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { + return zonedDateTime.withZoneSameInstant(zoneId); + } + } + ); + + protected final Function fromMilliseconds; + + protected final Function fromNanoseconds; + + protected final Function parsedToValue; + + protected final BiFunction adjust; + + protected CustomInstantDeserializer(Class supportedType, + DateTimeFormatter parser, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust) { + super(supportedType, parser); + this.parsedToValue = parsedToValue; + this.fromMilliseconds = fromMilliseconds; + this.fromNanoseconds = fromNanoseconds; + this.adjust = adjust == null ? new BiFunction() { + @Override + public T apply(T t, ZoneId zoneId) { + return t; + } + } : adjust; + } + + @SuppressWarnings("unchecked") + protected CustomInstantDeserializer(CustomInstantDeserializer base, DateTimeFormatter f) { + super((Class) base.handledType(), f); + parsedToValue = base.parsedToValue; + fromMilliseconds = base.fromMilliseconds; + fromNanoseconds = base.fromNanoseconds; + adjust = base.adjust; + } + + @Override + protected JsonDeserializer withDateFormat(DateTimeFormatter dtf) { + if (dtf == _formatter) { + return this; + } + return new CustomInstantDeserializer(this, dtf); + } + + @Override + public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { + //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only + //string values have to be adjusted to the configured TZ. + switch (parser.getCurrentTokenId()) { + case JsonTokenId.ID_NUMBER_FLOAT: { + BigDecimal value = parser.getDecimalValue(); + long seconds = value.longValue(); + int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); + return fromNanoseconds.apply(new FromDecimalArguments( + seconds, nanoseconds, getZone(context))); + } + + case JsonTokenId.ID_NUMBER_INT: { + long timestamp = parser.getLongValue(); + if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + return this.fromNanoseconds.apply(new FromDecimalArguments( + timestamp, 0, this.getZone(context) + )); + } + return this.fromMilliseconds.apply(new FromIntegerArguments( + timestamp, this.getZone(context) + )); + } + + case JsonTokenId.ID_STRING: { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; + } + if (string.endsWith("+0000")) { + string = string.substring(0, string.length() - 5) + "Z"; + } + T value; + try { + TemporalAccessor acc = _formatter.parse(string); + value = parsedToValue.apply(acc); + if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { + return adjust.apply(value, this.getZone(context)); + } + } catch (DateTimeException e) { + throw _peelDTE(e); + } + return value; + } + } + throw context.mappingException("Expected type float, integer, or string."); + } + + private ZoneId getZone(DeserializationContext context) { + // Instants are always in UTC, so don't waste compute cycles + return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone()); + } + + private static class FromIntegerArguments { + public final long value; + public final ZoneId zoneId; + + private FromIntegerArguments(long value, ZoneId zoneId) { + this.value = value; + this.zoneId = zoneId; + } + } + + private static class FromDecimalArguments { + public final long integer; + public final int fraction; + public final ZoneId zoneId; + + private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) { + this.integer = integer; + this.fraction = fraction; + this.zoneId = zoneId; + } + } +} diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/configuration/JacksonConfiguration.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/configuration/JacksonConfiguration.java new file mode 100644 index 00000000000..2609d724907 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/configuration/JacksonConfiguration.java @@ -0,0 +1,23 @@ +package io.swagger.configuration; + +import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.threeten.bp.Instant; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZonedDateTime; + +@Configuration +public class JacksonConfiguration { + + @Bean + @ConditionalOnMissingBean(ThreeTenModule.class) + ThreeTenModule threeTenModule() { + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + return module; + } +} 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 2feb92b12e5..ea1d9adad60 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 @@ -72,7 +72,7 @@ public interface FakeApi { @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble); + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enumQueryDouble", 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 c984ea73b68..246ea137663 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 @@ -55,8 +55,8 @@ public class FakeApiController implements FakeApi { @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 = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString, - @ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues = "NUMBER_1, NUMBER_MINUS_2") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, + @ApiParam(value = "Query parameter enum test (double)" , allowableValues="NUMBER_1_DOT_1, NUMBER_MINUS_1_DOT_2") @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Category.java index 37752be9217..7709723d9cd 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Category.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "A category for a pet") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.UndertowCodegen", date = "2017-03-13T18:04:18.447+01:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/ModelApiResponse.java index 11bbcebb0d9..256b5935a6d 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/ModelApiResponse.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "Describes the result of uploading an image resource") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.UndertowCodegen", date = "2017-03-13T18:04:18.447+01:00") public class ModelApiResponse { private Integer code = null; diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Order.java index 7297000023f..b7e01053210 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Order.java @@ -15,7 +15,7 @@ import java.util.Date; **/ @ApiModel(description = "An order for a pets from the pet store") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.UndertowCodegen", date = "2017-03-13T18:04:18.447+01:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Pet.java index 6b2e4693ea9..cb92de7f97f 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Pet.java @@ -18,7 +18,7 @@ import java.util.List; **/ @ApiModel(description = "A pet for sale in the pet store") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.UndertowCodegen", date = "2017-03-13T18:04:18.447+01:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Tag.java index b713c9d3f9d..c19d52d3cf6 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/Tag.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "A tag for a pet") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.UndertowCodegen", date = "2017-03-13T18:04:18.447+01:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/undertow/src/main/java/io/swagger/model/User.java b/samples/server/petstore/undertow/src/main/java/io/swagger/model/User.java index a543df663cf..4544e9f7367 100644 --- a/samples/server/petstore/undertow/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/undertow/src/main/java/io/swagger/model/User.java @@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty; **/ @ApiModel(description = "A User who is purchasing from the pet store") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.UndertowCodegen", date = "2016-10-19T16:19:58.109+08:00") +@javax.annotation.Generated(value = "io.swagger.codegen.languages.UndertowCodegen", date = "2017-03-13T18:04:18.447+01:00") public class User { private Long id = null; diff --git a/samples/server/petstore/undertow/src/main/resources/config/swagger.json b/samples/server/petstore/undertow/src/main/resources/config/swagger.json index a7b2b1871e6..3446ff8eac8 100644 --- a/samples/server/petstore/undertow/src/main/resources/config/swagger.json +++ b/samples/server/petstore/undertow/src/main/resources/config/swagger.json @@ -112,8 +112,8 @@ "type" : "array", "items" : { "type" : "string", - "default" : "available", - "enum" : [ "available", "pending", "sold" ] + "enum" : [ "available", "pending", "sold" ], + "default" : "available" }, "collectionFormat" : "csv" } ], @@ -395,8 +395,8 @@ "description" : "ID of pet that needs to be fetched", "required" : true, "type" : "integer", - "maximum" : 5.0, - "minimum" : 1.0, + "maximum" : 5, + "minimum" : 1, "format" : "int64" } ], "responses" : { @@ -427,8 +427,7 @@ "in" : "path", "description" : "ID of the order that needs to be deleted", "required" : true, - "type" : "string", - "minimum" : 1.0 + "type" : "string" } ], "responses" : { "400" : { @@ -677,11 +676,6 @@ } }, "securityDefinitions" : { - "api_key" : { - "type" : "apiKey", - "name" : "api_key", - "in" : "header" - }, "petstore_auth" : { "type" : "oauth2", "authorizationUrl" : "http://petstore.swagger.io/api/oauth/dialog", @@ -690,6 +684,11 @@ "write:pets" : "modify pets in your account", "read:pets" : "read your pets" } + }, + "api_key" : { + "type" : "apiKey", + "name" : "api_key", + "in" : "header" } }, "definitions" : {