mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 06:27:08 +00:00
use map/array model class only if it is generated (#17612)
* fix * tests * generate samples * refactor
This commit is contained in:
@@ -2020,4 +2020,87 @@ public class FakeApi {
|
||||
}
|
||||
return localVarRequestBuilder;
|
||||
}
|
||||
/**
|
||||
* test referenced string map
|
||||
*
|
||||
* @param requestBody request body (required)
|
||||
* @return CompletableFuture<Void>
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public CompletableFuture<Void> testStringMapReference(Map<String, String> requestBody) throws ApiException {
|
||||
try {
|
||||
HttpRequest.Builder localVarRequestBuilder = testStringMapReferenceRequestBuilder(requestBody);
|
||||
return memberVarHttpClient.sendAsync(
|
||||
localVarRequestBuilder.build(),
|
||||
HttpResponse.BodyHandlers.ofString()).thenComposeAsync(localVarResponse -> {
|
||||
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||
return CompletableFuture.failedFuture(getApiException("testStringMapReference", localVarResponse));
|
||||
}
|
||||
return CompletableFuture.completedFuture(null);
|
||||
});
|
||||
}
|
||||
catch (ApiException e) {
|
||||
return CompletableFuture.failedFuture(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* test referenced string map
|
||||
*
|
||||
* @param requestBody request body (required)
|
||||
* @return CompletableFuture<ApiResponse<Void>>
|
||||
* @throws ApiException if fails to make API call
|
||||
*/
|
||||
public CompletableFuture<ApiResponse<Void>> testStringMapReferenceWithHttpInfo(Map<String, String> requestBody) throws ApiException {
|
||||
try {
|
||||
HttpRequest.Builder localVarRequestBuilder = testStringMapReferenceRequestBuilder(requestBody);
|
||||
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("testStringMapReference", localVarResponse));
|
||||
}
|
||||
return CompletableFuture.completedFuture(
|
||||
new ApiResponse<Void>(localVarResponse.statusCode(), localVarResponse.headers().map(), null)
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (ApiException e) {
|
||||
return CompletableFuture.failedFuture(e);
|
||||
}
|
||||
}
|
||||
|
||||
private HttpRequest.Builder testStringMapReferenceRequestBuilder(Map<String, String> requestBody) throws ApiException {
|
||||
// verify the required parameter 'requestBody' is set
|
||||
if (requestBody == null) {
|
||||
throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testStringMapReference");
|
||||
}
|
||||
|
||||
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||
|
||||
String localVarPath = "/fake/stringMap-reference";
|
||||
|
||||
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||
|
||||
localVarRequestBuilder.header("Content-Type", "application/json");
|
||||
localVarRequestBuilder.header("Accept", "application/json");
|
||||
|
||||
try {
|
||||
byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(requestBody);
|
||||
localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody));
|
||||
} catch (IOException e) {
|
||||
throw new ApiException(e);
|
||||
}
|
||||
if (memberVarReadTimeout != null) {
|
||||
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||
}
|
||||
if (memberVarInterceptor != null) {
|
||||
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||
}
|
||||
return localVarRequestBuilder;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user