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:
@@ -39,6 +39,7 @@ docs/FakeApi.md
|
||||
docs/FakeClassnameTags123Api.md
|
||||
docs/FileSchemaTestClass.md
|
||||
docs/Foo.md
|
||||
docs/FooGetDefaultResponse.md
|
||||
docs/FormatTest.md
|
||||
docs/Fruit.md
|
||||
docs/FruitReq.md
|
||||
@@ -46,7 +47,6 @@ docs/GmFruit.md
|
||||
docs/GrandparentAnimal.md
|
||||
docs/HasOnlyReadOnly.md
|
||||
docs/HealthCheckResult.md
|
||||
docs/InlineResponseDefault.md
|
||||
docs/IsoscelesTriangle.md
|
||||
docs/Mammal.md
|
||||
docs/MapTest.md
|
||||
@@ -153,6 +153,7 @@ 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/FileSchemaTestClass.java
|
||||
src/main/java/org/openapitools/client/model/Foo.java
|
||||
src/main/java/org/openapitools/client/model/FooGetDefaultResponse.java
|
||||
src/main/java/org/openapitools/client/model/FormatTest.java
|
||||
src/main/java/org/openapitools/client/model/Fruit.java
|
||||
src/main/java/org/openapitools/client/model/FruitReq.java
|
||||
@@ -160,7 +161,6 @@ src/main/java/org/openapitools/client/model/GmFruit.java
|
||||
src/main/java/org/openapitools/client/model/GrandparentAnimal.java
|
||||
src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java
|
||||
src/main/java/org/openapitools/client/model/HealthCheckResult.java
|
||||
src/main/java/org/openapitools/client/model/InlineResponseDefault.java
|
||||
src/main/java/org/openapitools/client/model/IsoscelesTriangle.java
|
||||
src/main/java/org/openapitools/client/model/Mammal.java
|
||||
src/main/java/org/openapitools/client/model/MapTest.java
|
||||
|
||||
@@ -211,6 +211,7 @@ Class | Method | HTTP request | Description
|
||||
- [EquilateralTriangle](docs/EquilateralTriangle.md)
|
||||
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
||||
- [Foo](docs/Foo.md)
|
||||
- [FooGetDefaultResponse](docs/FooGetDefaultResponse.md)
|
||||
- [FormatTest](docs/FormatTest.md)
|
||||
- [Fruit](docs/Fruit.md)
|
||||
- [FruitReq](docs/FruitReq.md)
|
||||
@@ -218,7 +219,6 @@ Class | Method | HTTP request | Description
|
||||
- [GrandparentAnimal](docs/GrandparentAnimal.md)
|
||||
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||
- [HealthCheckResult](docs/HealthCheckResult.md)
|
||||
- [InlineResponseDefault](docs/InlineResponseDefault.md)
|
||||
- [IsoscelesTriangle](docs/IsoscelesTriangle.md)
|
||||
- [Mammal](docs/Mammal.md)
|
||||
- [MapTest](docs/MapTest.md)
|
||||
|
||||
@@ -48,7 +48,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/inline_response_default'
|
||||
$ref: '#/components/schemas/_foo_get_default_response'
|
||||
description: response
|
||||
x-accepts: application/json
|
||||
/pet:
|
||||
@@ -2136,7 +2136,7 @@ components:
|
||||
$ref: '#/components/schemas/Bar'
|
||||
type: array
|
||||
type: object
|
||||
inline_response_default:
|
||||
_foo_get_default_response:
|
||||
example:
|
||||
string:
|
||||
bar: bar
|
||||
|
||||
@@ -10,7 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
## fooGet
|
||||
|
||||
> InlineResponseDefault fooGet()
|
||||
> FooGetDefaultResponse fooGet()
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Example {
|
||||
|
||||
DefaultApi apiInstance = new DefaultApi(defaultClient);
|
||||
try {
|
||||
InlineResponseDefault result = apiInstance.fooGet();
|
||||
FooGetDefaultResponse result = apiInstance.fooGet();
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling DefaultApi#fooGet");
|
||||
@@ -50,7 +50,7 @@ This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**InlineResponseDefault**](InlineResponseDefault.md)
|
||||
[**FooGetDefaultResponse**](FooGetDefaultResponse.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
|
||||
# FooGetDefaultResponse
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------ | ------------- | ------------- | -------------|
|
||||
|**string** | [**Foo**](Foo.md) | | [optional] |
|
||||
|
||||
|
||||
|
||||
@@ -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<InlineResponseDefault>
|
||||
* @return ApiResponse<FooGetDefaultResponse>
|
||||
* @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,
|
||||
|
||||
@@ -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 ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user