forked from loafle/openapi-generator-original
[Inline model resolver] better handling of inline responses and bug fixes (#12353)
* better handling of inline response schemas, bug fixes * update samples * add new files * better code format * remove unused ruby files * fix java test * remove unused js spec files * remove inline_response_default_test.dart * fix webclient tests * fix spring tests
This commit is contained in:
@@ -2,7 +2,7 @@ package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
|
||||
import org.openapitools.client.model.InlineResponseDefault;
|
||||
import org.openapitools.client.model.FooGetDefaultResponse;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -50,7 +50,7 @@ public class DefaultApi {
|
||||
*
|
||||
*
|
||||
* <p><b>0</b> - response
|
||||
* @return InlineResponseDefault
|
||||
* @return FooGetDefaultResponse
|
||||
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
private ResponseSpec fooGetRequestCreation() throws WebClientResponseException {
|
||||
@@ -72,7 +72,7 @@ public class DefaultApi {
|
||||
|
||||
String[] localVarAuthNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<InlineResponseDefault> localVarReturnType = new ParameterizedTypeReference<InlineResponseDefault>() {};
|
||||
ParameterizedTypeReference<FooGetDefaultResponse> localVarReturnType = new ParameterizedTypeReference<FooGetDefaultResponse>() {};
|
||||
return apiClient.invokeAPI("/foo", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
|
||||
}
|
||||
|
||||
@@ -80,16 +80,16 @@ public class DefaultApi {
|
||||
*
|
||||
*
|
||||
* <p><b>0</b> - response
|
||||
* @return InlineResponseDefault
|
||||
* @return FooGetDefaultResponse
|
||||
* @throws WebClientResponseException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Mono<InlineResponseDefault> fooGet() throws WebClientResponseException {
|
||||
ParameterizedTypeReference<InlineResponseDefault> localVarReturnType = new ParameterizedTypeReference<InlineResponseDefault>() {};
|
||||
public Mono<FooGetDefaultResponse> fooGet() throws WebClientResponseException {
|
||||
ParameterizedTypeReference<FooGetDefaultResponse> localVarReturnType = new ParameterizedTypeReference<FooGetDefaultResponse>() {};
|
||||
return fooGetRequestCreation().bodyToMono(localVarReturnType);
|
||||
}
|
||||
|
||||
public Mono<ResponseEntity<InlineResponseDefault>> fooGetWithHttpInfo() throws WebClientResponseException {
|
||||
ParameterizedTypeReference<InlineResponseDefault> localVarReturnType = new ParameterizedTypeReference<InlineResponseDefault>() {};
|
||||
public Mono<ResponseEntity<FooGetDefaultResponse>> fooGetWithHttpInfo() throws WebClientResponseException {
|
||||
ParameterizedTypeReference<FooGetDefaultResponse> localVarReturnType = new ParameterizedTypeReference<FooGetDefaultResponse>() {};
|
||||
return fooGetRequestCreation().toEntity(localVarReturnType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.openapitools.client.model.Foo;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
|
||||
/**
|
||||
* FooGetDefaultResponse
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
FooGetDefaultResponse.JSON_PROPERTY_STRING
|
||||
})
|
||||
@JsonTypeName("_foo_get_default_response")
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class FooGetDefaultResponse {
|
||||
public static final String JSON_PROPERTY_STRING = "string";
|
||||
private Foo string;
|
||||
|
||||
public FooGetDefaultResponse() {
|
||||
}
|
||||
|
||||
public FooGetDefaultResponse string(Foo string) {
|
||||
|
||||
this.string = string;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get string
|
||||
* @return string
|
||||
**/
|
||||
@javax.annotation.Nullable
|
||||
@ApiModelProperty(value = "")
|
||||
@JsonProperty(JSON_PROPERTY_STRING)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
|
||||
public Foo getString() {
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
@JsonProperty(JSON_PROPERTY_STRING)
|
||||
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||
public void setString(Foo string) {
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
FooGetDefaultResponse fooGetDefaultResponse = (FooGetDefaultResponse) o;
|
||||
return Objects.equals(this.string, fooGetDefaultResponse.string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class FooGetDefaultResponse {\n");
|
||||
sb.append(" string: ").append(toIndentedString(string)).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 ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.model.InlineResponseDefault;
|
||||
import org.openapitools.client.model.FooGetDefaultResponse;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class DefaultApiTest {
|
||||
*/
|
||||
@Test
|
||||
public void fooGetTest() {
|
||||
InlineResponseDefault response = api.fooGet().block();
|
||||
FooGetDefaultResponse response = api.fooGet().block();
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
@@ -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.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.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.openapitools.client.model.Foo;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for FooGetDefaultResponse
|
||||
*/
|
||||
public class FooGetDefaultResponseTest {
|
||||
private final FooGetDefaultResponse model = new FooGetDefaultResponse();
|
||||
|
||||
/**
|
||||
* Model tests for FooGetDefaultResponse
|
||||
*/
|
||||
@Test
|
||||
public void testFooGetDefaultResponse() {
|
||||
// TODO: test FooGetDefaultResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'string'
|
||||
*/
|
||||
@Test
|
||||
public void stringTest() {
|
||||
// TODO: test string
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user