diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache index edd8f750aaf..a0c77d53c15 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/pojo.mustache @@ -478,7 +478,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isArray}} {{^isArray}} {{#isMap}} - {{#items.isPrimitiveType}} + {{^items.isModel}} if ({{getter}}() != null) { for (String _key : {{getter}}().keySet()) { joiner.add(String.format("%s{{baseName}}%s%s=%s", prefix, suffix, @@ -486,8 +486,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{getter}}().get(_key), URLEncoder.encode(String.valueOf({{getter}}().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); } } - {{/items.isPrimitiveType}} - {{^items.isPrimitiveType}} + {{/items.isModel}} + {{#items.isModel}} if ({{getter}}() != null) { for (String _key : {{getter}}().keySet()) { if ({{getter}}().get(_key) != null) { @@ -496,7 +496,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } } } - {{/items.isPrimitiveType}} + {{/items.isModel}} {{/isMap}} {{^isMap}} {{#isPrimitiveType}} diff --git a/modules/openapi-generator/src/main/resources/Java/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/pojo.mustache index 00899116556..20f18dab6bf 100644 --- a/modules/openapi-generator/src/main/resources/Java/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pojo.mustache @@ -494,7 +494,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens {{/isArray}} {{^isArray}} {{#isMap}} - {{#items.isPrimitiveType}} + {{^items.isModel}} if ({{getter}}() != null) { for (String _key : {{getter}}().keySet()) { try { @@ -507,8 +507,8 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } } } - {{/items.isPrimitiveType}} - {{^items.isPrimitiveType}} + {{/items.isModel}} + {{#items.isModel}} if ({{getter}}() != null) { for (String _key : {{getter}}().keySet()) { if ({{getter}}().get(_key) != null) { @@ -517,7 +517,7 @@ public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtens } } } - {{/items.isPrimitiveType}} + {{/items.isModel}} {{/isMap}} {{^isMap}} {{#isPrimitiveType}} diff --git a/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index b5848df635f..4c260896757 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/native/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -899,6 +899,26 @@ paths: schema: $ref: '#/components/schemas/OuterComposite' description: Input composite as post body + /fake/BigDecimalMap: + get: + tags: + - fake + description: for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + operationId: fakeBigDecimalMap + responses: + '200': + description: successful operation + content: + '*/*': + schema: + type: object + properties: + someId: + type: number + someMap: + type: object + additionalProperties: + type: number /fake/jsonFormData: get: tags: diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml index fe954df8e42..c6091e8cacc 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -950,6 +950,26 @@ paths: schema: $ref: '#/components/schemas/OuterComposite' description: Input composite as post body + /fake/BigDecimalMap: + get: + tags: + - fake + description: for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + operationId: fakeBigDecimalMap + responses: + '200': + description: successful operation + content: + '*/*': + schema: + type: object + properties: + someId: + type: number + someMap: + type: object + additionalProperties: + type: number /fake/jsonFormData: get: tags: diff --git a/samples/client/petstore/elixir/.openapi-generator/FILES b/samples/client/petstore/elixir/.openapi-generator/FILES index d3fc3588109..c4fc0e02aaf 100644 --- a/samples/client/petstore/elixir/.openapi-generator/FILES +++ b/samples/client/petstore/elixir/.openapi-generator/FILES @@ -33,6 +33,7 @@ lib/openapi_petstore/model/dog_all_of.ex lib/openapi_petstore/model/enum_arrays.ex lib/openapi_petstore/model/enum_class.ex lib/openapi_petstore/model/enum_test.ex +lib/openapi_petstore/model/fake_big_decimal_map_200_response.ex lib/openapi_petstore/model/file.ex lib/openapi_petstore/model/file_schema_test_class.ex lib/openapi_petstore/model/foo.ex diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex index e6be5c554c6..fc5c094fcd4 100644 --- a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex +++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex @@ -9,6 +9,34 @@ defmodule OpenapiPetstore.Api.Fake do alias OpenapiPetstore.Connection import OpenapiPetstore.RequestBuilder + @doc """ + for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + + ### Parameters + + - `connection` (OpenapiPetstore.Connection): Connection to server + - `opts` (keyword): Optional parameters + + ### Returns + + - `{:ok, OpenapiPetstore.Model.FakeBigDecimalMap200Response.t}` on success + - `{:error, Tesla.Env.t}` on failure + """ + @spec fake_big_decimal_map(Tesla.Env.client, keyword()) :: {:ok, OpenapiPetstore.Model.FakeBigDecimalMap200Response.t} | {:error, Tesla.Env.t} + def fake_big_decimal_map(connection, _opts \\ []) do + request = + %{} + |> method(:get) + |> url("/fake/BigDecimalMap") + |> Enum.into([]) + + connection + |> Connection.request(request) + |> evaluate_response([ + {200, %OpenapiPetstore.Model.FakeBigDecimalMap200Response{}} + ]) + end + @doc """ Health check endpoint diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/fake_big_decimal_map_200_response.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/fake_big_decimal_map_200_response.ex new file mode 100644 index 00000000000..f18eb2f53bf --- /dev/null +++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/fake_big_decimal_map_200_response.ex @@ -0,0 +1,26 @@ +# NOTE: This file is auto generated by OpenAPI Generator 7.0.0-SNAPSHOT (https://openapi-generator.tech). +# Do not edit this file manually. + +defmodule OpenapiPetstore.Model.FakeBigDecimalMap200Response do + @moduledoc """ + + """ + + @derive [Poison.Encoder] + defstruct [ + :someId, + :someMap + ] + + @type t :: %__MODULE__{ + :someId => float() | nil, + :someMap => %{optional(String.t) => float()} | nil + } +end + +defimpl Poison.Decoder, for: OpenapiPetstore.Model.FakeBigDecimalMap200Response do + def decode(value, _options) do + value + end +end + diff --git a/samples/client/petstore/java-helidon-client/mp/.openapi-generator/FILES b/samples/client/petstore/java-helidon-client/mp/.openapi-generator/FILES index 1b046cca4ab..34eacc844c5 100644 --- a/samples/client/petstore/java-helidon-client/mp/.openapi-generator/FILES +++ b/samples/client/petstore/java-helidon-client/mp/.openapi-generator/FILES @@ -20,6 +20,7 @@ docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md @@ -84,6 +85,7 @@ src/main/java/org/openapitools/client/model/DogAllOf.java src/main/java/org/openapitools/client/model/EnumArrays.java src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java diff --git a/samples/client/petstore/java-helidon-client/mp/docs/FakeApi.md b/samples/client/petstore/java-helidon-client/mp/docs/FakeApi.md index 6ae181e21c6..be1544eae6e 100644 --- a/samples/client/petstore/java-helidon-client/mp/docs/FakeApi.md +++ b/samples/client/petstore/java-helidon-client/mp/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | | [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | | [**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication | | [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | @@ -24,6 +25,38 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* +## fakeBigDecimalMap + +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## fakeHealthGet > HealthCheckResult fakeHealthGet() diff --git a/samples/client/petstore/java-helidon-client/mp/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/java-helidon-client/mp/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..475be1d2d73 --- /dev/null +++ b/samples/client/petstore/java-helidon-client/mp/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,14 @@ + + +# FakeBigDecimalMap200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someId** | **BigDecimal** | | [optional] | +|**someMap** | **Map<String, BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/api/FakeApi.java index 122edf22556..af82256d0d7 100644 --- a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/api/FakeApi.java @@ -28,6 +28,7 @@ import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; import java.math.BigDecimal; import org.openapitools.client.model.Client; import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; @@ -48,6 +49,11 @@ import org.openapitools.client.model.User; @Path("/fake") public interface FakeApi { + @GET + @Path("/BigDecimalMap") + @Produces({ "*/*" }) + FakeBigDecimalMap200Response fakeBigDecimalMap() throws ApiException, ProcessingException; + /** * Health check endpoint */ diff --git a/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..f671eb33e5c --- /dev/null +++ b/samples/client/petstore/java-helidon-client/mp/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,104 @@ +/** + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + + + + +public class FakeBigDecimalMap200Response { + + private BigDecimal someId; + + private Map someMap = null; + + /** + * Get someId + * @return someId + **/ + public BigDecimal getSomeId() { + return someId; + } + + /** + * Set someId + **/ + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + /** + * Get someMap + * @return someMap + **/ + public Map getSomeMap() { + return someMap; + } + + /** + * Set someMap + **/ + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + this.someMap.put(key, someMapItem); + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java-helidon-client/mp/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java-helidon-client/mp/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..f7674730f57 --- /dev/null +++ b/samples/client/petstore/java-helidon-client/mp/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,57 @@ +/** + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +public class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + public void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + public void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + public void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/client/petstore/java-helidon-client/se/.openapi-generator/FILES b/samples/client/petstore/java-helidon-client/se/.openapi-generator/FILES index 16af74d61d2..3aad2e95997 100644 --- a/samples/client/petstore/java-helidon-client/se/.openapi-generator/FILES +++ b/samples/client/petstore/java-helidon-client/se/.openapi-generator/FILES @@ -20,6 +20,7 @@ docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md @@ -93,6 +94,7 @@ src/main/java/org/openapitools/client/model/DogAllOf.java src/main/java/org/openapitools/client/model/EnumArrays.java src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java diff --git a/samples/client/petstore/java-helidon-client/se/docs/FakeApi.md b/samples/client/petstore/java-helidon-client/se/docs/FakeApi.md index 853a8de5377..6eb12aee357 100644 --- a/samples/client/petstore/java-helidon-client/se/docs/FakeApi.md +++ b/samples/client/petstore/java-helidon-client/se/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | | [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | | [**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication | | [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | @@ -24,6 +25,68 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* +## fakeBigDecimalMap + +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + FakeBigDecimalMap200Response result = apiInstance.fakeBigDecimalMap(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## fakeHealthGet > HealthCheckResult fakeHealthGet() diff --git a/samples/client/petstore/java-helidon-client/se/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/java-helidon-client/se/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..475be1d2d73 --- /dev/null +++ b/samples/client/petstore/java-helidon-client/se/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,14 @@ + + +# FakeBigDecimalMap200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someId** | **BigDecimal** | | [optional] | +|**someMap** | **Map<String, BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApi.java index 01701727d04..5e5dec6bfb2 100644 --- a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApi.java @@ -16,6 +16,7 @@ import org.openapitools.client.ApiResponse; import java.math.BigDecimal; import org.openapitools.client.model.Client; import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; @@ -35,6 +36,8 @@ import org.openapitools.client.model.User; */ public interface FakeApi { + ApiResponse fakeBigDecimalMap(); + /** * Health check endpoint * @return {@code ApiResponse} diff --git a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApiImpl.java b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApiImpl.java index 1b323ac2f88..9a2849d61ae 100644 --- a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApiImpl.java +++ b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/api/FakeApiImpl.java @@ -32,6 +32,7 @@ import org.openapitools.client.ApiClient; import java.math.BigDecimal; import org.openapitools.client.model.Client; import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; @@ -57,6 +58,7 @@ public class FakeApiImpl implements FakeApi { private final ApiClient apiClient; + protected static final GenericType RESPONSE_TYPE_fakeBigDecimalMap = ResponseType.create(FakeBigDecimalMap200Response.class); protected static final GenericType RESPONSE_TYPE_fakeHealthGet = ResponseType.create(HealthCheckResult.class); protected static final GenericType RESPONSE_TYPE_fakeHttpSignatureTest = ResponseType.create(Void.class); protected static final GenericType RESPONSE_TYPE_fakeOuterBooleanSerialize = ResponseType.create(Boolean.class); @@ -87,6 +89,40 @@ public class FakeApiImpl implements FakeApi { this.apiClient = apiClient; } + @Override + public ApiResponse fakeBigDecimalMap() { + WebClientRequestBuilder webClientRequestBuilder = fakeBigDecimalMapRequestBuilder(); + return fakeBigDecimalMapSubmit(webClientRequestBuilder); + } + + /** + * Creates a {@code WebClientRequestBuilder} for the fakeBigDecimalMap operation. + * Optional customization point for subclasses. + * + * @return WebClientRequestBuilder for fakeBigDecimalMap + */ + protected WebClientRequestBuilder fakeBigDecimalMapRequestBuilder() { + WebClientRequestBuilder webClientRequestBuilder = apiClient.webClient() + .method("GET"); + + webClientRequestBuilder.path("/fake/BigDecimalMap"); + webClientRequestBuilder.accept(MediaType.APPLICATION_JSON); + + return webClientRequestBuilder; + } + + /** + * Initiates the request for the fakeBigDecimalMap operation. + * Optional customization point for subclasses. + * + * @param webClientRequestBuilder the request builder to use for submitting the request + * @return {@code ApiResponse} for the submitted request + */ + protected ApiResponse fakeBigDecimalMapSubmit(WebClientRequestBuilder webClientRequestBuilder) { + Single webClientResponse = webClientRequestBuilder.submit(); + return ApiResponse.create(RESPONSE_TYPE_fakeBigDecimalMap, webClientResponse); + } + @Override public ApiResponse fakeHealthGet() { WebClientRequestBuilder webClientRequestBuilder = fakeHealthGetRequestBuilder(); diff --git a/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..f671eb33e5c --- /dev/null +++ b/samples/client/petstore/java-helidon-client/se/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,104 @@ +/** + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + + + + +public class FakeBigDecimalMap200Response { + + private BigDecimal someId; + + private Map someMap = null; + + /** + * Get someId + * @return someId + **/ + public BigDecimal getSomeId() { + return someId; + } + + /** + * Set someId + **/ + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + /** + * Get someMap + * @return someMap + **/ + public Map getSomeMap() { + return someMap; + } + + /** + * Set someMap + **/ + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + this.someMap.put(key, someMapItem); + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/client/petstore/java-helidon-client/se/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java-helidon-client/se/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..f7674730f57 --- /dev/null +++ b/samples/client/petstore/java-helidon-client/se/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,57 @@ +/** + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +public class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + public void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + public void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + public void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/client/petstore/java/apache-httpclient/.openapi-generator/FILES b/samples/client/petstore/java/apache-httpclient/.openapi-generator/FILES index 46568169f68..87c769a2506 100644 --- a/samples/client/petstore/java/apache-httpclient/.openapi-generator/FILES +++ b/samples/client/petstore/java/apache-httpclient/.openapi-generator/FILES @@ -26,6 +26,7 @@ docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md @@ -109,6 +110,7 @@ src/main/java/org/openapitools/client/model/DogAllOf.java src/main/java/org/openapitools/client/model/EnumArrays.java src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java diff --git a/samples/client/petstore/java/apache-httpclient/README.md b/samples/client/petstore/java/apache-httpclient/README.md index 8d585ca2a67..c4e087cdfea 100644 --- a/samples/client/petstore/java/apache-httpclient/README.md +++ b/samples/client/petstore/java/apache-httpclient/README.md @@ -108,6 +108,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeBigDecimalMap**](docs/FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | *FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeHttpSignatureTest**](docs/FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication *FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | @@ -169,6 +170,7 @@ Class | Method | HTTP request | Description - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) + - [FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) diff --git a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml index 97b8e4c677a..80e871590a3 100644 --- a/samples/client/petstore/java/apache-httpclient/api/openapi.yaml +++ b/samples/client/petstore/java/apache-httpclient/api/openapi.yaml @@ -978,6 +978,21 @@ paths: - fake x-content-type: application/json x-accepts: '*/*' + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake + x-accepts: '*/*' /fake/jsonFormData: get: description: "" @@ -2107,6 +2122,19 @@ components: - number - pattern_without_delimiter type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object testJsonFormData_request: properties: param: diff --git a/samples/client/petstore/java/apache-httpclient/docs/FakeApi.md b/samples/client/petstore/java/apache-httpclient/docs/FakeApi.md index 853a8de5377..6eb12aee357 100644 --- a/samples/client/petstore/java/apache-httpclient/docs/FakeApi.md +++ b/samples/client/petstore/java/apache-httpclient/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | | [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | | [**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication | | [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | @@ -24,6 +25,68 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* +## fakeBigDecimalMap + +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + FakeBigDecimalMap200Response result = apiInstance.fakeBigDecimalMap(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## fakeHealthGet > HealthCheckResult fakeHealthGet() diff --git a/samples/client/petstore/java/apache-httpclient/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/java/apache-httpclient/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..475be1d2d73 --- /dev/null +++ b/samples/client/petstore/java/apache-httpclient/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,14 @@ + + +# FakeBigDecimalMap200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someId** | **BigDecimal** | | [optional] | +|**someMap** | **Map<String, BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java index 727d782fb9d..44a226dfd1c 100644 --- a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/api/FakeApi.java @@ -23,6 +23,7 @@ import org.openapitools.client.Pair; import java.math.BigDecimal; import org.openapitools.client.model.Client; import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; @@ -63,6 +64,73 @@ public class FakeApi { this.apiClient = apiClient; } + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @return FakeBigDecimalMap200Response + * @throws ApiException if fails to make API call + */ + public FakeBigDecimalMap200Response fakeBigDecimalMap() throws ApiException { + return this.fakeBigDecimalMap(Collections.emptyMap()); + } + + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @param additionalHeaders additionalHeaders for this call + * @return FakeBigDecimalMap200Response + * @throws ApiException if fails to make API call + */ + public FakeBigDecimalMap200Response fakeBigDecimalMap(Map additionalHeaders) throws ApiException { + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/fake/BigDecimalMap"; + + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + localVarHeaderParams.putAll(additionalHeaders); + + + + final String[] localVarAccepts = { + "*/*" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + TypeReference localVarReturnType = new TypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + "GET", + localVarQueryParams, + localVarCollectionQueryParams, + localVarQueryStringJoiner.toString(), + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType + ); + } + /** * Health check endpoint * diff --git a/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..b7e644d6a78 --- /dev/null +++ b/samples/client/petstore/java/apache-httpclient/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,209 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.StringJoiner; + +/** + * FakeBigDecimalMap200Response + */ +@JsonPropertyOrder({ + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID, + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP +}) +@JsonTypeName("fakeBigDecimalMap_200_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FakeBigDecimalMap200Response { + public static final String JSON_PROPERTY_SOME_ID = "someId"; + private BigDecimal someId; + + public static final String JSON_PROPERTY_SOME_MAP = "someMap"; + private Map someMap = new HashMap<>(); + + public FakeBigDecimalMap200Response() { + } + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + + this.someId = someId; + return this; + } + + /** + * Get someId + * @return someId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getSomeId() { + return someId; + } + + + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + + public FakeBigDecimalMap200Response someMap(Map someMap) { + + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + this.someMap.put(key, someMapItem); + return this; + } + + /** + * Get someMap + * @return someMap + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getSomeMap() { + return someMap; + } + + + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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 "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `someId` to the URL query string + if (getSomeId() != null) { + try { + joiner.add(String.format("%ssomeId%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSomeId()), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + + // add `someMap` to the URL query string + if (getSomeMap() != null) { + for (String _key : getSomeMap().keySet()) { + try { + joiner.add(String.format("%ssomeMap%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + getSomeMap().get(_key), URLEncoder.encode(String.valueOf(getSomeMap().get(_key)), "UTF-8").replaceAll("\\+", "%20"))); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } + } + + return joiner.toString(); + } + +} + diff --git a/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..88c1d374be6 --- /dev/null +++ b/samples/client/petstore/java/apache-httpclient/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +public class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + public void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + public void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + public void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/client/petstore/java/feign/.openapi-generator/FILES b/samples/client/petstore/java/feign/.openapi-generator/FILES index 1e8d11e21e9..8a08aa63045 100644 --- a/samples/client/petstore/java/feign/.openapi-generator/FILES +++ b/samples/client/petstore/java/feign/.openapi-generator/FILES @@ -57,6 +57,7 @@ src/main/java/org/openapitools/client/model/DogAllOf.java src/main/java/org/openapitools/client/model/EnumArrays.java src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/client/model/File.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java diff --git a/samples/client/petstore/java/feign/api/openapi.yaml b/samples/client/petstore/java/feign/api/openapi.yaml index 97b8e4c677a..80e871590a3 100644 --- a/samples/client/petstore/java/feign/api/openapi.yaml +++ b/samples/client/petstore/java/feign/api/openapi.yaml @@ -978,6 +978,21 @@ paths: - fake x-content-type: application/json x-accepts: '*/*' + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake + x-accepts: '*/*' /fake/jsonFormData: get: description: "" @@ -2107,6 +2122,19 @@ components: - number - pattern_without_delimiter type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object testJsonFormData_request: properties: param: diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java index 6631bb71ac4..de441d239da 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java @@ -7,6 +7,7 @@ import org.openapitools.client.model.ApiResponse; import java.math.BigDecimal; import org.openapitools.client.model.Client; import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; @@ -27,6 +28,31 @@ import feign.*; public interface FakeApi extends ApiClient.Api { + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @return FakeBigDecimalMap200Response + */ + @RequestLine("GET /fake/BigDecimalMap") + @Headers({ + "Accept: */*", + }) + FakeBigDecimalMap200Response fakeBigDecimalMap(); + + /** + * + * Similar to fakeBigDecimalMap but it also returns the http response headers . + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @return A ApiResponse that wraps the response boyd and the http headers. + */ + @RequestLine("GET /fake/BigDecimalMap") + @Headers({ + "Accept: */*", + }) + ApiResponse fakeBigDecimalMapWithHttpInfo(); + + + /** * Health check endpoint * diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..1a6fbe6cb37 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,147 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * FakeBigDecimalMap200Response + */ +@JsonPropertyOrder({ + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID, + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP +}) +@JsonTypeName("fakeBigDecimalMap_200_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FakeBigDecimalMap200Response { + public static final String JSON_PROPERTY_SOME_ID = "someId"; + private BigDecimal someId; + + public static final String JSON_PROPERTY_SOME_MAP = "someMap"; + private Map someMap = new HashMap<>(); + + public FakeBigDecimalMap200Response() { + } + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + + this.someId = someId; + return this; + } + + /** + * Get someId + * @return someId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getSomeId() { + return someId; + } + + + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + + public FakeBigDecimalMap200Response someMap(Map someMap) { + + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + this.someMap.put(key, someMapItem); + return this; + } + + /** + * Get someMap + * @return someMap + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getSomeMap() { + return someMap; + } + + + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..af76fe3e8fd --- /dev/null +++ b/samples/client/petstore/java/feign/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,56 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/client/petstore/java/native-async/.openapi-generator/FILES b/samples/client/petstore/java/native-async/.openapi-generator/FILES index a1bc5339f0d..4d1e9c20b36 100644 --- a/samples/client/petstore/java/native-async/.openapi-generator/FILES +++ b/samples/client/petstore/java/native-async/.openapi-generator/FILES @@ -36,6 +36,7 @@ docs/EnumClass.md docs/EnumTest.md docs/EquilateralTriangle.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md @@ -142,6 +143,7 @@ src/main/java/org/openapitools/client/model/EnumArrays.java src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java src/main/java/org/openapitools/client/model/EquilateralTriangle.java +src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java diff --git a/samples/client/petstore/java/native-async/README.md b/samples/client/petstore/java/native-async/README.md index 5b7379fc972..3b7ba97a54b 100644 --- a/samples/client/petstore/java/native-async/README.md +++ b/samples/client/petstore/java/native-async/README.md @@ -110,6 +110,8 @@ Class | Method | HTTP request | Description *AnotherFakeApi* | [**call123testSpecialTagsWithHttpInfo**](docs/AnotherFakeApi.md#call123testSpecialTagsWithHttpInfo) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | *DefaultApi* | [**fooGetWithHttpInfo**](docs/DefaultApi.md#fooGetWithHttpInfo) | **GET** /foo | +*FakeApi* | [**fakeBigDecimalMap**](docs/FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | +*FakeApi* | [**fakeBigDecimalMapWithHttpInfo**](docs/FakeApi.md#fakeBigDecimalMapWithHttpInfo) | **GET** /fake/BigDecimalMap | *FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeHealthGetWithHttpInfo**](docs/FakeApi.md#fakeHealthGetWithHttpInfo) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | @@ -216,6 +218,7 @@ Class | Method | HTTP request | Description - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) - [EquilateralTriangle](docs/EquilateralTriangle.md) + - [FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) diff --git a/samples/client/petstore/java/native-async/api/openapi.yaml b/samples/client/petstore/java/native-async/api/openapi.yaml index 837330cd6c9..6b583fd4056 100644 --- a/samples/client/petstore/java/native-async/api/openapi.yaml +++ b/samples/client/petstore/java/native-async/api/openapi.yaml @@ -920,6 +920,21 @@ paths: - fake x-content-type: application/json x-accepts: '*/*' + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake + x-accepts: '*/*' /fake/jsonFormData: get: description: "" @@ -2255,6 +2270,19 @@ components: - number - pattern_without_delimiter type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object testJsonFormData_request: properties: param: diff --git a/samples/client/petstore/java/native-async/docs/FakeApi.md b/samples/client/petstore/java/native-async/docs/FakeApi.md index 01095eb8cd8..eabbd418b17 100644 --- a/samples/client/petstore/java/native-async/docs/FakeApi.md +++ b/samples/client/petstore/java/native-async/docs/FakeApi.md @@ -4,6 +4,8 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | +| [**fakeBigDecimalMapWithHttpInfo**](FakeApi.md#fakeBigDecimalMapWithHttpInfo) | **GET** /fake/BigDecimalMap | | | [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | | [**fakeHealthGetWithHttpInfo**](FakeApi.md#fakeHealthGetWithHttpInfo) | **GET** /fake/health | Health check endpoint | | [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | @@ -37,6 +39,141 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* +## fakeBigDecimalMap + +> CompletableFuture fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + CompletableFuture result = apiInstance.fakeBigDecimalMap(); + System.out.println(result.get()); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +CompletableFuture<[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +## fakeBigDecimalMapWithHttpInfo + +> CompletableFuture> fakeBigDecimalMap fakeBigDecimalMapWithHttpInfo() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +import java.util.concurrent.CompletableFuture; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + CompletableFuture> response = apiInstance.fakeBigDecimalMapWithHttpInfo(); + System.out.println("Status code: " + response.get().getStatusCode()); + System.out.println("Response headers: " + response.get().getHeaders()); + System.out.println("Response body: " + response.get().getData()); + } catch (InterruptedException | ExecutionException e) { + ApiException apiException = (ApiException)e.getCause(); + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + apiException.getCode()); + System.err.println("Response headers: " + apiException.getResponseHeaders()); + System.err.println("Reason: " + apiException.getResponseBody()); + e.printStackTrace(); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +CompletableFuture> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## fakeHealthGet > CompletableFuture fakeHealthGet() diff --git a/samples/client/petstore/java/native-async/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/java/native-async/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..475be1d2d73 --- /dev/null +++ b/samples/client/petstore/java/native-async/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,14 @@ + + +# FakeBigDecimalMap200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someId** | **BigDecimal** | | [optional] | +|**someMap** | **Map<String, BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java index c4809a5ea03..f4c1e581743 100644 --- a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/api/FakeApi.java @@ -19,6 +19,7 @@ import org.openapitools.client.Pair; import java.math.BigDecimal; import org.openapitools.client.model.Client; +import org.openapitools.client.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; @@ -97,6 +98,92 @@ public class FakeApi { return operationId + " call failed with: " + statusCode + " - " + body; } + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @return CompletableFuture<FakeBigDecimalMap200Response> + * @throws ApiException if fails to make API call + */ + public CompletableFuture fakeBigDecimalMap() throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = fakeBigDecimalMapRequestBuilder(); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("fakeBigDecimalMap", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference() {}) + ); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + }); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @return CompletableFuture<ApiResponse<FakeBigDecimalMap200Response>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> fakeBigDecimalMapWithHttpInfo() throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = fakeBigDecimalMapRequestBuilder(); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("fakeBigDecimalMap", localVarResponse)); + } + try { + String responseBody = localVarResponse.body(); + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseBody == null || responseBody.isBlank() ? null : memberVarObjectMapper.readValue(responseBody, new TypeReference() {})) + ); + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/BigDecimalMap"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "*/*"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } /** * Health check endpoint * diff --git a/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..a6cad7e932a --- /dev/null +++ b/samples/client/petstore/java/native-async/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,201 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * FakeBigDecimalMap200Response + */ +@JsonPropertyOrder({ + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID, + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FakeBigDecimalMap200Response { + public static final String JSON_PROPERTY_SOME_ID = "someId"; + private BigDecimal someId; + + public static final String JSON_PROPERTY_SOME_MAP = "someMap"; + private Map someMap = new HashMap<>(); + + public FakeBigDecimalMap200Response() { + } + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + /** + * Get someId + * @return someId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getSomeId() { + return someId; + } + + + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + this.someMap.put(key, someMapItem); + return this; + } + + /** + * Get someMap + * @return someMap + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getSomeMap() { + return someMap; + } + + + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + + /** + * Return true if this fakeBigDecimalMap_200_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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 "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `someId` to the URL query string + if (getSomeId() != null) { + joiner.add(String.format("%ssomeId%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSomeId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + + // add `someMap` to the URL query string + if (getSomeMap() != null) { + for (String _key : getSomeMap().keySet()) { + joiner.add(String.format("%ssomeMap%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + getSomeMap().get(_key), URLEncoder.encode(String.valueOf(getSomeMap().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..88c1d374be6 --- /dev/null +++ b/samples/client/petstore/java/native-async/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +public class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + public void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + public void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + public void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/client/petstore/java/native/.openapi-generator/FILES b/samples/client/petstore/java/native/.openapi-generator/FILES index a1bc5339f0d..4d1e9c20b36 100644 --- a/samples/client/petstore/java/native/.openapi-generator/FILES +++ b/samples/client/petstore/java/native/.openapi-generator/FILES @@ -36,6 +36,7 @@ docs/EnumClass.md docs/EnumTest.md docs/EquilateralTriangle.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md @@ -142,6 +143,7 @@ src/main/java/org/openapitools/client/model/EnumArrays.java src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java src/main/java/org/openapitools/client/model/EquilateralTriangle.java +src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java diff --git a/samples/client/petstore/java/native/README.md b/samples/client/petstore/java/native/README.md index 57c43bb66e6..ea628ced967 100644 --- a/samples/client/petstore/java/native/README.md +++ b/samples/client/petstore/java/native/README.md @@ -109,6 +109,8 @@ Class | Method | HTTP request | Description *AnotherFakeApi* | [**call123testSpecialTagsWithHttpInfo**](docs/AnotherFakeApi.md#call123testSpecialTagsWithHttpInfo) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | *DefaultApi* | [**fooGetWithHttpInfo**](docs/DefaultApi.md#fooGetWithHttpInfo) | **GET** /foo | +*FakeApi* | [**fakeBigDecimalMap**](docs/FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | +*FakeApi* | [**fakeBigDecimalMapWithHttpInfo**](docs/FakeApi.md#fakeBigDecimalMapWithHttpInfo) | **GET** /fake/BigDecimalMap | *FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeHealthGetWithHttpInfo**](docs/FakeApi.md#fakeHealthGetWithHttpInfo) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | @@ -215,6 +217,7 @@ Class | Method | HTTP request | Description - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) - [EquilateralTriangle](docs/EquilateralTriangle.md) + - [FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) diff --git a/samples/client/petstore/java/native/api/openapi.yaml b/samples/client/petstore/java/native/api/openapi.yaml index 837330cd6c9..6b583fd4056 100644 --- a/samples/client/petstore/java/native/api/openapi.yaml +++ b/samples/client/petstore/java/native/api/openapi.yaml @@ -920,6 +920,21 @@ paths: - fake x-content-type: application/json x-accepts: '*/*' + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake + x-accepts: '*/*' /fake/jsonFormData: get: description: "" @@ -2255,6 +2270,19 @@ components: - number - pattern_without_delimiter type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object testJsonFormData_request: properties: param: diff --git a/samples/client/petstore/java/native/docs/FakeApi.md b/samples/client/petstore/java/native/docs/FakeApi.md index 7542f93dd67..e8911736308 100644 --- a/samples/client/petstore/java/native/docs/FakeApi.md +++ b/samples/client/petstore/java/native/docs/FakeApi.md @@ -4,6 +4,8 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | +| [**fakeBigDecimalMapWithHttpInfo**](FakeApi.md#fakeBigDecimalMapWithHttpInfo) | **GET** /fake/BigDecimalMap | | | [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | | [**fakeHealthGetWithHttpInfo**](FakeApi.md#fakeHealthGetWithHttpInfo) | **GET** /fake/health | Health check endpoint | | [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | @@ -37,6 +39,132 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* +## fakeBigDecimalMap + +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + FakeBigDecimalMap200Response result = apiInstance.fakeBigDecimalMap(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + +## fakeBigDecimalMapWithHttpInfo + +> ApiResponse fakeBigDecimalMap fakeBigDecimalMapWithHttpInfo() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + ApiResponse response = apiInstance.fakeBigDecimalMapWithHttpInfo(); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +ApiResponse<[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## fakeHealthGet > HealthCheckResult fakeHealthGet() diff --git a/samples/client/petstore/java/native/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/java/native/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..475be1d2d73 --- /dev/null +++ b/samples/client/petstore/java/native/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,14 @@ + + +# FakeBigDecimalMap200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someId** | **BigDecimal** | | [optional] | +|**someMap** | **Map<String, BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java index b73dbbc80c0..8467f9efe65 100644 --- a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/api/FakeApi.java @@ -19,6 +19,7 @@ import org.openapitools.client.Pair; import java.math.BigDecimal; import org.openapitools.client.model.Client; +import org.openapitools.client.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; @@ -96,6 +97,71 @@ public class FakeApi { return operationId + " call failed with: " + statusCode + " - " + body; } + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @return FakeBigDecimalMap200Response + * @throws ApiException if fails to make API call + */ + public FakeBigDecimalMap200Response fakeBigDecimalMap() throws ApiException { + ApiResponse localVarResponse = fakeBigDecimalMapWithHttpInfo(); + return localVarResponse.getData(); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * @return ApiResponse<FakeBigDecimalMap200Response> + * @throws ApiException if fails to make API call + */ + public ApiResponse fakeBigDecimalMapWithHttpInfo() throws ApiException { + HttpRequest.Builder localVarRequestBuilder = fakeBigDecimalMapRequestBuilder(); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("fakeBigDecimalMap", localVarResponse); + } + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + localVarResponse.body() == null ? null : memberVarObjectMapper.readValue(localVarResponse.body(), new TypeReference() {}) // closes the InputStream + ); + } finally { + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder fakeBigDecimalMapRequestBuilder() throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/fake/BigDecimalMap"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "*/*"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } /** * Health check endpoint * diff --git a/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..a6cad7e932a --- /dev/null +++ b/samples/client/petstore/java/native/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,201 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Arrays; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * FakeBigDecimalMap200Response + */ +@JsonPropertyOrder({ + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID, + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FakeBigDecimalMap200Response { + public static final String JSON_PROPERTY_SOME_ID = "someId"; + private BigDecimal someId; + + public static final String JSON_PROPERTY_SOME_MAP = "someMap"; + private Map someMap = new HashMap<>(); + + public FakeBigDecimalMap200Response() { + } + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + /** + * Get someId + * @return someId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getSomeId() { + return someId; + } + + + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + this.someMap.put(key, someMapItem); + return this; + } + + /** + * Get someMap + * @return someMap + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getSomeMap() { + return someMap; + } + + + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + + /** + * Return true if this fakeBigDecimalMap_200_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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 "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `someId` to the URL query string + if (getSomeId() != null) { + joiner.add(String.format("%ssomeId%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getSomeId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + + // add `someMap` to the URL query string + if (getSomeMap() != null) { + for (String _key : getSomeMap().keySet()) { + joiner.add(String.format("%ssomeMap%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, _key, containerSuffix), + getSomeMap().get(_key), URLEncoder.encode(String.valueOf(getSomeMap().get(_key)), StandardCharsets.UTF_8).replaceAll("\\+", "%20"))); + } + } + + return joiner.toString(); + } +} + diff --git a/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..88c1d374be6 --- /dev/null +++ b/samples/client/petstore/java/native/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +public class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + public void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + public void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + public void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/client/petstore/java/webclient-jakarta/.openapi-generator/FILES b/samples/client/petstore/java/webclient-jakarta/.openapi-generator/FILES index bc9e24cb1f9..c4b86386d00 100644 --- a/samples/client/petstore/java/webclient-jakarta/.openapi-generator/FILES +++ b/samples/client/petstore/java/webclient-jakarta/.openapi-generator/FILES @@ -26,6 +26,7 @@ docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md @@ -106,6 +107,7 @@ src/main/java/org/openapitools/client/model/DogAllOf.java src/main/java/org/openapitools/client/model/EnumArrays.java src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java diff --git a/samples/client/petstore/java/webclient-jakarta/README.md b/samples/client/petstore/java/webclient-jakarta/README.md index 3778932ea89..fdaeea4460b 100644 --- a/samples/client/petstore/java/webclient-jakarta/README.md +++ b/samples/client/petstore/java/webclient-jakarta/README.md @@ -115,6 +115,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeBigDecimalMap**](docs/FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | *FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeHttpSignatureTest**](docs/FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication *FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | @@ -176,6 +177,7 @@ Class | Method | HTTP request | Description - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) + - [FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) diff --git a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml index 97b8e4c677a..80e871590a3 100644 --- a/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-jakarta/api/openapi.yaml @@ -978,6 +978,21 @@ paths: - fake x-content-type: application/json x-accepts: '*/*' + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake + x-accepts: '*/*' /fake/jsonFormData: get: description: "" @@ -2107,6 +2122,19 @@ components: - number - pattern_without_delimiter type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object testJsonFormData_request: properties: param: diff --git a/samples/client/petstore/java/webclient-jakarta/docs/FakeApi.md b/samples/client/petstore/java/webclient-jakarta/docs/FakeApi.md index 853a8de5377..6eb12aee357 100644 --- a/samples/client/petstore/java/webclient-jakarta/docs/FakeApi.md +++ b/samples/client/petstore/java/webclient-jakarta/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | | [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | | [**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication | | [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | @@ -24,6 +25,68 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* +## fakeBigDecimalMap + +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + FakeBigDecimalMap200Response result = apiInstance.fakeBigDecimalMap(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## fakeHealthGet > HealthCheckResult fakeHealthGet() diff --git a/samples/client/petstore/java/webclient-jakarta/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/java/webclient-jakarta/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..475be1d2d73 --- /dev/null +++ b/samples/client/petstore/java/webclient-jakarta/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,14 @@ + + +# FakeBigDecimalMap200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someId** | **BigDecimal** | | [optional] | +|**someMap** | **Map<String, BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/FakeApi.java index cbb1804a495..d8ff2b837d4 100644 --- a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/api/FakeApi.java @@ -5,6 +5,7 @@ import org.openapitools.client.ApiClient; import java.math.BigDecimal; import org.openapitools.client.model.Client; import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; @@ -57,6 +58,70 @@ public class FakeApi { this.apiClient = apiClient; } + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return FakeBigDecimalMap200Response + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec fakeBigDecimalMapRequestCreation() throws WebClientResponseException { + Object postBody = null; + // create path and map variables + final Map pathParams = new HashMap(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/fake/BigDecimalMap", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return FakeBigDecimalMap200Response + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono fakeBigDecimalMap() throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeBigDecimalMapRequestCreation().bodyToMono(localVarReturnType); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return ResponseEntity<FakeBigDecimalMap200Response> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> fakeBigDecimalMapWithHttpInfo() throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeBigDecimalMapRequestCreation().toEntity(localVarReturnType); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec fakeBigDecimalMapWithResponseSpec() throws WebClientResponseException { + return fakeBigDecimalMapRequestCreation(); + } /** * Health check endpoint * diff --git a/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..7a508a8d482 --- /dev/null +++ b/samples/client/petstore/java/webclient-jakarta/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,147 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * FakeBigDecimalMap200Response + */ +@JsonPropertyOrder({ + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID, + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP +}) +@JsonTypeName("fakeBigDecimalMap_200_response") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FakeBigDecimalMap200Response { + public static final String JSON_PROPERTY_SOME_ID = "someId"; + private BigDecimal someId; + + public static final String JSON_PROPERTY_SOME_MAP = "someMap"; + private Map someMap = new HashMap<>(); + + public FakeBigDecimalMap200Response() { + } + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + + this.someId = someId; + return this; + } + + /** + * Get someId + * @return someId + **/ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getSomeId() { + return someId; + } + + + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + + public FakeBigDecimalMap200Response someMap(Map someMap) { + + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + this.someMap.put(key, someMapItem); + return this; + } + + /** + * Get someMap + * @return someMap + **/ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getSomeMap() { + return someMap; + } + + + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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/client/petstore/java/webclient-jakarta/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java/webclient-jakarta/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..88c1d374be6 --- /dev/null +++ b/samples/client/petstore/java/webclient-jakarta/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +public class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + public void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + public void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + public void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/client/petstore/java/webclient-swagger2/.openapi-generator/FILES b/samples/client/petstore/java/webclient-swagger2/.openapi-generator/FILES index bc9e24cb1f9..c4b86386d00 100644 --- a/samples/client/petstore/java/webclient-swagger2/.openapi-generator/FILES +++ b/samples/client/petstore/java/webclient-swagger2/.openapi-generator/FILES @@ -26,6 +26,7 @@ docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md @@ -106,6 +107,7 @@ src/main/java/org/openapitools/client/model/DogAllOf.java src/main/java/org/openapitools/client/model/EnumArrays.java src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java diff --git a/samples/client/petstore/java/webclient-swagger2/README.md b/samples/client/petstore/java/webclient-swagger2/README.md index 3778932ea89..fdaeea4460b 100644 --- a/samples/client/petstore/java/webclient-swagger2/README.md +++ b/samples/client/petstore/java/webclient-swagger2/README.md @@ -115,6 +115,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeBigDecimalMap**](docs/FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | *FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeHttpSignatureTest**](docs/FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication *FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | @@ -176,6 +177,7 @@ Class | Method | HTTP request | Description - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) + - [FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) diff --git a/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml b/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml index 97b8e4c677a..80e871590a3 100644 --- a/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-swagger2/api/openapi.yaml @@ -978,6 +978,21 @@ paths: - fake x-content-type: application/json x-accepts: '*/*' + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake + x-accepts: '*/*' /fake/jsonFormData: get: description: "" @@ -2107,6 +2122,19 @@ components: - number - pattern_without_delimiter type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object testJsonFormData_request: properties: param: diff --git a/samples/client/petstore/java/webclient-swagger2/docs/FakeApi.md b/samples/client/petstore/java/webclient-swagger2/docs/FakeApi.md index 853a8de5377..6eb12aee357 100644 --- a/samples/client/petstore/java/webclient-swagger2/docs/FakeApi.md +++ b/samples/client/petstore/java/webclient-swagger2/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | | [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | | [**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication | | [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | @@ -24,6 +25,68 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* +## fakeBigDecimalMap + +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + FakeBigDecimalMap200Response result = apiInstance.fakeBigDecimalMap(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## fakeHealthGet > HealthCheckResult fakeHealthGet() diff --git a/samples/client/petstore/java/webclient-swagger2/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/java/webclient-swagger2/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..475be1d2d73 --- /dev/null +++ b/samples/client/petstore/java/webclient-swagger2/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,14 @@ + + +# FakeBigDecimalMap200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someId** | **BigDecimal** | | [optional] | +|**someMap** | **Map<String, BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/FakeApi.java index 5c63a2ddbc1..a86605d1ae2 100644 --- a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/api/FakeApi.java @@ -5,6 +5,7 @@ import org.openapitools.client.ApiClient; import java.math.BigDecimal; import org.openapitools.client.model.Client; import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; @@ -57,6 +58,70 @@ public class FakeApi { this.apiClient = apiClient; } + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return FakeBigDecimalMap200Response + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec fakeBigDecimalMapRequestCreation() throws WebClientResponseException { + Object postBody = null; + // create path and map variables + final Map pathParams = new HashMap(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/fake/BigDecimalMap", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return FakeBigDecimalMap200Response + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono fakeBigDecimalMap() throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeBigDecimalMapRequestCreation().bodyToMono(localVarReturnType); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return ResponseEntity<FakeBigDecimalMap200Response> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> fakeBigDecimalMapWithHttpInfo() throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeBigDecimalMapRequestCreation().toEntity(localVarReturnType); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec fakeBigDecimalMapWithResponseSpec() throws WebClientResponseException { + return fakeBigDecimalMapRequestCreation(); + } /** * Health check endpoint * diff --git a/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..3fc29a6769d --- /dev/null +++ b/samples/client/petstore/java/webclient-swagger2/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,150 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.v3.oas.annotations.media.Schema; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * FakeBigDecimalMap200Response + */ +@JsonPropertyOrder({ + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID, + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP +}) +@JsonTypeName("fakeBigDecimalMap_200_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FakeBigDecimalMap200Response { + public static final String JSON_PROPERTY_SOME_ID = "someId"; + private BigDecimal someId; + + public static final String JSON_PROPERTY_SOME_MAP = "someMap"; + private Map someMap; + + public FakeBigDecimalMap200Response() { + } + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + + this.someId = someId; + return this; + } + + /** + * Get someId + * @return someId + **/ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getSomeId() { + return someId; + } + + + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + + public FakeBigDecimalMap200Response someMap(Map someMap) { + + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + this.someMap.put(key, someMapItem); + return this; + } + + /** + * Get someMap + * @return someMap + **/ + @javax.annotation.Nullable + @Schema(requiredMode = Schema.RequiredMode.NOT_REQUIRED, description = "") + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getSomeMap() { + return someMap; + } + + + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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/client/petstore/java/webclient-swagger2/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java/webclient-swagger2/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..d58e6baf475 --- /dev/null +++ b/samples/client/petstore/java/webclient-swagger2/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,59 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.v3.oas.annotations.media.Schema; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +public class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + public void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + public void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + public void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/client/petstore/java/webclient/.openapi-generator/FILES b/samples/client/petstore/java/webclient/.openapi-generator/FILES index bc9e24cb1f9..c4b86386d00 100644 --- a/samples/client/petstore/java/webclient/.openapi-generator/FILES +++ b/samples/client/petstore/java/webclient/.openapi-generator/FILES @@ -26,6 +26,7 @@ docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/FileSchemaTestClass.md docs/Foo.md @@ -106,6 +107,7 @@ src/main/java/org/openapitools/client/model/DogAllOf.java src/main/java/org/openapitools/client/model/EnumArrays.java src/main/java/org/openapitools/client/model/EnumClass.java src/main/java/org/openapitools/client/model/EnumTest.java +src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/client/model/FileSchemaTestClass.java src/main/java/org/openapitools/client/model/Foo.java src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java diff --git a/samples/client/petstore/java/webclient/README.md b/samples/client/petstore/java/webclient/README.md index 3778932ea89..fdaeea4460b 100644 --- a/samples/client/petstore/java/webclient/README.md +++ b/samples/client/petstore/java/webclient/README.md @@ -115,6 +115,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123testSpecialTags**](docs/AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](docs/DefaultApi.md#fooGet) | **GET** /foo | +*FakeApi* | [**fakeBigDecimalMap**](docs/FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | *FakeApi* | [**fakeHealthGet**](docs/FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeHttpSignatureTest**](docs/FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication *FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | @@ -176,6 +177,7 @@ Class | Method | HTTP request | Description - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) + - [FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Foo](docs/Foo.md) - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) diff --git a/samples/client/petstore/java/webclient/api/openapi.yaml b/samples/client/petstore/java/webclient/api/openapi.yaml index 97b8e4c677a..80e871590a3 100644 --- a/samples/client/petstore/java/webclient/api/openapi.yaml +++ b/samples/client/petstore/java/webclient/api/openapi.yaml @@ -978,6 +978,21 @@ paths: - fake x-content-type: application/json x-accepts: '*/*' + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake + x-accepts: '*/*' /fake/jsonFormData: get: description: "" @@ -2107,6 +2122,19 @@ components: - number - pattern_without_delimiter type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object testJsonFormData_request: properties: param: diff --git a/samples/client/petstore/java/webclient/docs/FakeApi.md b/samples/client/petstore/java/webclient/docs/FakeApi.md index 853a8de5377..6eb12aee357 100644 --- a/samples/client/petstore/java/webclient/docs/FakeApi.md +++ b/samples/client/petstore/java/webclient/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fakeBigDecimalMap**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | | [**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | | [**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication | | [**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | @@ -24,6 +25,68 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* +## fakeBigDecimalMap + +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + FakeApi apiInstance = new FakeApi(defaultClient); + try { + FakeBigDecimalMap200Response result = apiInstance.fakeBigDecimalMap(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeBigDecimalMap"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + + ## fakeHealthGet > HealthCheckResult fakeHealthGet() diff --git a/samples/client/petstore/java/webclient/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/java/webclient/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..475be1d2d73 --- /dev/null +++ b/samples/client/petstore/java/webclient/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,14 @@ + + +# FakeBigDecimalMap200Response + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**someId** | **BigDecimal** | | [optional] | +|**someMap** | **Map<String, BigDecimal>** | | [optional] | + + + diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java index 5c63a2ddbc1..a86605d1ae2 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java @@ -5,6 +5,7 @@ import org.openapitools.client.ApiClient; import java.math.BigDecimal; import org.openapitools.client.model.Client; import org.openapitools.client.model.EnumClass; +import org.openapitools.client.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.client.model.FileSchemaTestClass; import org.openapitools.client.model.HealthCheckResult; @@ -57,6 +58,70 @@ public class FakeApi { this.apiClient = apiClient; } + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return FakeBigDecimalMap200Response + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec fakeBigDecimalMapRequestCreation() throws WebClientResponseException { + Object postBody = null; + // create path and map variables + final Map pathParams = new HashMap(); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { + "*/*" + }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/fake/BigDecimalMap", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return FakeBigDecimalMap200Response + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono fakeBigDecimalMap() throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeBigDecimalMapRequestCreation().bodyToMono(localVarReturnType); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return ResponseEntity<FakeBigDecimalMap200Response> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> fakeBigDecimalMapWithHttpInfo() throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fakeBigDecimalMapRequestCreation().toEntity(localVarReturnType); + } + + /** + * + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + *

200 - successful operation + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec fakeBigDecimalMapWithResponseSpec() throws WebClientResponseException { + return fakeBigDecimalMapRequestCreation(); + } /** * Health check endpoint * diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..f665d859f64 --- /dev/null +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,147 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * FakeBigDecimalMap200Response + */ +@JsonPropertyOrder({ + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID, + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP +}) +@JsonTypeName("fakeBigDecimalMap_200_response") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class FakeBigDecimalMap200Response { + public static final String JSON_PROPERTY_SOME_ID = "someId"; + private BigDecimal someId; + + public static final String JSON_PROPERTY_SOME_MAP = "someMap"; + private Map someMap; + + public FakeBigDecimalMap200Response() { + } + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + + this.someId = someId; + return this; + } + + /** + * Get someId + * @return someId + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public BigDecimal getSomeId() { + return someId; + } + + + @JsonProperty(JSON_PROPERTY_SOME_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + + public FakeBigDecimalMap200Response someMap(Map someMap) { + + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + this.someMap.put(key, someMapItem); + return this; + } + + /** + * Get someMap + * @return someMap + **/ + @javax.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public Map getSomeMap() { + return someMap; + } + + + @JsonProperty(JSON_PROPERTY_SOME_MAP) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..88c1d374be6 --- /dev/null +++ b/samples/client/petstore/java/webclient/src/test/java/org/openapitools/client/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,58 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +public class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + public void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + public void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + public void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/client/petstore/k6/script.js b/samples/client/petstore/k6/script.js index a0ba72b227a..f0fe788e395 100644 --- a/samples/client/petstore/k6/script.js +++ b/samples/client/petstore/k6/script.js @@ -547,6 +547,19 @@ export default function() { } }); + group("/fake/BigDecimalMap", () => { + + // Request No. 1: fakeBigDecimalMap + { + let url = BASE_URL + `/fake/BigDecimalMap`; + let request = http.get(url); + + check(request, { + "successful operation": (r) => r.status === 200 + }); + } + }); + group("/fake/health", () => { // Request No. 1: diff --git a/samples/client/petstore/perl/.openapi-generator/FILES b/samples/client/petstore/perl/.openapi-generator/FILES index 73f05fa4007..4e8a811677d 100644 --- a/samples/client/petstore/perl/.openapi-generator/FILES +++ b/samples/client/petstore/perl/.openapi-generator/FILES @@ -24,6 +24,7 @@ docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md @@ -84,6 +85,7 @@ lib/WWW/OpenAPIClient/Object/DogAllOf.pm lib/WWW/OpenAPIClient/Object/EnumArrays.pm lib/WWW/OpenAPIClient/Object/EnumClass.pm lib/WWW/OpenAPIClient/Object/EnumTest.pm +lib/WWW/OpenAPIClient/Object/FakeBigDecimalMap200Response.pm lib/WWW/OpenAPIClient/Object/File.pm lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm lib/WWW/OpenAPIClient/Object/Foo.pm diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index ec789548c08..d51c2a9cb9b 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -261,6 +261,7 @@ use WWW::OpenAPIClient::Object::DogAllOf; use WWW::OpenAPIClient::Object::EnumArrays; use WWW::OpenAPIClient::Object::EnumClass; use WWW::OpenAPIClient::Object::EnumTest; +use WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response; use WWW::OpenAPIClient::Object::File; use WWW::OpenAPIClient::Object::FileSchemaTestClass; use WWW::OpenAPIClient::Object::Foo; @@ -329,6 +330,7 @@ use WWW::OpenAPIClient::Object::DogAllOf; use WWW::OpenAPIClient::Object::EnumArrays; use WWW::OpenAPIClient::Object::EnumClass; use WWW::OpenAPIClient::Object::EnumTest; +use WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response; use WWW::OpenAPIClient::Object::File; use WWW::OpenAPIClient::Object::FileSchemaTestClass; use WWW::OpenAPIClient::Object::Foo; @@ -386,6 +388,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | +*FakeApi* | [**fake_big_decimal_map**](docs/FakeApi.md#fake_big_decimal_map) | **GET** /fake/BigDecimalMap | *FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication *FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | @@ -447,6 +450,7 @@ Class | Method | HTTP request | Description - [WWW::OpenAPIClient::Object::EnumArrays](docs/EnumArrays.md) - [WWW::OpenAPIClient::Object::EnumClass](docs/EnumClass.md) - [WWW::OpenAPIClient::Object::EnumTest](docs/EnumTest.md) + - [WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [WWW::OpenAPIClient::Object::File](docs/File.md) - [WWW::OpenAPIClient::Object::FileSchemaTestClass](docs/FileSchemaTestClass.md) - [WWW::OpenAPIClient::Object::Foo](docs/Foo.md) diff --git a/samples/client/petstore/perl/docs/FakeApi.md b/samples/client/petstore/perl/docs/FakeApi.md index 5021dcc228d..546ef873a8a 100644 --- a/samples/client/petstore/perl/docs/FakeApi.md +++ b/samples/client/petstore/perl/docs/FakeApi.md @@ -9,6 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fake_big_decimal_map**](FakeApi.md#fake_big_decimal_map) | **GET** /fake/BigDecimalMap | [**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint [**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication [**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | @@ -28,6 +29,48 @@ Method | HTTP request | Description [**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | +# **fake_big_decimal_map** +> FakeBigDecimalMap200Response fake_big_decimal_map() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example +```perl +use Data::Dumper; +use WWW::OpenAPIClient::FakeApi; +my $api_instance = WWW::OpenAPIClient::FakeApi->new( +); + + +eval { + my $result = $api_instance->fake_big_decimal_map(); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling FakeApi->fake_big_decimal_map: $@\n"; +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + # **fake_health_get** > HealthCheckResult fake_health_get() diff --git a/samples/client/petstore/perl/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/perl/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..b48e28b64a4 --- /dev/null +++ b/samples/client/petstore/perl/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,16 @@ +# WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**some_id** | **double** | | [optional] +**some_map** | **HASH[string,double]** | | [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/perl/lib/WWW/OpenAPIClient/FakeApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm index 2712407215f..cdd5fa2cc10 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm @@ -48,6 +48,55 @@ sub new { } +# +# fake_big_decimal_map +# +# +# +{ + my $params = { + }; + __PACKAGE__->method_documentation->{ 'fake_big_decimal_map' } = { + summary => '', + params => $params, + returns => 'FakeBigDecimalMap200Response', + }; +} +# @return FakeBigDecimalMap200Response +# +sub fake_big_decimal_map { + my ($self, %args) = @_; + + # parse inputs + my $_resource_path = '/fake/BigDecimalMap'; + + my $_method = 'GET'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept('*/*'); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + + my $_body_data; + # 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('FakeBigDecimalMap200Response', $response); + return $_response_object; +} + # # fake_health_get # diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FakeBigDecimalMap200Response.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FakeBigDecimalMap200Response.pm new file mode 100644 index 00000000000..9168a546778 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FakeBigDecimalMap200Response.pm @@ -0,0 +1,251 @@ +=begin comment + +OpenAPI 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: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI 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: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + my $_json_attribute = $self->attribute_map->{$_key}; + my $_type = $self->openapi_types->{$_key}; + my $_value = $self->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + $_data->{$_json_attribute} = [ map { $self->_to_json_primitives($_subclass, $_) } @$_value ]; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$_value}) { + $_hash{$_key} = $self->_to_json_primitives($_subclass, $_element); + } + $_data->{$_json_attribute} = \%_hash; + } elsif ( grep( /^$_type$/, ('int', 'double', 'string', 'boolean', 'DATE', 'DATE_TIME'))) { + $_data->{$_json_attribute} = $self->_to_json_primitives($_type, $_value); + } else { + $_data->{$_json_attribute} = $_value; + } + } + } + + return $_data; +} + +# to_json non-array data +sub _to_json_primitives { + my ($self, $type, $data) = @_; + if ( grep( /^$type$/, ('int', 'double'))) { + # https://metacpan.org/pod/JSON#simple-scalars + # numify it, ensuring it will be dumped as a number + return undef unless defined $data; + return $data + 0; + } elsif ($type eq 'string') { + # https://metacpan.org/pod/JSON#simple-scalars + # stringified + return undef unless defined $data; + return $data . q(); + } elsif ($type eq 'boolean') { + # https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null + return $data ? \1 : \0; + } elsif ($type eq 'DATE') { + return undef unless defined $data; + if (ref($data) eq 'DateTime') { + # https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...) + return $data->ymd; + } + return $data .q(); + } elsif ($type eq 'DATE_TIME') { + return undef unless defined $data; + # the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z + if (ref($data) eq 'DateTime') { + # https://metacpan.org/pod/DateTime#$dt-%3Erfc3339 + return $data->rfc3339; + } + return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; + } +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double'))) { + return undef unless defined $data; + return $data + 0; + } elsif ($type eq 'string') { + return undef unless defined $data; + return $data . q(); + } elsif ($type eq 'boolean') { + return !!$data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + +__PACKAGE__->class_documentation({description => '', + class => 'FakeBigDecimalMap200Response', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'some_id' => { + datatype => 'double', + base_name => 'someId', + description => '', + format => '', + read_only => '', + }, + 'some_map' => { + datatype => 'HASH[string,double]', + base_name => 'someMap', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'some_id' => 'double', + 'some_map' => 'HASH[string,double]' +} ); + +__PACKAGE__->attribute_map( { + 'some_id' => 'someId', + 'some_map' => 'someMap' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/t/FakeBigDecimalMap200ResponseTest.t b/samples/client/petstore/perl/t/FakeBigDecimalMap200ResponseTest.t new file mode 100644 index 00000000000..49fa018db70 --- /dev/null +++ b/samples/client/petstore/perl/t/FakeBigDecimalMap200ResponseTest.t @@ -0,0 +1,34 @@ +=begin comment + +OpenAPI 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: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response'); + +# uncomment below and update the test +#my $instance = WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response->new(); +# +#isa_ok($instance, 'WWW::OpenAPIClient::Object::FakeBigDecimalMap200Response'); + diff --git a/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES b/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES index da556bb1e43..b496a9db963 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES +++ b/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES @@ -29,6 +29,7 @@ docs/Model/DogAllOf.md docs/Model/EnumArrays.md docs/Model/EnumClass.md docs/Model/EnumTest.md +docs/Model/FakeBigDecimalMap200Response.md docs/Model/File.md docs/Model/FileSchemaTestClass.md docs/Model/Foo.md @@ -88,6 +89,7 @@ lib/Model/DogAllOf.php lib/Model/EnumArrays.php lib/Model/EnumClass.php lib/Model/EnumTest.php +lib/Model/FakeBigDecimalMap200Response.php lib/Model/File.php lib/Model/FileSchemaTestClass.php lib/Model/Foo.php diff --git a/samples/client/petstore/php/OpenAPIClient-php/README.md b/samples/client/petstore/php/OpenAPIClient-php/README.md index 7fa29fca2a9..c8434e634d9 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/README.md +++ b/samples/client/petstore/php/OpenAPIClient-php/README.md @@ -74,6 +74,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123TestSpecialTags**](docs/Api/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](docs/Api/DefaultApi.md#fooget) | **GET** /foo | +*FakeApi* | [**fakeBigDecimalMap**](docs/Api/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | *FakeApi* | [**fakeHealthGet**](docs/Api/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeHttpSignatureTest**](docs/Api/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication *FakeApi* | [**fakeOuterBooleanSerialize**](docs/Api/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | @@ -135,6 +136,7 @@ Class | Method | HTTP request | Description - [EnumArrays](docs/Model/EnumArrays.md) - [EnumClass](docs/Model/EnumClass.md) - [EnumTest](docs/Model/EnumTest.md) +- [FakeBigDecimalMap200Response](docs/Model/FakeBigDecimalMap200Response.md) - [File](docs/Model/File.md) - [FileSchemaTestClass](docs/Model/FileSchemaTestClass.md) - [Foo](docs/Model/Foo.md) diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md index 69af2914b90..6de683cdd9c 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati | Method | HTTP request | Description | | ------------- | ------------- | ------------- | +| [**fakeBigDecimalMap()**](FakeApi.md#fakeBigDecimalMap) | **GET** /fake/BigDecimalMap | | | [**fakeHealthGet()**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint | | [**fakeHttpSignatureTest()**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication | | [**fakeOuterBooleanSerialize()**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | | @@ -23,6 +24,59 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati | [**testQueryParameterCollectionFormat()**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-parameters | | +## `fakeBigDecimalMap()` + +```php +fakeBigDecimalMap(): \OpenAPI\Client\Model\FakeBigDecimalMap200Response +``` + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example + +```php +fakeBigDecimalMap(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->fakeBigDecimalMap: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\OpenAPI\Client\Model\FakeBigDecimalMap200Response**](../Model/FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `*/*` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `fakeHealthGet()` ```php diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/FakeBigDecimalMap200Response.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..cc1f6338a8d --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/FakeBigDecimalMap200Response.md @@ -0,0 +1,10 @@ +# # FakeBigDecimalMap200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**some_id** | **float** | | [optional] +**some_map** | **array** | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php index b822b8334cd..edffb3c8720 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -71,6 +71,9 @@ class FakeApi /** @var string[] $contentTypes **/ public const contentTypes = [ + 'fakeBigDecimalMap' => [ + 'application/json', + ], 'fakeHealthGet' => [ 'application/json', ], @@ -171,6 +174,261 @@ class FakeApi return $this->config; } + /** + * Operation fakeBigDecimalMap + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeBigDecimalMap'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \OpenAPI\Client\Model\FakeBigDecimalMap200Response + */ + public function fakeBigDecimalMap(string $contentType = self::contentTypes['fakeBigDecimalMap'][0]) + { + list($response) = $this->fakeBigDecimalMapWithHttpInfo($contentType); + return $response; + } + + /** + * Operation fakeBigDecimalMapWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeBigDecimalMap'] to see the possible values for this operation + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \OpenAPI\Client\Model\FakeBigDecimalMap200Response, HTTP status code, HTTP response headers (array of strings) + */ + public function fakeBigDecimalMapWithHttpInfo(string $contentType = self::contentTypes['fakeBigDecimalMap'][0]) + { + $request = $this->fakeBigDecimalMapRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\OpenAPI\Client\Model\FakeBigDecimalMap200Response' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\OpenAPI\Client\Model\FakeBigDecimalMap200Response' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\FakeBigDecimalMap200Response', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\OpenAPI\Client\Model\FakeBigDecimalMap200Response'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\OpenAPI\Client\Model\FakeBigDecimalMap200Response', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fakeBigDecimalMapAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeBigDecimalMap'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeBigDecimalMapAsync(string $contentType = self::contentTypes['fakeBigDecimalMap'][0]) + { + return $this->fakeBigDecimalMapAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fakeBigDecimalMapAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeBigDecimalMap'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fakeBigDecimalMapAsyncWithHttpInfo(string $contentType = self::contentTypes['fakeBigDecimalMap'][0]) + { + $returnType = '\OpenAPI\Client\Model\FakeBigDecimalMap200Response'; + $request = $this->fakeBigDecimalMapRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fakeBigDecimalMap' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fakeBigDecimalMap'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function fakeBigDecimalMapRequest(string $contentType = self::contentTypes['fakeBigDecimalMap'][0]) + { + + + $resourcePath = '/fake/BigDecimalMap'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['*/*', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation fakeHealthGet * diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FakeBigDecimalMap200Response.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FakeBigDecimalMap200Response.php new file mode 100644 index 00000000000..05a00d232b6 --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/FakeBigDecimalMap200Response.php @@ -0,0 +1,443 @@ + + */ +class FakeBigDecimalMap200Response implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'fakeBigDecimalMap_200_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'some_id' => 'float', + 'some_map' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'some_id' => null, + 'some_map' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'some_id' => false, + 'some_map' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'some_id' => 'someId', + 'some_map' => 'someMap' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'some_id' => 'setSomeId', + 'some_map' => 'setSomeMap' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'some_id' => 'getSomeId', + 'some_map' => 'getSomeMap' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('some_id', $data ?? [], null); + $this->setIfExists('some_map', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets some_id + * + * @return float|null + */ + public function getSomeId() + { + return $this->container['some_id']; + } + + /** + * Sets some_id + * + * @param float|null $some_id some_id + * + * @return self + */ + public function setSomeId($some_id) + { + if (is_null($some_id)) { + throw new \InvalidArgumentException('non-nullable some_id cannot be null'); + } + $this->container['some_id'] = $some_id; + + return $this; + } + + /** + * Gets some_map + * + * @return array|null + */ + public function getSomeMap() + { + return $this->container['some_map']; + } + + /** + * Sets some_map + * + * @param array|null $some_map some_map + * + * @return self + */ + public function setSomeMap($some_map) + { + if (is_null($some_map)) { + throw new \InvalidArgumentException('non-nullable some_map cannot be null'); + } + $this->container['some_map'] = $some_map; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php/OpenAPIClient-php/test/Model/FakeBigDecimalMap200ResponseTest.php b/samples/client/petstore/php/OpenAPIClient-php/test/Model/FakeBigDecimalMap200ResponseTest.php new file mode 100644 index 00000000000..c3b6a2563ba --- /dev/null +++ b/samples/client/petstore/php/OpenAPIClient-php/test/Model/FakeBigDecimalMap200ResponseTest.php @@ -0,0 +1,99 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "some_id" + */ + public function testPropertySomeId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "some_map" + */ + public function testPropertySomeMap() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/samples/client/petstore/ruby-autoload/.openapi-generator/FILES b/samples/client/petstore/ruby-autoload/.openapi-generator/FILES index 9335129107c..ee516e123ab 100644 --- a/samples/client/petstore/ruby-autoload/.openapi-generator/FILES +++ b/samples/client/petstore/ruby-autoload/.openapi-generator/FILES @@ -28,6 +28,7 @@ docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md @@ -92,6 +93,7 @@ lib/petstore/models/dog_all_of.rb lib/petstore/models/enum_arrays.rb lib/petstore/models/enum_class.rb lib/petstore/models/enum_test.rb +lib/petstore/models/fake_big_decimal_map200_response.rb lib/petstore/models/file.rb lib/petstore/models/file_schema_test_class.rb lib/petstore/models/foo.rb diff --git a/samples/client/petstore/ruby-autoload/README.md b/samples/client/petstore/ruby-autoload/README.md index 09faa14436e..449dc151820 100644 --- a/samples/client/petstore/ruby-autoload/README.md +++ b/samples/client/petstore/ruby-autoload/README.md @@ -77,6 +77,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *Petstore::AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *Petstore::DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | +*Petstore::FakeApi* | [**fake_big_decimal_map**](docs/FakeApi.md#fake_big_decimal_map) | **GET** /fake/BigDecimalMap | *Petstore::FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint *Petstore::FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication *Petstore::FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | @@ -139,6 +140,7 @@ Class | Method | HTTP request | Description - [Petstore::EnumArrays](docs/EnumArrays.md) - [Petstore::EnumClass](docs/EnumClass.md) - [Petstore::EnumTest](docs/EnumTest.md) + - [Petstore::FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [Petstore::File](docs/File.md) - [Petstore::FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Petstore::Foo](docs/Foo.md) diff --git a/samples/client/petstore/ruby-autoload/docs/FakeApi.md b/samples/client/petstore/ruby-autoload/docs/FakeApi.md index 71fc522caf2..505e754f5ed 100644 --- a/samples/client/petstore/ruby-autoload/docs/FakeApi.md +++ b/samples/client/petstore/ruby-autoload/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**fake_big_decimal_map**](FakeApi.md#fake_big_decimal_map) | **GET** /fake/BigDecimalMap | | | [**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint | | [**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication | | [**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | | @@ -23,6 +24,67 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | | +## fake_big_decimal_map + +> fake_big_decimal_map + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Examples + +```ruby +require 'time' +require 'petstore' + +api_instance = Petstore::FakeApi.new + +begin + + result = api_instance.fake_big_decimal_map + p result +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->fake_big_decimal_map: #{e}" +end +``` + +#### Using the fake_big_decimal_map_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> fake_big_decimal_map_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.fake_big_decimal_map_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->fake_big_decimal_map_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + ## fake_health_get > fake_health_get diff --git a/samples/client/petstore/ruby-autoload/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/ruby-autoload/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..f564c4385e8 --- /dev/null +++ b/samples/client/petstore/ruby-autoload/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,20 @@ +# Petstore::FakeBigDecimalMap200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **some_id** | **Float** | | [optional] | +| **some_map** | **Hash<String, Float>** | | [optional] | + +## Example + +```ruby +require 'petstore' + +instance = Petstore::FakeBigDecimalMap200Response.new( + some_id: null, + some_map: null +) +``` + diff --git a/samples/client/petstore/ruby-autoload/lib/petstore.rb b/samples/client/petstore/ruby-autoload/lib/petstore.rb index a9e4c3bc9c4..1c062807f4b 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore.rb @@ -36,6 +36,7 @@ Petstore.autoload :DogAllOf, 'petstore/models/dog_all_of' Petstore.autoload :EnumArrays, 'petstore/models/enum_arrays' Petstore.autoload :EnumClass, 'petstore/models/enum_class' Petstore.autoload :EnumTest, 'petstore/models/enum_test' +Petstore.autoload :FakeBigDecimalMap200Response, 'petstore/models/fake_big_decimal_map200_response' Petstore.autoload :File, 'petstore/models/file' Petstore.autoload :FileSchemaTestClass, 'petstore/models/file_schema_test_class' Petstore.autoload :Foo, 'petstore/models/foo' diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb index 196bfc63bf7..8d6754208de 100644 --- a/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-autoload/lib/petstore/api/fake_api.rb @@ -19,6 +19,61 @@ module Petstore def initialize(api_client = ApiClient.default) @api_client = api_client end + # for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + # @param [Hash] opts the optional parameters + # @return [FakeBigDecimalMap200Response] + def fake_big_decimal_map(opts = {}) + data, _status_code, _headers = fake_big_decimal_map_with_http_info(opts) + data + end + + # for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + # @param [Hash] opts the optional parameters + # @return [Array<(FakeBigDecimalMap200Response, Integer, Hash)>] FakeBigDecimalMap200Response data, response status code and response headers + def fake_big_decimal_map_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.fake_big_decimal_map ...' + end + # resource path + local_var_path = '/fake/BigDecimalMap' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'FakeBigDecimalMap200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FakeApi.fake_big_decimal_map", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#fake_big_decimal_map\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Health check endpoint # @param [Hash] opts the optional parameters # @return [HealthCheckResult] diff --git a/samples/client/petstore/ruby-autoload/lib/petstore/models/fake_big_decimal_map200_response.rb b/samples/client/petstore/ruby-autoload/lib/petstore/models/fake_big_decimal_map200_response.rb new file mode 100644 index 00000000000..9407b0f057b --- /dev/null +++ b/samples/client/petstore/ruby-autoload/lib/petstore/models/fake_big_decimal_map200_response.rb @@ -0,0 +1,230 @@ +=begin +#OpenAPI 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: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Petstore + class FakeBigDecimalMap200Response + attr_accessor :some_id + + attr_accessor :some_map + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'some_id' => :'someId', + :'some_map' => :'someMap' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'some_id' => :'Float', + :'some_map' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::FakeBigDecimalMap200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'some_id') + self.some_id = attributes[:'some_id'] + end + + if attributes.key?(:'some_map') + if (value = attributes[:'some_map']).is_a?(Hash) + self.some_map = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + some_id == o.some_id && + some_map == o.some_map + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [some_id, some_map].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Petstore.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/petstore/ruby-autoload/spec/models/fake_big_decimal_map200_response_spec.rb b/samples/client/petstore/ruby-autoload/spec/models/fake_big_decimal_map200_response_spec.rb new file mode 100644 index 00000000000..a1b4a6c4641 --- /dev/null +++ b/samples/client/petstore/ruby-autoload/spec/models/fake_big_decimal_map200_response_spec.rb @@ -0,0 +1,40 @@ +=begin +#OpenAPI 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: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::FakeBigDecimalMap200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Petstore::FakeBigDecimalMap200Response do + let(:instance) { Petstore::FakeBigDecimalMap200Response.new } + + describe 'test an instance of FakeBigDecimalMap200Response' do + it 'should create an instance of FakeBigDecimalMap200Response' do + expect(instance).to be_instance_of(Petstore::FakeBigDecimalMap200Response) + end + end + describe 'test attribute "some_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "some_map"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/petstore/ruby-faraday/.openapi-generator/FILES b/samples/client/petstore/ruby-faraday/.openapi-generator/FILES index 9335129107c..ee516e123ab 100644 --- a/samples/client/petstore/ruby-faraday/.openapi-generator/FILES +++ b/samples/client/petstore/ruby-faraday/.openapi-generator/FILES @@ -28,6 +28,7 @@ docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md @@ -92,6 +93,7 @@ lib/petstore/models/dog_all_of.rb lib/petstore/models/enum_arrays.rb lib/petstore/models/enum_class.rb lib/petstore/models/enum_test.rb +lib/petstore/models/fake_big_decimal_map200_response.rb lib/petstore/models/file.rb lib/petstore/models/file_schema_test_class.rb lib/petstore/models/foo.rb diff --git a/samples/client/petstore/ruby-faraday/README.md b/samples/client/petstore/ruby-faraday/README.md index 09faa14436e..449dc151820 100644 --- a/samples/client/petstore/ruby-faraday/README.md +++ b/samples/client/petstore/ruby-faraday/README.md @@ -77,6 +77,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *Petstore::AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *Petstore::DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | +*Petstore::FakeApi* | [**fake_big_decimal_map**](docs/FakeApi.md#fake_big_decimal_map) | **GET** /fake/BigDecimalMap | *Petstore::FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint *Petstore::FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication *Petstore::FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | @@ -139,6 +140,7 @@ Class | Method | HTTP request | Description - [Petstore::EnumArrays](docs/EnumArrays.md) - [Petstore::EnumClass](docs/EnumClass.md) - [Petstore::EnumTest](docs/EnumTest.md) + - [Petstore::FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [Petstore::File](docs/File.md) - [Petstore::FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Petstore::Foo](docs/Foo.md) diff --git a/samples/client/petstore/ruby-faraday/docs/FakeApi.md b/samples/client/petstore/ruby-faraday/docs/FakeApi.md index 71fc522caf2..505e754f5ed 100644 --- a/samples/client/petstore/ruby-faraday/docs/FakeApi.md +++ b/samples/client/petstore/ruby-faraday/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**fake_big_decimal_map**](FakeApi.md#fake_big_decimal_map) | **GET** /fake/BigDecimalMap | | | [**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint | | [**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication | | [**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | | @@ -23,6 +24,67 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | | +## fake_big_decimal_map + +> fake_big_decimal_map + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Examples + +```ruby +require 'time' +require 'petstore' + +api_instance = Petstore::FakeApi.new + +begin + + result = api_instance.fake_big_decimal_map + p result +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->fake_big_decimal_map: #{e}" +end +``` + +#### Using the fake_big_decimal_map_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> fake_big_decimal_map_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.fake_big_decimal_map_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->fake_big_decimal_map_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + ## fake_health_get > fake_health_get diff --git a/samples/client/petstore/ruby-faraday/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/ruby-faraday/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..f564c4385e8 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,20 @@ +# Petstore::FakeBigDecimalMap200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **some_id** | **Float** | | [optional] | +| **some_map** | **Hash<String, Float>** | | [optional] | + +## Example + +```ruby +require 'petstore' + +instance = Petstore::FakeBigDecimalMap200Response.new( + some_id: null, + some_map: null +) +``` + diff --git a/samples/client/petstore/ruby-faraday/lib/petstore.rb b/samples/client/petstore/ruby-faraday/lib/petstore.rb index be66b1c7dbd..5f63374527e 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore.rb @@ -34,6 +34,7 @@ require 'petstore/models/dog_all_of' require 'petstore/models/enum_arrays' require 'petstore/models/enum_class' require 'petstore/models/enum_test' +require 'petstore/models/fake_big_decimal_map200_response' require 'petstore/models/file' require 'petstore/models/file_schema_test_class' require 'petstore/models/foo' diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb index 196bfc63bf7..8d6754208de 100644 --- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb @@ -19,6 +19,61 @@ module Petstore def initialize(api_client = ApiClient.default) @api_client = api_client end + # for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + # @param [Hash] opts the optional parameters + # @return [FakeBigDecimalMap200Response] + def fake_big_decimal_map(opts = {}) + data, _status_code, _headers = fake_big_decimal_map_with_http_info(opts) + data + end + + # for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + # @param [Hash] opts the optional parameters + # @return [Array<(FakeBigDecimalMap200Response, Integer, Hash)>] FakeBigDecimalMap200Response data, response status code and response headers + def fake_big_decimal_map_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.fake_big_decimal_map ...' + end + # resource path + local_var_path = '/fake/BigDecimalMap' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'FakeBigDecimalMap200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FakeApi.fake_big_decimal_map", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#fake_big_decimal_map\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Health check endpoint # @param [Hash] opts the optional parameters # @return [HealthCheckResult] diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/fake_big_decimal_map200_response.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/fake_big_decimal_map200_response.rb new file mode 100644 index 00000000000..9407b0f057b --- /dev/null +++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/fake_big_decimal_map200_response.rb @@ -0,0 +1,230 @@ +=begin +#OpenAPI 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: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Petstore + class FakeBigDecimalMap200Response + attr_accessor :some_id + + attr_accessor :some_map + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'some_id' => :'someId', + :'some_map' => :'someMap' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'some_id' => :'Float', + :'some_map' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::FakeBigDecimalMap200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'some_id') + self.some_id = attributes[:'some_id'] + end + + if attributes.key?(:'some_map') + if (value = attributes[:'some_map']).is_a?(Hash) + self.some_map = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + some_id == o.some_id && + some_map == o.some_map + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [some_id, some_map].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Petstore.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/petstore/ruby-faraday/spec/models/fake_big_decimal_map200_response_spec.rb b/samples/client/petstore/ruby-faraday/spec/models/fake_big_decimal_map200_response_spec.rb new file mode 100644 index 00000000000..a1b4a6c4641 --- /dev/null +++ b/samples/client/petstore/ruby-faraday/spec/models/fake_big_decimal_map200_response_spec.rb @@ -0,0 +1,40 @@ +=begin +#OpenAPI 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: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::FakeBigDecimalMap200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Petstore::FakeBigDecimalMap200Response do + let(:instance) { Petstore::FakeBigDecimalMap200Response.new } + + describe 'test an instance of FakeBigDecimalMap200Response' do + it 'should create an instance of FakeBigDecimalMap200Response' do + expect(instance).to be_instance_of(Petstore::FakeBigDecimalMap200Response) + end + end + describe 'test attribute "some_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "some_map"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/petstore/ruby/.openapi-generator/FILES b/samples/client/petstore/ruby/.openapi-generator/FILES index 9335129107c..ee516e123ab 100644 --- a/samples/client/petstore/ruby/.openapi-generator/FILES +++ b/samples/client/petstore/ruby/.openapi-generator/FILES @@ -28,6 +28,7 @@ docs/EnumArrays.md docs/EnumClass.md docs/EnumTest.md docs/FakeApi.md +docs/FakeBigDecimalMap200Response.md docs/FakeClassnameTags123Api.md docs/File.md docs/FileSchemaTestClass.md @@ -92,6 +93,7 @@ lib/petstore/models/dog_all_of.rb lib/petstore/models/enum_arrays.rb lib/petstore/models/enum_class.rb lib/petstore/models/enum_test.rb +lib/petstore/models/fake_big_decimal_map200_response.rb lib/petstore/models/file.rb lib/petstore/models/file_schema_test_class.rb lib/petstore/models/foo.rb diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 09faa14436e..449dc151820 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -77,6 +77,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *Petstore::AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *Petstore::DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | +*Petstore::FakeApi* | [**fake_big_decimal_map**](docs/FakeApi.md#fake_big_decimal_map) | **GET** /fake/BigDecimalMap | *Petstore::FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint *Petstore::FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication *Petstore::FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | @@ -139,6 +140,7 @@ Class | Method | HTTP request | Description - [Petstore::EnumArrays](docs/EnumArrays.md) - [Petstore::EnumClass](docs/EnumClass.md) - [Petstore::EnumTest](docs/EnumTest.md) + - [Petstore::FakeBigDecimalMap200Response](docs/FakeBigDecimalMap200Response.md) - [Petstore::File](docs/File.md) - [Petstore::FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Petstore::Foo](docs/Foo.md) diff --git a/samples/client/petstore/ruby/docs/FakeApi.md b/samples/client/petstore/ruby/docs/FakeApi.md index 71fc522caf2..505e754f5ed 100644 --- a/samples/client/petstore/ruby/docs/FakeApi.md +++ b/samples/client/petstore/ruby/docs/FakeApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**fake_big_decimal_map**](FakeApi.md#fake_big_decimal_map) | **GET** /fake/BigDecimalMap | | | [**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint | | [**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication | | [**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | | @@ -23,6 +24,67 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* | [**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | | +## fake_big_decimal_map + +> fake_big_decimal_map + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Examples + +```ruby +require 'time' +require 'petstore' + +api_instance = Petstore::FakeApi.new + +begin + + result = api_instance.fake_big_decimal_map + p result +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->fake_big_decimal_map: #{e}" +end +``` + +#### Using the fake_big_decimal_map_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> fake_big_decimal_map_with_http_info + +```ruby +begin + + data, status_code, headers = api_instance.fake_big_decimal_map_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Petstore::ApiError => e + puts "Error when calling FakeApi->fake_big_decimal_map_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: */* + + ## fake_health_get > fake_health_get diff --git a/samples/client/petstore/ruby/docs/FakeBigDecimalMap200Response.md b/samples/client/petstore/ruby/docs/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..f564c4385e8 --- /dev/null +++ b/samples/client/petstore/ruby/docs/FakeBigDecimalMap200Response.md @@ -0,0 +1,20 @@ +# Petstore::FakeBigDecimalMap200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **some_id** | **Float** | | [optional] | +| **some_map** | **Hash<String, Float>** | | [optional] | + +## Example + +```ruby +require 'petstore' + +instance = Petstore::FakeBigDecimalMap200Response.new( + some_id: null, + some_map: null +) +``` + diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index be66b1c7dbd..5f63374527e 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -34,6 +34,7 @@ require 'petstore/models/dog_all_of' require 'petstore/models/enum_arrays' require 'petstore/models/enum_class' require 'petstore/models/enum_test' +require 'petstore/models/fake_big_decimal_map200_response' require 'petstore/models/file' require 'petstore/models/file_schema_test_class' require 'petstore/models/foo' 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 196bfc63bf7..8d6754208de 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -19,6 +19,61 @@ module Petstore def initialize(api_client = ApiClient.default) @api_client = api_client end + # for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + # @param [Hash] opts the optional parameters + # @return [FakeBigDecimalMap200Response] + def fake_big_decimal_map(opts = {}) + data, _status_code, _headers = fake_big_decimal_map_with_http_info(opts) + data + end + + # for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + # @param [Hash] opts the optional parameters + # @return [Array<(FakeBigDecimalMap200Response, Integer, Hash)>] FakeBigDecimalMap200Response data, response status code and response headers + def fake_big_decimal_map_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FakeApi.fake_big_decimal_map ...' + end + # resource path + local_var_path = '/fake/BigDecimalMap' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'FakeBigDecimalMap200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || [] + + new_options = opts.merge( + :operation => :"FakeApi.fake_big_decimal_map", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#fake_big_decimal_map\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Health check endpoint # @param [Hash] opts the optional parameters # @return [HealthCheckResult] diff --git a/samples/client/petstore/ruby/lib/petstore/models/fake_big_decimal_map200_response.rb b/samples/client/petstore/ruby/lib/petstore/models/fake_big_decimal_map200_response.rb new file mode 100644 index 00000000000..9407b0f057b --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/fake_big_decimal_map200_response.rb @@ -0,0 +1,230 @@ +=begin +#OpenAPI 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: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Petstore + class FakeBigDecimalMap200Response + attr_accessor :some_id + + attr_accessor :some_map + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'some_id' => :'someId', + :'some_map' => :'someMap' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'some_id' => :'Float', + :'some_map' => :'Hash' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::FakeBigDecimalMap200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::FakeBigDecimalMap200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'some_id') + self.some_id = attributes[:'some_id'] + end + + if attributes.key?(:'some_map') + if (value = attributes[:'some_map']).is_a?(Hash) + self.some_map = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + some_id == o.some_id && + some_map == o.some_map + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [some_id, some_map].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Petstore.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/petstore/ruby/spec/models/fake_big_decimal_map200_response_spec.rb b/samples/client/petstore/ruby/spec/models/fake_big_decimal_map200_response_spec.rb new file mode 100644 index 00000000000..a1b4a6c4641 --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/fake_big_decimal_map200_response_spec.rb @@ -0,0 +1,40 @@ +=begin +#OpenAPI 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: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::FakeBigDecimalMap200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Petstore::FakeBigDecimalMap200Response do + let(:instance) { Petstore::FakeBigDecimalMap200Response.new } + + describe 'test an instance of FakeBigDecimalMap200Response' do + it 'should create an instance of FakeBigDecimalMap200Response' do + expect(instance).to be_instance_of(Petstore::FakeBigDecimalMap200Response) + end + end + describe 'test attribute "some_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "some_map"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES b/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES index 3c0152db6cb..57bd4d35573 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES @@ -25,6 +25,7 @@ models/DogAllOf.ts models/EnumArrays.ts models/EnumClass.ts models/EnumTest.ts +models/FakeBigDecimalMap200Response.ts models/FileSchemaTestClass.ts models/Foo.ts models/FooGetDefaultResponse.ts diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts index 254bd3d97ea..0d9ea6361d7 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts @@ -17,6 +17,7 @@ import * as runtime from '../runtime'; import type { Client, EnumClass, + FakeBigDecimalMap200Response, FileSchemaTestClass, HealthCheckResult, OuterComposite, @@ -29,6 +30,8 @@ import { ClientToJSON, EnumClassFromJSON, EnumClassToJSON, + FakeBigDecimalMap200ResponseFromJSON, + FakeBigDecimalMap200ResponseToJSON, FileSchemaTestClassFromJSON, FileSchemaTestClassToJSON, HealthCheckResultFromJSON, @@ -148,6 +151,32 @@ export interface TestQueryParameterCollectionFormatRequest { */ export class FakeApi extends runtime.BaseAPI { + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + */ + async fakeBigDecimalMapRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/fake/BigDecimalMap`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => FakeBigDecimalMap200ResponseFromJSON(jsonValue)); + } + + /** + * for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + */ + async fakeBigDecimalMap(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.fakeBigDecimalMapRaw(initOverrides); + return await response.value(); + } + /** * Health check endpoint */ diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts new file mode 100644 index 00000000000..32154096ade --- /dev/null +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/FakeBigDecimalMap200Response.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface FakeBigDecimalMap200Response + */ +export interface FakeBigDecimalMap200Response { + /** + * + * @type {number} + * @memberof FakeBigDecimalMap200Response + */ + someId?: number; + /** + * + * @type {{ [key: string]: number; }} + * @memberof FakeBigDecimalMap200Response + */ + someMap?: { [key: string]: number; }; +} + +/** + * Check if a given object implements the FakeBigDecimalMap200Response interface. + */ +export function instanceOfFakeBigDecimalMap200Response(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function FakeBigDecimalMap200ResponseFromJSON(json: any): FakeBigDecimalMap200Response { + return FakeBigDecimalMap200ResponseFromJSONTyped(json, false); +} + +export function FakeBigDecimalMap200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FakeBigDecimalMap200Response { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'someId': !exists(json, 'someId') ? undefined : json['someId'], + 'someMap': !exists(json, 'someMap') ? undefined : json['someMap'], + }; +} + +export function FakeBigDecimalMap200ResponseToJSON(value?: FakeBigDecimalMap200Response | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'someId': value.someId, + 'someMap': value.someMap, + }; +} + diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts index 7229eeb8e28..1f1b4adccec 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts @@ -18,6 +18,7 @@ export * from './DogAllOf'; export * from './EnumArrays'; export * from './EnumClass'; export * from './EnumTest'; +export * from './FakeBigDecimalMap200Response'; export * from './FileSchemaTestClass'; export * from './Foo'; export * from './FooGetDefaultResponse'; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES index b34094eb0a2..cf5312fb0ea 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/.openapi-generator/FILES @@ -22,6 +22,7 @@ doc/DogAllOf.md doc/EnumArrays.md doc/EnumTest.md doc/FakeApi.md +doc/FakeBigDecimalMap200Response.md doc/FakeClassnameTags123Api.md doc/FileSchemaTestClass.md doc/Foo.md @@ -89,6 +90,7 @@ lib/src/model/dog.dart lib/src/model/dog_all_of.dart lib/src/model/enum_arrays.dart lib/src/model/enum_test.dart +lib/src/model/fake_big_decimal_map200_response.dart lib/src/model/file_schema_test_class.dart lib/src/model/foo.dart lib/src/model/foo_get_default_response.dart diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md index 3dc249537ee..85f751287ad 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/README.md @@ -67,6 +67,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- [*AnotherFakeApi*](doc/AnotherFakeApi.md) | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags [*DefaultApi*](doc/DefaultApi.md) | [**fooGet**](doc/DefaultApi.md#fooget) | **GET** /foo | +[*FakeApi*](doc/FakeApi.md) | [**fakeBigDecimalMap**](doc/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | [*FakeApi*](doc/FakeApi.md) | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint [*FakeApi*](doc/FakeApi.md) | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication [*FakeApi*](doc/FakeApi.md) | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | @@ -127,6 +128,7 @@ Class | Method | HTTP request | Description - [DogAllOf](doc/DogAllOf.md) - [EnumArrays](doc/EnumArrays.md) - [EnumTest](doc/EnumTest.md) + - [FakeBigDecimalMap200Response](doc/FakeBigDecimalMap200Response.md) - [FileSchemaTestClass](doc/FileSchemaTestClass.md) - [Foo](doc/Foo.md) - [FooGetDefaultResponse](doc/FooGetDefaultResponse.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md index 5a7f451a470..95579d12a55 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeApi.md @@ -9,6 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | [**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint [**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication [**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | @@ -28,6 +29,45 @@ Method | HTTP request | Description [**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +# **fakeBigDecimalMap** +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); + +try { + final response = api.fakeBigDecimalMap(); + print(response); +} catch on DioError (e) { + print('Exception when calling FakeApi->fakeBigDecimalMap: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + # **fakeHealthGet** > HealthCheckResult fakeHealthGet() diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeBigDecimalMap200Response.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..281dfc44fd8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/doc/FakeBigDecimalMap200Response.md @@ -0,0 +1,16 @@ +# openapi.model.FakeBigDecimalMap200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someId** | **num** | | [optional] +**someMap** | **Map<String, num>** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart index 3beabf11dfc..0cb4a8a490a 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/openapi.dart @@ -33,6 +33,7 @@ export 'package:openapi/src/model/dog.dart'; export 'package:openapi/src/model/dog_all_of.dart'; export 'package:openapi/src/model/enum_arrays.dart'; export 'package:openapi/src/model/enum_test.dart'; +export 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; export 'package:openapi/src/model/file_schema_test_class.dart'; export 'package:openapi/src/model/foo.dart'; export 'package:openapi/src/model/foo_get_default_response.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart index 8cbb2eee00e..66f01d58e76 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/api/fake_api.dart @@ -9,6 +9,7 @@ import 'dart:convert'; import 'package:openapi/src/deserialize.dart'; import 'package:dio/dio.dart'; +import 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; import 'package:openapi/src/model/file_schema_test_class.dart'; import 'package:openapi/src/model/health_check_result.dart'; import 'package:openapi/src/model/model_client.dart'; @@ -24,6 +25,75 @@ class FakeApi { const FakeApi(this._dio); + /// fakeBigDecimalMap + /// for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FakeBigDecimalMap200Response] as data + /// Throws [DioError] if API call or serialization fails + Future> fakeBigDecimalMap({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/BigDecimalMap'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FakeBigDecimalMap200Response? _responseData; + + try { +final rawData = _response.data; +_responseData = rawData == null ? null : deserialize(rawData, 'FakeBigDecimalMap200Response', growable: true); + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + /// Health check endpoint /// /// diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart index 5460a3d223e..cdd4ca6e0b8 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/deserialize.dart @@ -15,6 +15,7 @@ import 'package:openapi/src/model/dog.dart'; import 'package:openapi/src/model/dog_all_of.dart'; import 'package:openapi/src/model/enum_arrays.dart'; import 'package:openapi/src/model/enum_test.dart'; +import 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; import 'package:openapi/src/model/file_schema_test_class.dart'; import 'package:openapi/src/model/foo.dart'; import 'package:openapi/src/model/foo_get_default_response.dart'; @@ -93,6 +94,8 @@ final _regMap = RegExp(r'^Map$'); return EnumArrays.fromJson(value as Map) as ReturnType; case 'EnumTest': return EnumTest.fromJson(value as Map) as ReturnType; + case 'FakeBigDecimalMap200Response': + return FakeBigDecimalMap200Response.fromJson(value as Map) as ReturnType; case 'FileSchemaTestClass': return FileSchemaTestClass.fromJson(value as Map) as ReturnType; case 'Foo': diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/fake_big_decimal_map200_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/fake_big_decimal_map200_response.dart new file mode 100644 index 00000000000..965257f0a07 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/lib/src/model/fake_big_decimal_map200_response.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:json_annotation/json_annotation.dart'; + +part 'fake_big_decimal_map200_response.g.dart'; + + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: false, + explicitToJson: true, +) +class FakeBigDecimalMap200Response { + /// Returns a new [FakeBigDecimalMap200Response] instance. + FakeBigDecimalMap200Response({ + + this.someId, + + this.someMap, + }); + + @JsonKey( + + name: r'someId', + required: false, + includeIfNull: false + ) + + + final num? someId; + + + + @JsonKey( + + name: r'someMap', + required: false, + includeIfNull: false + ) + + + final Map? someMap; + + + + @override + bool operator ==(Object other) => identical(this, other) || other is FakeBigDecimalMap200Response && + other.someId == someId && + other.someMap == someMap; + + @override + int get hashCode => + someId.hashCode + + someMap.hashCode; + + factory FakeBigDecimalMap200Response.fromJson(Map json) => _$FakeBigDecimalMap200ResponseFromJson(json); + + Map toJson() => _$FakeBigDecimalMap200ResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/fake_big_decimal_map200_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/fake_big_decimal_map200_response_test.dart new file mode 100644 index 00000000000..1279b8d0ff2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake-json_serializable/test/fake_big_decimal_map200_response_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FakeBigDecimalMap200Response +void main() { + final FakeBigDecimalMap200Response? instance = /* FakeBigDecimalMap200Response(...) */ null; + // TODO add properties to the entity + + group(FakeBigDecimalMap200Response, () { + // num someId + test('to test the property `someId`', () async { + // TODO + }); + + // Map someMap + test('to test the property `someMap`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES index 1a69ee77d62..a4c5dcbdac1 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES @@ -21,6 +21,7 @@ doc/DogAllOf.md doc/EnumArrays.md doc/EnumTest.md doc/FakeApi.md +doc/FakeBigDecimalMap200Response.md doc/FakeClassnameTags123Api.md doc/FileSchemaTestClass.md doc/Foo.md @@ -90,6 +91,7 @@ lib/src/model/dog.dart lib/src/model/dog_all_of.dart lib/src/model/enum_arrays.dart lib/src/model/enum_test.dart +lib/src/model/fake_big_decimal_map200_response.dart lib/src/model/file_schema_test_class.dart lib/src/model/foo.dart lib/src/model/foo_get_default_response.dart diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md index a70c0ef97df..d471886acd6 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md @@ -66,6 +66,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- [*AnotherFakeApi*](doc/AnotherFakeApi.md) | [**call123testSpecialTags**](doc/AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags [*DefaultApi*](doc/DefaultApi.md) | [**fooGet**](doc/DefaultApi.md#fooget) | **GET** /foo | +[*FakeApi*](doc/FakeApi.md) | [**fakeBigDecimalMap**](doc/FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | [*FakeApi*](doc/FakeApi.md) | [**fakeHealthGet**](doc/FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint [*FakeApi*](doc/FakeApi.md) | [**fakeHttpSignatureTest**](doc/FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication [*FakeApi*](doc/FakeApi.md) | [**fakeOuterBooleanSerialize**](doc/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | @@ -126,6 +127,7 @@ Class | Method | HTTP request | Description - [DogAllOf](doc/DogAllOf.md) - [EnumArrays](doc/EnumArrays.md) - [EnumTest](doc/EnumTest.md) + - [FakeBigDecimalMap200Response](doc/FakeBigDecimalMap200Response.md) - [FileSchemaTestClass](doc/FileSchemaTestClass.md) - [Foo](doc/Foo.md) - [FooGetDefaultResponse](doc/FooGetDefaultResponse.md) diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md index 28e3975dc6a..a1c62eb1b6d 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md @@ -9,6 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | [**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint [**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication [**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | @@ -28,6 +29,45 @@ Method | HTTP request | Description [**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +# **fakeBigDecimalMap** +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example +```dart +import 'package:openapi/api.dart'; + +final api = Openapi().getFakeApi(); + +try { + final response = api.fakeBigDecimalMap(); + print(response); +} catch on DioError (e) { + print('Exception when calling FakeApi->fakeBigDecimalMap: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + # **fakeHealthGet** > HealthCheckResult fakeHealthGet() diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeBigDecimalMap200Response.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..cedb487c954 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeBigDecimalMap200Response.md @@ -0,0 +1,16 @@ +# openapi.model.FakeBigDecimalMap200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someId** | **num** | | [optional] +**someMap** | **BuiltMap<String, num>** | | [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/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart index 17f56a53fae..688f7456517 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/openapi.dart @@ -34,6 +34,7 @@ export 'package:openapi/src/model/dog.dart'; export 'package:openapi/src/model/dog_all_of.dart'; export 'package:openapi/src/model/enum_arrays.dart'; export 'package:openapi/src/model/enum_test.dart'; +export 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; export 'package:openapi/src/model/file_schema_test_class.dart'; export 'package:openapi/src/model/foo.dart'; export 'package:openapi/src/model/foo_get_default_response.dart'; diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart index fd7946aa22e..e72eb1d5bac 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/api/fake_api.dart @@ -11,6 +11,7 @@ import 'dart:typed_data'; import 'package:built_collection/built_collection.dart'; import 'package:openapi/src/api_util.dart'; import 'package:openapi/src/model/date.dart'; +import 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; import 'package:openapi/src/model/file_schema_test_class.dart'; import 'package:openapi/src/model/health_check_result.dart'; import 'package:openapi/src/model/model_client.dart'; @@ -28,6 +29,79 @@ class FakeApi { const FakeApi(this._dio, this._serializers); + /// fakeBigDecimalMap + /// for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + /// + /// Parameters: + /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation + /// * [headers] - Can be used to add additional headers to the request + /// * [extras] - Can be used to add flags to the request + /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response + /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress + /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress + /// + /// Returns a [Future] containing a [Response] with a [FakeBigDecimalMap200Response] as data + /// Throws [DioError] if API call or serialization fails + Future> fakeBigDecimalMap({ + CancelToken? cancelToken, + Map? headers, + Map? extra, + ValidateStatus? validateStatus, + ProgressCallback? onSendProgress, + ProgressCallback? onReceiveProgress, + }) async { + final _path = r'/fake/BigDecimalMap'; + final _options = Options( + method: r'GET', + headers: { + ...?headers, + }, + extra: { + 'secure': >[], + ...?extra, + }, + validateStatus: validateStatus, + ); + + final _response = await _dio.request( + _path, + options: _options, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + onReceiveProgress: onReceiveProgress, + ); + + FakeBigDecimalMap200Response? _responseData; + + try { + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(FakeBigDecimalMap200Response), + ) as FakeBigDecimalMap200Response; + + } catch (error, stackTrace) { + throw DioError( + requestOptions: _response.requestOptions, + response: _response, + type: DioErrorType.unknown, + error: error, + stackTrace: stackTrace, + ); + } + + return Response( + data: _responseData, + headers: _response.headers, + isRedirect: _response.isRedirect, + requestOptions: _response.requestOptions, + redirects: _response.redirects, + statusCode: _response.statusCode, + statusMessage: _response.statusMessage, + extra: _response.extra, + ); + } + /// Health check endpoint /// /// diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/fake_big_decimal_map200_response.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/fake_big_decimal_map200_response.dart new file mode 100644 index 00000000000..ddfab9d2b56 --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/model/fake_big_decimal_map200_response.dart @@ -0,0 +1,127 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:built_collection/built_collection.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; + +part 'fake_big_decimal_map200_response.g.dart'; + +/// FakeBigDecimalMap200Response +/// +/// Properties: +/// * [someId] +/// * [someMap] +@BuiltValue() +abstract class FakeBigDecimalMap200Response implements Built { + @BuiltValueField(wireName: r'someId') + num? get someId; + + @BuiltValueField(wireName: r'someMap') + BuiltMap? get someMap; + + FakeBigDecimalMap200Response._(); + + factory FakeBigDecimalMap200Response([void updates(FakeBigDecimalMap200ResponseBuilder b)]) = _$FakeBigDecimalMap200Response; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(FakeBigDecimalMap200ResponseBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$FakeBigDecimalMap200ResponseSerializer(); +} + +class _$FakeBigDecimalMap200ResponseSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [FakeBigDecimalMap200Response, _$FakeBigDecimalMap200Response]; + + @override + final String wireName = r'FakeBigDecimalMap200Response'; + + Iterable _serializeProperties( + Serializers serializers, + FakeBigDecimalMap200Response object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + if (object.someId != null) { + yield r'someId'; + yield serializers.serialize( + object.someId, + specifiedType: const FullType(num), + ); + } + if (object.someMap != null) { + yield r'someMap'; + yield serializers.serialize( + object.someMap, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(num)]), + ); + } + } + + @override + Object serialize( + Serializers serializers, + FakeBigDecimalMap200Response object, { + FullType specifiedType = FullType.unspecified, + }) { + return _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required FakeBigDecimalMap200ResponseBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'someId': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(num), + ) as num; + result.someId = valueDes; + break; + case r'someMap': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(BuiltMap, [FullType(String), FullType(num)]), + ) as BuiltMap; + result.someMap.replace(valueDes); + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + FakeBigDecimalMap200Response deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = FakeBigDecimalMap200ResponseBuilder(); + final serializedList = (serialized as Iterable).toList(); + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result, + ); + return result.build(); + } +} + diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/serializers.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/serializers.dart index 60f50e5a77f..e5f47e49c2c 100644 --- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/serializers.dart +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/src/serializers.dart @@ -31,6 +31,7 @@ import 'package:openapi/src/model/dog.dart'; import 'package:openapi/src/model/dog_all_of.dart'; import 'package:openapi/src/model/enum_arrays.dart'; import 'package:openapi/src/model/enum_test.dart'; +import 'package:openapi/src/model/fake_big_decimal_map200_response.dart'; import 'package:openapi/src/model/file_schema_test_class.dart'; import 'package:openapi/src/model/foo.dart'; import 'package:openapi/src/model/foo_get_default_response.dart'; @@ -83,6 +84,7 @@ part 'serializers.g.dart'; DogAllOf,$DogAllOf, EnumArrays, EnumTest, + FakeBigDecimalMap200Response, FileSchemaTestClass, Foo, FooGetDefaultResponse, diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_big_decimal_map200_response_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_big_decimal_map200_response_test.dart new file mode 100644 index 00000000000..f316fc6038b --- /dev/null +++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/fake_big_decimal_map200_response_test.dart @@ -0,0 +1,21 @@ +import 'package:test/test.dart'; +import 'package:openapi/openapi.dart'; + +// tests for FakeBigDecimalMap200Response +void main() { + final instance = FakeBigDecimalMap200ResponseBuilder(); + // TODO add properties to the builder and call build() + + group(FakeBigDecimalMap200Response, () { + // num someId + test('to test the property `someId`', () async { + // TODO + }); + + // BuiltMap someMap + test('to test the property `someMap`', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES index c2faff09ed8..d03b9189b7f 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES @@ -23,6 +23,7 @@ doc/EnumArrays.md doc/EnumClass.md doc/EnumTest.md doc/FakeApi.md +doc/FakeBigDecimalMap200Response.md doc/FakeClassnameTags123Api.md doc/FileSchemaTestClass.md doc/Foo.md @@ -92,6 +93,7 @@ lib/model/dog_all_of.dart lib/model/enum_arrays.dart lib/model/enum_class.dart lib/model/enum_test.dart +lib/model/fake_big_decimal_map200_response.dart lib/model/file_schema_test_class.dart lib/model/foo.dart lib/model/foo_get_default_response.dart diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md index d64e7ce298b..bb9950444ab 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md @@ -60,6 +60,7 @@ Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call123testSpecialTags**](doc//AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags *DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **GET** /foo | +*FakeApi* | [**fakeBigDecimalMap**](doc//FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | *FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication *FakeApi* | [**fakeOuterBooleanSerialize**](doc//FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | @@ -121,6 +122,7 @@ Class | Method | HTTP request | Description - [EnumArrays](doc//EnumArrays.md) - [EnumClass](doc//EnumClass.md) - [EnumTest](doc//EnumTest.md) + - [FakeBigDecimalMap200Response](doc//FakeBigDecimalMap200Response.md) - [FileSchemaTestClass](doc//FileSchemaTestClass.md) - [Foo](doc//Foo.md) - [FooGetDefaultResponse](doc//FooGetDefaultResponse.md) diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md index 0bb17eb79f7..5998db8502d 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md @@ -9,6 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeBigDecimalMap**](FakeApi.md#fakebigdecimalmap) | **GET** /fake/BigDecimalMap | [**fakeHealthGet**](FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint [**fakeHttpSignatureTest**](FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication [**fakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | @@ -28,6 +29,45 @@ Method | HTTP request | Description [**testQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | +# **fakeBigDecimalMap** +> FakeBigDecimalMap200Response fakeBigDecimalMap() + + + +for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); + +try { + final result = api_instance.fakeBigDecimalMap(); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeBigDecimalMap: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FakeBigDecimalMap200Response**](FakeBigDecimalMap200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + +[[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) + # **fakeHealthGet** > HealthCheckResult fakeHealthGet() diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeBigDecimalMap200Response.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeBigDecimalMap200Response.md new file mode 100644 index 00000000000..21ccf6ec012 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeBigDecimalMap200Response.md @@ -0,0 +1,16 @@ +# openapi.model.FakeBigDecimalMap200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**someId** | **num** | | [optional] +**someMap** | **Map** | | [optional] [default to const {}] + +[[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/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart index e624212cc80..92805161556 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart @@ -53,6 +53,7 @@ part 'model/dog_all_of.dart'; part 'model/enum_arrays.dart'; part 'model/enum_class.dart'; part 'model/enum_test.dart'; +part 'model/fake_big_decimal_map200_response.dart'; part 'model/file_schema_test_class.dart'; part 'model/foo.dart'; part 'model/foo_get_default_response.dart'; diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart index 6cfbfb4e6c9..f808cb0cf33 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart @@ -16,6 +16,50 @@ class FakeApi { final ApiClient apiClient; + /// for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + /// + /// Note: This method returns the HTTP [Response]. + Future fakeBigDecimalMapWithHttpInfo() async { + // ignore: prefer_const_declarations + final path = r'/fake/BigDecimalMap'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + Future fakeBigDecimalMap() async { + final response = await fakeBigDecimalMapWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'FakeBigDecimalMap200Response',) as FakeBigDecimalMap200Response; + + } + return null; + } + /// Health check endpoint /// /// Note: This method returns the HTTP [Response]. diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index 22839ae04f0..729af42b686 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -217,6 +217,8 @@ class ApiClient { return EnumClassTypeTransformer().decode(value); case 'EnumTest': return EnumTest.fromJson(value); + case 'FakeBigDecimalMap200Response': + return FakeBigDecimalMap200Response.fromJson(value); case 'FileSchemaTestClass': return FileSchemaTestClass.fromJson(value); case 'Foo': diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/fake_big_decimal_map200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/fake_big_decimal_map200_response.dart new file mode 100644 index 00000000000..bb878b52c06 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/fake_big_decimal_map200_response.dart @@ -0,0 +1,127 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class FakeBigDecimalMap200Response { + /// Returns a new [FakeBigDecimalMap200Response] instance. + FakeBigDecimalMap200Response({ + this.someId, + this.someMap = const {}, + }); + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + num? someId; + + Map someMap; + + @override + bool operator ==(Object other) => identical(this, other) || other is FakeBigDecimalMap200Response && + other.someId == someId && + other.someMap == someMap; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (someId == null ? 0 : someId!.hashCode) + + (someMap.hashCode); + + @override + String toString() => 'FakeBigDecimalMap200Response[someId=$someId, someMap=$someMap]'; + + Map toJson() { + final json = {}; + if (this.someId != null) { + json[r'someId'] = this.someId; + } else { + json[r'someId'] = null; + } + json[r'someMap'] = this.someMap; + return json; + } + + /// Returns a new [FakeBigDecimalMap200Response] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static FakeBigDecimalMap200Response? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // Ensure that the map contains the required keys. + // Note 1: the values aren't checked for validity beyond being non-null. + // Note 2: this code is stripped in release mode! + assert(() { + requiredKeys.forEach((key) { + assert(json.containsKey(key), 'Required key "FakeBigDecimalMap200Response[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "FakeBigDecimalMap200Response[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return FakeBigDecimalMap200Response( + someId: json[r'someId'] == null + ? null + : num.parse(json[r'someId'].toString()), + someMap: mapCastOfType(json, r'someMap') ?? const {}, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = FakeBigDecimalMap200Response.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = FakeBigDecimalMap200Response.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of FakeBigDecimalMap200Response-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = FakeBigDecimalMap200Response.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_big_decimal_map200_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_big_decimal_map200_response_test.dart new file mode 100644 index 00000000000..7f888e73d4a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/fake_big_decimal_map200_response_test.dart @@ -0,0 +1,32 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.12 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for FakeBigDecimalMap200Response +void main() { + // final instance = FakeBigDecimalMap200Response(); + + group('test FakeBigDecimalMap200Response', () { + // num someId + test('to test the property `someId`', () async { + // TODO + }); + + // Map someMap (default value: const {}) + test('to test the property `someMap`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/schema/petstore/mysql/.openapi-generator/FILES b/samples/schema/petstore/mysql/.openapi-generator/FILES index 84ef3294ab0..32d5e5f3d7b 100644 --- a/samples/schema/petstore/mysql/.openapi-generator/FILES +++ b/samples/schema/petstore/mysql/.openapi-generator/FILES @@ -18,6 +18,7 @@ Model/DogAllOf.sql Model/EnumArrays.sql Model/EnumClass.sql Model/EnumTest.sql +Model/FakeBigDecimalMap200Response.sql Model/File.sql Model/FileSchemaTestClass.sql Model/Foo.sql diff --git a/samples/schema/petstore/mysql/Model/FakeBigDecimalMap200Response.sql b/samples/schema/petstore/mysql/Model/FakeBigDecimalMap200Response.sql new file mode 100644 index 00000000000..6fb033219f0 --- /dev/null +++ b/samples/schema/petstore/mysql/Model/FakeBigDecimalMap200Response.sql @@ -0,0 +1,26 @@ +-- +-- OpenAPI Petstore. +-- Prepared SQL queries for 'fakeBigDecimalMap_200_response' definition. +-- + + +-- +-- SELECT template for table `fakeBigDecimalMap_200_response` +-- +SELECT `someId`, `someMap` FROM `fakeBigDecimalMap_200_response` WHERE 1; + +-- +-- INSERT template for table `fakeBigDecimalMap_200_response` +-- +INSERT INTO `fakeBigDecimalMap_200_response`(`someId`, `someMap`) VALUES (?, ?); + +-- +-- UPDATE template for table `fakeBigDecimalMap_200_response` +-- +UPDATE `fakeBigDecimalMap_200_response` SET `someId` = ?, `someMap` = ? WHERE 1; + +-- +-- DELETE template for table `fakeBigDecimalMap_200_response` +-- +DELETE FROM `fakeBigDecimalMap_200_response` WHERE 0; + diff --git a/samples/schema/petstore/mysql/mysql_schema.sql b/samples/schema/petstore/mysql/mysql_schema.sql index d22077b8d12..cdee918e797 100644 --- a/samples/schema/petstore/mysql/mysql_schema.sql +++ b/samples/schema/petstore/mysql/mysql_schema.sql @@ -185,6 +185,15 @@ CREATE TABLE IF NOT EXISTS `Enum_Test` ( `outerEnumIntegerDefaultValue` TEXT DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +-- +-- Table structure for table `fakeBigDecimalMap_200_response` generated from model 'fakeBigDecimalMapUnderscore200Underscoreresponse' +-- + +CREATE TABLE IF NOT EXISTS `fakeBigDecimalMap_200_response` ( + `someId` DECIMAL(20, 9) DEFAULT NULL, + `someMap` JSON DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `File` generated from model 'File' -- Must be named `File` for test. diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/.openapi-generator/FILES b/samples/server/petstore/cpp-restbed/generated/3_0/.openapi-generator/FILES index ab1dc1a7a75..c35019313a8 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/.openapi-generator/FILES +++ b/samples/server/petstore/cpp-restbed/generated/3_0/.openapi-generator/FILES @@ -55,6 +55,8 @@ model/EnumClass.cpp model/EnumClass.h model/Enum_Test.cpp model/Enum_Test.h +model/FakeBigDecimalMap_200_response.cpp +model/FakeBigDecimalMap_200_response.h model/File.cpp model/File.h model/FileSchemaTestClass.cpp diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.cpp index bcdca0dcdaf..12b0d05c209 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.cpp +++ b/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.cpp @@ -114,6 +114,117 @@ std::string convertMapResponse(const std::map& map) } namespace FakeApiResources { +FakeBigDecimalMapResource::FakeBigDecimalMapResource(const std::string& context /* = "/v2" */) +{ + this->set_path(context + "/fake/BigDecimalMap"); + this->set_method_handler("GET", + std::bind(&FakeBigDecimalMapResource::handler_GET_internal, this, + std::placeholders::_1)); +} + +std::pair FakeBigDecimalMapResource::handleFakeApiException(const FakeApiException& e) +{ + return std::make_pair(e.getStatus(), e.what()); +} + +std::pair FakeBigDecimalMapResource::handleStdException(const std::exception& e) +{ + return std::make_pair(500, e.what()); +} + +std::pair FakeBigDecimalMapResource::handleUnspecifiedException() +{ + return std::make_pair(500, "Unknown exception occurred"); +} + +void FakeBigDecimalMapResource::setResponseHeader(const std::shared_ptr& session, const std::string& header) +{ + session->set_header(header, ""); +} + +void FakeBigDecimalMapResource::returnResponse(const std::shared_ptr& session, const int status, const std::string& result, std::multimap& responseHeaders) +{ + responseHeaders.insert(std::make_pair("Connection", "close")); + session->close(status, result, responseHeaders); +} + +void FakeBigDecimalMapResource::defaultSessionClose(const std::shared_ptr& session, const int status, const std::string& result) +{ + session->close(status, result, { {"Connection", "close"} }); +} + +void FakeBigDecimalMapResource::handler_GET_internal(const std::shared_ptr session) +{ + const auto request = session->get_request(); + + int status_code = 500; + FakeBigDecimalMap_200_response resultObject = FakeBigDecimalMap_200_response{}; + std::string result = ""; + + try { + std::tie(status_code, resultObject) = + handler_GET(); + } + catch(const FakeApiException& e) { + std::tie(status_code, result) = handleFakeApiException(e); + } + catch(const std::exception& e) { + std::tie(status_code, result) = handleStdException(e); + } + catch(...) { + std::tie(status_code, result) = handleUnspecifiedException(); + } + + std::multimap< std::string, std::string > responseHeaders {}; + static const std::vector contentTypes{ + "*/*", + }; + static const std::string acceptTypes{ + }; + + if (status_code == 200) { + responseHeaders.insert(std::make_pair("Content-Type", selectPreferredContentType(contentTypes))); + if (!acceptTypes.empty()) { + responseHeaders.insert(std::make_pair("Accept", acceptTypes)); + } + + result = resultObject.toJsonString(); + returnResponse(session, 200, result.empty() ? "{}" : result, responseHeaders); + return; + } + defaultSessionClose(session, status_code, result); +} + + +std::pair FakeBigDecimalMapResource::handler_GET( + ) +{ + return handler_GET_func(); +} + + +std::string FakeBigDecimalMapResource::extractBodyContent(const std::shared_ptr& session) { + const auto request = session->get_request(); + int content_length = request->get_header("Content-Length", 0); + std::string bodyContent; + session->fetch(content_length, + [&bodyContent](const std::shared_ptr session, + const restbed::Bytes &body) { + bodyContent = restbed::String::format( + "%.*s\n", (int)body.size(), body.data()); + }); + return bodyContent; +} + +std::string FakeBigDecimalMapResource::extractFormParamsFromBody(const std::string& paramName, const std::string& body) { + const auto uri = restbed::Uri("urlencoded?" + body, true); + const auto params = uri.get_query_parameters(); + const auto result = params.find(paramName); + if (result != params.cend()) { + return result->second; + } + return ""; +} FakeHealthResource::FakeHealthResource(const std::string& context /* = "/v2" */) { this->set_path(context + "/fake/health"); @@ -1945,6 +2056,12 @@ FakeApi::FakeApi(std::shared_ptr const& restbedService) FakeApi::~FakeApi() {} +std::shared_ptr FakeApi::getFakeBigDecimalMapResource() { + if (!m_spFakeBigDecimalMapResource) { + setResource(std::make_shared()); + } + return m_spFakeBigDecimalMapResource; +} std::shared_ptr FakeApi::getFakeHealthResource() { if (!m_spFakeHealthResource) { setResource(std::make_shared()); @@ -2029,6 +2146,10 @@ std::shared_ptr FakeApi::ge } return m_spFakeTest_query_parametersResource; } +void FakeApi::setResource(std::shared_ptr resource) { + m_spFakeBigDecimalMapResource = resource; + m_service->publish(m_spFakeBigDecimalMapResource); +} void FakeApi::setResource(std::shared_ptr resource) { m_spFakeHealthResource = resource; m_service->publish(m_spFakeHealthResource); @@ -2085,6 +2206,10 @@ void FakeApi::setResource(std::shared_ptrpublish(m_spFakeTest_query_parametersResource); } +void FakeApi::setFakeApiFakeBigDecimalMapResource(std::shared_ptr spFakeBigDecimalMapResource) { + m_spFakeBigDecimalMapResource = spFakeBigDecimalMapResource; + m_service->publish(m_spFakeBigDecimalMapResource); +} void FakeApi::setFakeApiFakeHealthResource(std::shared_ptr spFakeHealthResource) { m_spFakeHealthResource = spFakeHealthResource; m_service->publish(m_spFakeHealthResource); @@ -2144,6 +2269,9 @@ void FakeApi::setFakeApiFakeTest_query_parametersResource(std::shared_ptr()); + } if (!m_spFakeHealthResource) { setResource(std::make_shared()); } diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.h b/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.h index 9e18249ae29..9283bb7a9fa 100644 --- a/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.h +++ b/samples/server/petstore/cpp-restbed/generated/3_0/api/FakeApi.h @@ -33,6 +33,7 @@ #include "Client.h" #include "EnumClass.h" +#include "FakeBigDecimalMap_200_response.h" #include "FileSchemaTestClass.h" #include "HealthCheckResult.h" #include "OuterComposite.h" @@ -66,6 +67,68 @@ private: }; namespace FakeApiResources { +/// +/// +/// +/// +/// for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys +/// +class FakeBigDecimalMapResource: public restbed::Resource +{ +public: + FakeBigDecimalMapResource(const std::string& context = "/v2"); + virtual ~FakeBigDecimalMapResource() = default; + + FakeBigDecimalMapResource( + const FakeBigDecimalMapResource& other) = default; // copy constructor + FakeBigDecimalMapResource(FakeBigDecimalMapResource&& other) noexcept = default; // move constructor + + FakeBigDecimalMapResource& operator=(const FakeBigDecimalMapResource& other) = default; // copy assignment + FakeBigDecimalMapResource& operator=(FakeBigDecimalMapResource&& other) noexcept = default; // move assignment + + ///////////////////////////////////////////////////// + // Set these to implement the server functionality // + ///////////////////////////////////////////////////// + std::function( + )> handler_GET_func = + []() -> std::pair + { throw FakeApiException(501, "Not implemented"); }; + + +protected: + ////////////////////////////////////////////////////////// + // As an alternative to setting the `std::function`s // + // override these to implement the server functionality // + ////////////////////////////////////////////////////////// + + virtual std::pair handler_GET( + ); + + +protected: + ////////////////////////////////////// + // Override these for customization // + ////////////////////////////////////// + + virtual std::string extractBodyContent(const std::shared_ptr& session); + virtual std::string extractFormParamsFromBody(const std::string& paramName, const std::string& body); + + virtual std::pair handleFakeApiException(const FakeApiException& e); + virtual std::pair handleStdException(const std::exception& e); + virtual std::pair handleUnspecifiedException(); + + virtual void setResponseHeader(const std::shared_ptr& session, + const std::string& header); + + virtual void returnResponse(const std::shared_ptr& session, + const int status, const std::string& result, std::multimap& contentType); + virtual void defaultSessionClose(const std::shared_ptr& session, + const int status, const std::string& result); + +private: + void handler_GET_internal(const std::shared_ptr session); +}; + /// /// Health check endpoint /// @@ -960,6 +1023,7 @@ private: } /* namespace FakeApiResources */ +using FakeApiFakeBigDecimalMapResource [[deprecated]] = FakeApiResources::FakeBigDecimalMapResource; using FakeApiFakeHealthResource [[deprecated]] = FakeApiResources::FakeHealthResource; using FakeApiFakeHttp_signature_testResource [[deprecated]] = FakeApiResources::FakeHttp_signature_testResource; using FakeApiFakeOuterBooleanResource [[deprecated]] = FakeApiResources::FakeOuterBooleanResource; @@ -984,6 +1048,7 @@ public: explicit FakeApi(std::shared_ptr const& restbedService); virtual ~FakeApi(); + std::shared_ptr getFakeBigDecimalMapResource(); std::shared_ptr getFakeHealthResource(); std::shared_ptr getFakeHttp_signature_testResource(); std::shared_ptr getFakeOuterBooleanResource(); @@ -999,6 +1064,7 @@ public: std::shared_ptr getFakeJsonFormDataResource(); std::shared_ptr getFakeTest_query_parametersResource(); + void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); @@ -1014,6 +1080,8 @@ public: void setResource(std::shared_ptr resource); void setResource(std::shared_ptr resource); [[deprecated("use setResource()")]] + virtual void setFakeApiFakeBigDecimalMapResource(std::shared_ptr spFakeApiFakeBigDecimalMapResource); + [[deprecated("use setResource()")]] virtual void setFakeApiFakeHealthResource(std::shared_ptr spFakeApiFakeHealthResource); [[deprecated("use setResource()")]] virtual void setFakeApiFakeHttp_signature_testResource(std::shared_ptr spFakeApiFakeHttp_signature_testResource); @@ -1047,6 +1115,7 @@ public: virtual std::shared_ptr service(); protected: + std::shared_ptr m_spFakeBigDecimalMapResource; std::shared_ptr m_spFakeHealthResource; std::shared_ptr m_spFakeHttp_signature_testResource; std::shared_ptr m_spFakeOuterBooleanResource; diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/FakeBigDecimalMap_200_response.cpp b/samples/server/petstore/cpp-restbed/generated/3_0/model/FakeBigDecimalMap_200_response.cpp new file mode 100644 index 00000000000..f5fd807b87a --- /dev/null +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/FakeBigDecimalMap_200_response.cpp @@ -0,0 +1,125 @@ +/** + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.0.0-SNAPSHOT. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "FakeBigDecimalMap_200_response.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "helpers.h" + +using boost::property_tree::ptree; +using boost::property_tree::read_json; +using boost::property_tree::write_json; + +namespace org { +namespace openapitools { +namespace server { +namespace model { + +FakeBigDecimalMap_200_response::FakeBigDecimalMap_200_response(boost::property_tree::ptree const& pt) +{ + fromPropertyTree(pt); +} + + +std::string FakeBigDecimalMap_200_response::toJsonString(bool prettyJson /* = false */) const +{ + std::stringstream ss; + write_json(ss, this->toPropertyTree(), prettyJson); + // workaround inspired by: https://stackoverflow.com/a/56395440 + std::regex reg("\\\"([0-9]+\\.{0,1}[0-9]*)\\\""); + std::string result = std::regex_replace(ss.str(), reg, "$1"); + return result; +} + +void FakeBigDecimalMap_200_response::fromJsonString(std::string const& jsonString) +{ + std::stringstream ss(jsonString); + ptree pt; + read_json(ss,pt); + this->fromPropertyTree(pt); +} + +ptree FakeBigDecimalMap_200_response::toPropertyTree() const +{ + ptree pt; + ptree tmp_node; + pt.put("someId", m_SomeId); + // generate tree for SomeMap + if (!m_SomeMap.empty()) { + tmp_node = toPt(m_SomeMap); + pt.add_child("someMap", tmp_node); + } + tmp_node.clear(); + return pt; +} + +void FakeBigDecimalMap_200_response::fromPropertyTree(ptree const &pt) +{ + ptree tmp_node; + m_SomeId = pt.get("someId", 0.0); + if (pt.get_child_optional("someMap")) { + m_SomeMap = fromPt>(pt.get_child("someMap")); + } +} + +double FakeBigDecimalMap_200_response::getSomeId() const +{ + return m_SomeId; +} + +void FakeBigDecimalMap_200_response::setSomeId(double value) +{ + m_SomeId = value; +} + + +std::map FakeBigDecimalMap_200_response::getSomeMap() const +{ + return m_SomeMap; +} + +void FakeBigDecimalMap_200_response::setSomeMap(std::map value) +{ + m_SomeMap = value; +} + + + +std::vector createFakeBigDecimalMap_200_responseVectorFromJsonString(const std::string& json) +{ + std::stringstream sstream(json); + boost::property_tree::ptree pt; + boost::property_tree::json_parser::read_json(sstream,pt); + + auto vec = std::vector(); + for (const auto& child: pt) { + vec.emplace_back(FakeBigDecimalMap_200_response(child.second)); + } + + return vec; +} + +} +} +} +} + diff --git a/samples/server/petstore/cpp-restbed/generated/3_0/model/FakeBigDecimalMap_200_response.h b/samples/server/petstore/cpp-restbed/generated/3_0/model/FakeBigDecimalMap_200_response.h new file mode 100644 index 00000000000..442ef940a4f --- /dev/null +++ b/samples/server/petstore/cpp-restbed/generated/3_0/model/FakeBigDecimalMap_200_response.h @@ -0,0 +1,96 @@ +/** + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.0.0-SNAPSHOT. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * FakeBigDecimalMap_200_response.h + * + * + */ + +#ifndef FakeBigDecimalMap_200_response_H_ +#define FakeBigDecimalMap_200_response_H_ + + + +#include +#include +#include +#include +#include "helpers.h" + +namespace org { +namespace openapitools { +namespace server { +namespace model { + +/// +/// +/// +class FakeBigDecimalMap_200_response +{ +public: + FakeBigDecimalMap_200_response() = default; + explicit FakeBigDecimalMap_200_response(boost::property_tree::ptree const& pt); + virtual ~FakeBigDecimalMap_200_response() = default; + + FakeBigDecimalMap_200_response(const FakeBigDecimalMap_200_response& other) = default; // copy constructor + FakeBigDecimalMap_200_response(FakeBigDecimalMap_200_response&& other) noexcept = default; // move constructor + + FakeBigDecimalMap_200_response& operator=(const FakeBigDecimalMap_200_response& other) = default; // copy assignment + FakeBigDecimalMap_200_response& operator=(FakeBigDecimalMap_200_response&& other) noexcept = default; // move assignment + + std::string toJsonString(bool prettyJson = false) const; + void fromJsonString(std::string const& jsonString); + boost::property_tree::ptree toPropertyTree() const; + void fromPropertyTree(boost::property_tree::ptree const& pt); + + + ///////////////////////////////////////////// + /// FakeBigDecimalMap_200_response members + + /// + /// + /// + double getSomeId() const; + void setSomeId(double value); + + /// + /// + /// + std::map getSomeMap() const; + void setSomeMap(std::map value); + +protected: + double m_SomeId = 0.0; + std::map m_SomeMap; +}; + +std::vector createFakeBigDecimalMap_200_responseVectorFromJsonString(const std::string& json); + +template<> +inline boost::property_tree::ptree toPt(const FakeBigDecimalMap_200_response& val) { + return val.toPropertyTree(); +} + +template<> +inline FakeBigDecimalMap_200_response fromPt(const boost::property_tree::ptree& pt) { + FakeBigDecimalMap_200_response ret; + ret.fromPropertyTree(pt); + return ret; +} + +} +} +} +} + +#endif /* FakeBigDecimalMap_200_response_H_ */ diff --git a/samples/server/petstore/java-helidon-server/mp/.openapi-generator/FILES b/samples/server/petstore/java-helidon-server/mp/.openapi-generator/FILES index 9fdbc1aebe2..ea437760132 100644 --- a/samples/server/petstore/java-helidon-server/mp/.openapi-generator/FILES +++ b/samples/server/petstore/java-helidon-server/mp/.openapi-generator/FILES @@ -35,6 +35,7 @@ src/main/java/org/openapitools/server/model/DogAllOf.java src/main/java/org/openapitools/server/model/EnumArrays.java src/main/java/org/openapitools/server/model/EnumClass.java src/main/java/org/openapitools/server/model/EnumTest.java +src/main/java/org/openapitools/server/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/server/model/FileSchemaTestClass.java src/main/java/org/openapitools/server/model/Foo.java src/main/java/org/openapitools/server/model/FooGetDefaultResponse.java diff --git a/samples/server/petstore/java-helidon-server/mp/README.md b/samples/server/petstore/java-helidon-server/mp/README.md index 582fc1c98eb..8f4d37807e6 100644 --- a/samples/server/petstore/java-helidon-server/mp/README.md +++ b/samples/server/petstore/java-helidon-server/mp/README.md @@ -13,6 +13,7 @@ java -jar target/petstore-helidon-server-mp.jar ``` curl -X PATCH http://petstore.swagger.io:80/v2 curl -X GET http://petstore.swagger.io:80/v2 +curl -X GET http://petstore.swagger.io:80/v2/BigDecimalMap curl -X GET http://petstore.swagger.io:80/v2/health curl -X GET http://petstore.swagger.io:80/v2/http-signature-test curl -X POST http://petstore.swagger.io:80/v2/outer/boolean diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeService.java b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeService.java index 130451d090f..cd3e50db02b 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeService.java +++ b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeService.java @@ -15,6 +15,7 @@ package org.openapitools.server.api; import java.math.BigDecimal; import org.openapitools.server.model.Client; import org.openapitools.server.model.EnumClass; +import org.openapitools.server.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.server.model.FileSchemaTestClass; import org.openapitools.server.model.HealthCheckResult; @@ -38,6 +39,11 @@ import jakarta.validation.Valid; @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaHelidonServerCodegen") public interface FakeService { + @GET + @Path("/BigDecimalMap") + @Produces({ "*/*" }) + FakeBigDecimalMap200Response fakeBigDecimalMap(); + @GET @Path("/health") @Produces({ "application/json" }) diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeServiceImpl.java b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeServiceImpl.java index d0e402393b1..6830a2495a1 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/api/FakeServiceImpl.java @@ -15,6 +15,7 @@ package org.openapitools.server.api; import java.math.BigDecimal; import org.openapitools.server.model.Client; import org.openapitools.server.model.EnumClass; +import org.openapitools.server.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.server.model.FileSchemaTestClass; import org.openapitools.server.model.HealthCheckResult; @@ -39,6 +40,14 @@ import jakarta.validation.Valid; @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaHelidonServerCodegen") public class FakeServiceImpl implements FakeService { + @GET + @Path("/BigDecimalMap") + @Produces({ "*/*" }) + public FakeBigDecimalMap200Response fakeBigDecimalMap() { + FakeBigDecimalMap200Response result = null; // Replace with correct business logic. + return result; + } + @GET @Path("/health") @Produces({ "application/json" }) diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/FakeBigDecimalMap200Response.java b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..2b98d3cff5c --- /dev/null +++ b/samples/server/petstore/java-helidon-server/mp/src/main/java/org/openapitools/server/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,105 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; + + +public class FakeBigDecimalMap200Response { + + private BigDecimal someId; + + private Map someMap = null; + + /** + * Get someId + * @return someId + **/ + public BigDecimal getSomeId() { + return someId; + } + + /** + * Set someId + **/ + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + /** + * Get someMap + * @return someMap + **/ + public Map getSomeMap() { + return someMap; + } + + /** + * Set someMap + **/ + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + this.someMap.put(key, someMapItem); + return this; + } + + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml index 5c0bc517dac..d69d4ab7749 100644 --- a/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/mp/src/main/resources/META-INF/openapi.yml @@ -978,6 +978,21 @@ paths: - fake x-content-type: application/json x-accepts: '*/*' + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake + x-accepts: '*/*' /fake/jsonFormData: get: description: "" @@ -2107,6 +2122,19 @@ components: - number - pattern_without_delimiter type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object testJsonFormData_request: properties: param: diff --git a/samples/server/petstore/java-helidon-server/mp/src/test/java/org/openapitools/server/model/FakeBigDecimalMap200ResponseTest.java b/samples/server/petstore/java-helidon-server/mp/src/test/java/org/openapitools/server/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..c38a4e5469f --- /dev/null +++ b/samples/server/petstore/java-helidon-server/mp/src/test/java/org/openapitools/server/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +public class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + public void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + public void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + public void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/server/petstore/java-helidon-server/se/.openapi-generator/FILES b/samples/server/petstore/java-helidon-server/se/.openapi-generator/FILES index 93bbc6b3b01..f8d0d60daa4 100644 --- a/samples/server/petstore/java-helidon-server/se/.openapi-generator/FILES +++ b/samples/server/petstore/java-helidon-server/se/.openapi-generator/FILES @@ -36,6 +36,7 @@ src/main/java/org/openapitools/server/model/DogAllOf.java src/main/java/org/openapitools/server/model/EnumArrays.java src/main/java/org/openapitools/server/model/EnumClass.java src/main/java/org/openapitools/server/model/EnumTest.java +src/main/java/org/openapitools/server/model/FakeBigDecimalMap200Response.java src/main/java/org/openapitools/server/model/FileSchemaTestClass.java src/main/java/org/openapitools/server/model/Foo.java src/main/java/org/openapitools/server/model/FooGetDefaultResponse.java diff --git a/samples/server/petstore/java-helidon-server/se/README.md b/samples/server/petstore/java-helidon-server/se/README.md index ed9e99d3ae5..6bf2ea9caa7 100644 --- a/samples/server/petstore/java-helidon-server/se/README.md +++ b/samples/server/petstore/java-helidon-server/se/README.md @@ -13,6 +13,7 @@ java -jar target/petstore-helidon-server-se.jar ``` curl -X PATCH http://petstore.swagger.io:80/v2/another-fake/dummy curl -X GET http://petstore.swagger.io:80/v2/foo +curl -X GET http://petstore.swagger.io:80/v2/fake/BigDecimalMap curl -X GET http://petstore.swagger.io:80/v2/fake/health curl -X GET http://petstore.swagger.io:80/v2/fake/http-signature-test curl -X POST http://petstore.swagger.io:80/v2/fake/outer/boolean diff --git a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeService.java b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeService.java index 3ab5d379653..5a11f23fb4e 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeService.java +++ b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeService.java @@ -3,6 +3,7 @@ package org.openapitools.server.api; import java.math.BigDecimal; import org.openapitools.server.model.Client; import org.openapitools.server.model.EnumClass; +import org.openapitools.server.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.server.model.FileSchemaTestClass; import io.helidon.webserver.Handler; @@ -29,6 +30,7 @@ public interface FakeService extends Service { */ @Override default void update(Routing.Rules rules) { + rules.get("/fake/BigDecimalMap", this::fakeBigDecimalMap); rules.get("/fake/health", this::fakeHealthGet); rules.get("/fake/http-signature-test", Handler.create(Pet.class, this::fakeHttpSignatureTest)); rules.post("/fake/outer/boolean", this::fakeOuterBooleanSerialize); @@ -49,6 +51,13 @@ public interface FakeService extends Service { } + /** + * GET /fake/BigDecimalMap. + * @param request the server request + * @param response the server response + */ + void fakeBigDecimalMap(ServerRequest request, ServerResponse response); + /** * GET /fake/health : Health check endpoint. * @param request the server request diff --git a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeServiceImpl.java b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeServiceImpl.java index 8dbc1c125ae..1bdbaaa2cd8 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeServiceImpl.java +++ b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/api/FakeServiceImpl.java @@ -3,6 +3,7 @@ package org.openapitools.server.api; import java.math.BigDecimal; import org.openapitools.server.model.Client; import org.openapitools.server.model.EnumClass; +import org.openapitools.server.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.server.model.FileSchemaTestClass; import io.helidon.webserver.Handler; @@ -27,6 +28,10 @@ public class FakeServiceImpl implements FakeService { private static final ObjectMapper MAPPER = JsonProvider.objectMapper(); + public void fakeBigDecimalMap(ServerRequest request, ServerResponse response) { + response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); + } + public void fakeHealthGet(ServerRequest request, ServerResponse response) { response.status(HTTP_CODE_NOT_IMPLEMENTED).send(); } diff --git a/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/FakeBigDecimalMap200Response.java b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..3236f816753 --- /dev/null +++ b/samples/server/petstore/java-helidon-server/se/src/main/java/org/openapitools/server/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,87 @@ +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; + + + +public class FakeBigDecimalMap200Response { + + private BigDecimal someId; + private Map someMap = new HashMap<>(); + + /** + * Default constructor. + */ + public FakeBigDecimalMap200Response() { + // JSON-B / Jackson + } + + /** + * Create FakeBigDecimalMap200Response. + * + * @param someId someId + * @param someMap someMap + */ + public FakeBigDecimalMap200Response( + BigDecimal someId, + Map someMap + ) { + this.someId = someId; + this.someMap = someMap; + } + + + + /** + * Get someId + * @return someId + */ + public BigDecimal getSomeId() { + return someId; + } + + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + /** + * Get someMap + * @return someMap + */ + public Map getSomeMap() { + return someMap; + } + + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + /** + * Create a string representation of this pojo. + **/ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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 static String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml b/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml index 5c0bc517dac..d69d4ab7749 100644 --- a/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml +++ b/samples/server/petstore/java-helidon-server/se/src/main/resources/META-INF/openapi.yml @@ -978,6 +978,21 @@ paths: - fake x-content-type: application/json x-accepts: '*/*' + /fake/BigDecimalMap: + get: + description: "for Java apache and Java native, test toUrlQueryString for maps\ + \ with BegDecimal keys" + operationId: fakeBigDecimalMap + responses: + "200": + content: + '*/*': + schema: + $ref: '#/components/schemas/fakeBigDecimalMap_200_response' + description: successful operation + tags: + - fake + x-accepts: '*/*' /fake/jsonFormData: get: description: "" @@ -2107,6 +2122,19 @@ components: - number - pattern_without_delimiter type: object + fakeBigDecimalMap_200_response: + example: + someId: 0.8008281904610115 + someMap: + key: 6.027456183070403 + properties: + someId: + type: number + someMap: + additionalProperties: + type: number + type: object + type: object testJsonFormData_request: properties: param: diff --git a/samples/server/petstore/java-helidon-server/se/src/test/java/org/openapitools/server/model/FakeBigDecimalMap200ResponseTest.java b/samples/server/petstore/java-helidon-server/se/src/test/java/org/openapitools/server/model/FakeBigDecimalMap200ResponseTest.java new file mode 100644 index 00000000000..c38a4e5469f --- /dev/null +++ b/samples/server/petstore/java-helidon-server/se/src/test/java/org/openapitools/server/model/FakeBigDecimalMap200ResponseTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package org.openapitools.server.model; + +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Test; + +/** + * Model tests for FakeBigDecimalMap200Response + */ +public class FakeBigDecimalMap200ResponseTest { + private final FakeBigDecimalMap200Response model = new FakeBigDecimalMap200Response(); + + /** + * Model tests for FakeBigDecimalMap200Response + */ + @Test + public void testFakeBigDecimalMap200Response() { + // TODO: test FakeBigDecimalMap200Response + } + + /** + * Test the property 'someId' + */ + @Test + public void someIdTest() { + // TODO: test someId + } + + /** + * Test the property 'someMap' + */ + @Test + public void someMapTest() { + // TODO: test someMap + } + +} diff --git a/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES b/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES index 463e9366b2c..8992d0d741c 100644 --- a/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES +++ b/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES @@ -39,6 +39,7 @@ src/gen/java/org/openapitools/model/DogAllOf.java src/gen/java/org/openapitools/model/EnumArrays.java src/gen/java/org/openapitools/model/EnumClass.java src/gen/java/org/openapitools/model/EnumTest.java +src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java src/gen/java/org/openapitools/model/FileSchemaTestClass.java src/gen/java/org/openapitools/model/Foo.java src/gen/java/org/openapitools/model/FooGetDefaultResponse.java diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java index 1d592483933..b65155e0d45 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java @@ -10,6 +10,7 @@ import java.math.BigDecimal; import org.openapitools.model.Client; import java.util.Date; import org.openapitools.model.EnumClass; +import org.openapitools.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.model.FileSchemaTestClass; import org.openapitools.model.HealthCheckResult; @@ -66,6 +67,18 @@ public class FakeApi { this.delegate = delegate; } + @javax.ws.rs.GET + @Path("/BigDecimalMap") + + @Produces({ "*/*" }) + @io.swagger.annotations.ApiOperation(value = "", notes = "for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys", response = FakeBigDecimalMap200Response.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = FakeBigDecimalMap200Response.class) + }) + public Response fakeBigDecimalMap(@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeBigDecimalMap(securityContext); + } @javax.ws.rs.GET @Path("/health") diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java index 46be025f281..8fbf2434e37 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java @@ -8,6 +8,7 @@ import java.math.BigDecimal; import org.openapitools.model.Client; import java.util.Date; import org.openapitools.model.EnumClass; +import org.openapitools.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.model.FileSchemaTestClass; import org.openapitools.model.HealthCheckResult; @@ -28,6 +29,7 @@ import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") public abstract class FakeApiService { + public abstract Response fakeBigDecimalMap(SecurityContext securityContext) throws NotFoundException; public abstract Response fakeHealthGet(SecurityContext securityContext) throws NotFoundException; public abstract Response fakeHttpSignatureTest(Pet pet,String query1,String header1,SecurityContext securityContext) throws NotFoundException; public abstract Response fakeOuterBooleanSerialize(Boolean body,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java new file mode 100644 index 00000000000..1f2fd614de4 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/FakeBigDecimalMap200Response.java @@ -0,0 +1,135 @@ +/* + * OpenAPI 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * FakeBigDecimalMap200Response + */ +@JsonPropertyOrder({ + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_ID, + FakeBigDecimalMap200Response.JSON_PROPERTY_SOME_MAP +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") +public class FakeBigDecimalMap200Response { + public static final String JSON_PROPERTY_SOME_ID = "someId"; + @JsonProperty(JSON_PROPERTY_SOME_ID) + private BigDecimal someId; + + public static final String JSON_PROPERTY_SOME_MAP = "someMap"; + @JsonProperty(JSON_PROPERTY_SOME_MAP) + private Map someMap = new HashMap<>(); + + public FakeBigDecimalMap200Response someId(BigDecimal someId) { + this.someId = someId; + return this; + } + + /** + * Get someId + * @return someId + **/ + @JsonProperty(value = "someId") + @ApiModelProperty(value = "") + @Valid + public BigDecimal getSomeId() { + return someId; + } + + public void setSomeId(BigDecimal someId) { + this.someId = someId; + } + + public FakeBigDecimalMap200Response someMap(Map someMap) { + this.someMap = someMap; + return this; + } + + public FakeBigDecimalMap200Response putSomeMapItem(String key, BigDecimal someMapItem) { + if (this.someMap == null) { + this.someMap = new HashMap<>(); + } + this.someMap.put(key, someMapItem); + return this; + } + + /** + * Get someMap + * @return someMap + **/ + @JsonProperty(value = "someMap") + @ApiModelProperty(value = "") + @Valid + public Map getSomeMap() { + return someMap; + } + + public void setSomeMap(Map someMap) { + this.someMap = someMap; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FakeBigDecimalMap200Response fakeBigDecimalMap200Response = (FakeBigDecimalMap200Response) o; + return Objects.equals(this.someId, fakeBigDecimalMap200Response.someId) && + Objects.equals(this.someMap, fakeBigDecimalMap200Response.someMap); + } + + @Override + public int hashCode() { + return Objects.hash(someId, someMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FakeBigDecimalMap200Response {\n"); + + sb.append(" someId: ").append(toIndentedString(someId)).append("\n"); + sb.append(" someMap: ").append(toIndentedString(someMap)).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/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java index 543ff24f31e..1f513684a47 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java @@ -5,6 +5,7 @@ import java.math.BigDecimal; import org.openapitools.model.Client; import java.util.Date; import org.openapitools.model.EnumClass; +import org.openapitools.model.FakeBigDecimalMap200Response; import java.io.File; import org.openapitools.model.FileSchemaTestClass; import org.openapitools.model.HealthCheckResult; @@ -27,6 +28,11 @@ import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen") public class FakeApiServiceImpl extends FakeApiService { + @Override + public Response fakeBigDecimalMap(SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } @Override public Response fakeHealthGet(SecurityContext securityContext) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/php-laravel/.openapi-generator/FILES b/samples/server/petstore/php-laravel/.openapi-generator/FILES index eb2e7313fb4..61235a753bc 100644 --- a/samples/server/petstore/php-laravel/.openapi-generator/FILES +++ b/samples/server/petstore/php-laravel/.openapi-generator/FILES @@ -41,6 +41,7 @@ lib/app/Models/DogAllOf.php lib/app/Models/EnumArrays.php lib/app/Models/EnumClass.php lib/app/Models/EnumTest.php +lib/app/Models/FakeBigDecimalMap200Response.php lib/app/Models/File.php lib/app/Models/FileSchemaTestClass.php lib/app/Models/Foo.php diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php index ed45b3a38e1..2aadf9fe902 100644 --- a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php +++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php @@ -230,6 +230,25 @@ class FakeController extends Controller return response('How about implementing testGroupParameters as a delete method ?'); } + /** + * Operation fakeBigDecimalMap + * + * . + * + * + * @return Http response + */ + public function fakeBigDecimalMap() + { + $input = Request::all(); + + //path params validation + + + //not path params validation + + return response('How about implementing fakeBigDecimalMap as a get method ?'); + } /** * Operation testBodyWithBinary * diff --git a/samples/server/petstore/php-laravel/lib/app/Models/FakeBigDecimalMap200Response.php b/samples/server/petstore/php-laravel/lib/app/Models/FakeBigDecimalMap200Response.php new file mode 100644 index 00000000000..e682c40312a --- /dev/null +++ b/samples/server/petstore/php-laravel/lib/app/Models/FakeBigDecimalMap200Response.php @@ -0,0 +1,18 @@ + $someMap */ + public $someMap; + +} diff --git a/samples/server/petstore/php-laravel/lib/routes/api.php b/samples/server/petstore/php-laravel/lib/routes/api.php index ca0e27d2241..824c9c3773e 100644 --- a/samples/server/petstore/php-laravel/lib/routes/api.php +++ b/samples/server/petstore/php-laravel/lib/routes/api.php @@ -63,6 +63,13 @@ Route::get('/v2/fake', 'FakeController@testEnumParameters'); */ Route::delete('/v2/fake', 'FakeController@testGroupParameters'); +/** + * get fakeBigDecimalMap + * Summary: + * Notes: for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + * Output-Formats: [*_/_*] + */ +Route::get('/v2/fake/BigDecimalMap', 'FakeController@fakeBigDecimalMap'); /** * put testBodyWithBinary * Summary: diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php index 875d25c866c..5029bca241b 100644 --- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php +++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php @@ -226,6 +226,25 @@ class FakeApi extends Controller return response('How about implementing testGroupParameters as a delete method ?'); } + /** + * Operation fakeBigDecimalMap + * + * . + * + * + * @return Http response + */ + public function fakeBigDecimalMap() + { + $input = Request::all(); + + //path params validation + + + //not path params validation + + return response('How about implementing fakeBigDecimalMap as a get method ?'); + } /** * Operation testBodyWithBinary * diff --git a/samples/server/petstore/php-lumen/lib/routes/web.php b/samples/server/petstore/php-lumen/lib/routes/web.php index 8e987b51659..7b0e7067dd2 100644 --- a/samples/server/petstore/php-lumen/lib/routes/web.php +++ b/samples/server/petstore/php-lumen/lib/routes/web.php @@ -79,6 +79,13 @@ $router->get('/v2/fake', 'FakeApi@testEnumParameters'); */ $router->delete('/v2/fake', 'FakeApi@testGroupParameters'); +/** + * get fakeBigDecimalMap + * Summary: + * Notes: for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys + */ +$router->get('/v2/fake/BigDecimalMap', 'FakeApi@fakeBigDecimalMap'); + /** * put testBodyWithBinary * Summary: