[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:
William Cheng
2022-05-13 10:17:59 +08:00
committed by GitHub
parent 2cf3d3805f
commit 12cdacabbf
284 changed files with 7620 additions and 1220 deletions

View File

@@ -8,7 +8,7 @@ import org.openapitools.client.Pair;
import javax.ws.rs.core.GenericType;
import org.openapitools.client.model.InlineResponseDefault;
import org.openapitools.client.model.FooGetDefaultResponse;
import java.util.ArrayList;
import java.util.HashMap;
@@ -48,7 +48,7 @@ public class DefaultApi {
/**
*
*
* @return InlineResponseDefault
* @return FooGetDefaultResponse
* @throws ApiException if fails to make API call
* @http.response.details
<table summary="Response Details" border="1">
@@ -56,14 +56,14 @@ public class DefaultApi {
<tr><td> 0 </td><td> response </td><td> - </td></tr>
</table>
*/
public InlineResponseDefault fooGet() throws ApiException {
public FooGetDefaultResponse fooGet() throws ApiException {
return fooGetWithHttpInfo().getData();
}
/**
*
*
* @return ApiResponse&lt;InlineResponseDefault&gt;
* @return ApiResponse&lt;FooGetDefaultResponse&gt;
* @throws ApiException if fails to make API call
* @http.response.details
<table summary="Response Details" border="1">
@@ -71,7 +71,7 @@ public class DefaultApi {
<tr><td> 0 </td><td> response </td><td> - </td></tr>
</table>
*/
public ApiResponse<InlineResponseDefault> fooGetWithHttpInfo() throws ApiException {
public ApiResponse<FooGetDefaultResponse> fooGetWithHttpInfo() throws ApiException {
Object localVarPostBody = null;
// create path and map variables
@@ -99,7 +99,7 @@ public class DefaultApi {
String[] localVarAuthNames = new String[] { };
GenericType<InlineResponseDefault> localVarReturnType = new GenericType<InlineResponseDefault>() {};
GenericType<FooGetDefaultResponse> localVarReturnType = new GenericType<FooGetDefaultResponse>() {};
return apiClient.invokeAPI("DefaultApi.fooGet", localVarPath, "GET", localVarQueryParams, localVarPostBody,
localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType,

View File

@@ -0,0 +1,114 @@
/*
* 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 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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.client.model.Foo;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.openapitools.client.JSON;
/**
* 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;
}
/**
* Return true if this _foo_get_default_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;
}
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 ");
}
}

View File

@@ -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.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.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
}
}