mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 22:36:12 +00:00
[JAVA] fix toUrlQueryString for BigDecimal (#15764)
* add MyImportTest.java * fix original issue * fix same issue for native library * remove MyImportTest * add test configs * generate samples (again?) * generate samples again * generate samples again, undo pom.xml mistake [amended to retrigger circliCi]
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
# FakeBigDecimalMap200Response
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**someId** | **BigDecimal** | | [optional] |
|
||||
|**someMap** | **Map<String, BigDecimal>** | | [optional] |
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
* <p><b>200</b> - 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<String, Object> pathParams = new HashMap<String, Object>();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] localVarAccepts = {
|
||||
"*/*"
|
||||
};
|
||||
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||
final String[] localVarContentTypes = { };
|
||||
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<FakeBigDecimalMap200Response> localVarReturnType = new ParameterizedTypeReference<FakeBigDecimalMap200Response>() {};
|
||||
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
|
||||
* <p><b>200</b> - successful operation
|
||||
* @return FakeBigDecimalMap200Response
|
||||
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Mono<FakeBigDecimalMap200Response> fakeBigDecimalMap() throws WebClientResponseException {
|
||||
ParameterizedTypeReference<FakeBigDecimalMap200Response> localVarReturnType = new ParameterizedTypeReference<FakeBigDecimalMap200Response>() {};
|
||||
return fakeBigDecimalMapRequestCreation().bodyToMono(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys
|
||||
* <p><b>200</b> - successful operation
|
||||
* @return ResponseEntity<FakeBigDecimalMap200Response>
|
||||
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Mono<ResponseEntity<FakeBigDecimalMap200Response>> fakeBigDecimalMapWithHttpInfo() throws WebClientResponseException {
|
||||
ParameterizedTypeReference<FakeBigDecimalMap200Response> localVarReturnType = new ParameterizedTypeReference<FakeBigDecimalMap200Response>() {};
|
||||
return fakeBigDecimalMapRequestCreation().toEntity(localVarReturnType);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* for Java apache and Java native, test toUrlQueryString for maps with BegDecimal keys
|
||||
* <p><b>200</b> - 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
|
||||
*
|
||||
|
||||
@@ -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<String, BigDecimal> 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<String, BigDecimal> 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<String, BigDecimal> getSomeMap() {
|
||||
return someMap;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_SOME_MAP)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setSomeMap(Map<String, BigDecimal> 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 ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user