fix #17258 - use model class only if it is generated (#17490)

* fix  #16797 and #15796 spring child constructor missing parent params

* root cause and update the DefaultCodegen.java to add missing property when with multi inheritance

* rollback SpringCodegen.java

* update samples

* rollback with master cause #16992 fixed this issue too

* still using orignal design

* catchup master

* catchup master

* catchup master

* fix

* add tests

---------

Co-authored-by: dabdirb <dabdirb@gmail.com>
This commit is contained in:
martin-mfg
2024-01-05 03:30:28 +01:00
committed by GitHub
parent 6317796cba
commit 64f2cad9e8
228 changed files with 10788 additions and 14 deletions

View File

@@ -146,6 +146,7 @@ Class | Method | HTTP request | Description
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
*FakeApi* | [**getArrayOfEnums**](docs/FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums
*FakeApi* | [**testAdditionalPropertiesReference**](docs/FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties
*FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model

View File

@@ -937,6 +937,25 @@ paths:
- fake
x-content-type: application/x-www-form-urlencoded
x-accepts: application/json
/fake/additionalProperties-reference:
post:
description: ""
operationId: testAdditionalPropertiesReference
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/FreeFormObject'
description: request body
required: true
responses:
"200":
description: successful operation
summary: test referenced additionalProperties
tags:
- fake
x-content-type: application/json
x-accepts: application/json
/fake/inline-additionalProperties:
post:
description: ""
@@ -1760,6 +1779,10 @@ components:
type: string
type: array
type: object
FreeFormObject:
additionalProperties: true
description: A schema consisting only of additional properties
type: object
OuterEnum:
enum:
- placed

View File

@@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
| [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | |
| [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | |
| [**getArrayOfEnums**](FakeApi.md#getArrayOfEnums) | **GET** /fake/array-of-enums | Array of Enums |
| [**testAdditionalPropertiesReference**](FakeApi.md#testAdditionalPropertiesReference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties |
| [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | |
| [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | |
| [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model |
@@ -402,6 +403,70 @@ No authorization required
| **200** | Got named array of enums | - |
## testAdditionalPropertiesReference
> testAdditionalPropertiesReference(requestBody)
test referenced additionalProperties
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.model.*;
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);
Map<String, Object> requestBody = null; // Map<String, Object> | request body
try {
apiInstance.testAdditionalPropertiesReference(requestBody);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testAdditionalPropertiesReference");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **requestBody** | **Map&lt;String,Object&gt;**| request body | |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | successful operation | - |
## testBodyWithFileSchema
> testBodyWithFileSchema(fileSchemaTestClass)

View File

@@ -268,6 +268,45 @@ public class FakeApi {
new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType,
null, localVarReturnType, false);
}
/**
* test referenced additionalProperties
*
* @param requestBody request body (required)
* @throws ApiException if fails to make API call
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful operation </td><td> - </td></tr>
</table>
*/
public void testAdditionalPropertiesReference(Map<String, Object> requestBody) throws ApiException {
testAdditionalPropertiesReferenceWithHttpInfo(requestBody);
}
/**
* test referenced additionalProperties
*
* @param requestBody request body (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException if fails to make API call
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful operation </td><td> - </td></tr>
</table>
*/
public ApiResponse<Void> testAdditionalPropertiesReferenceWithHttpInfo(Map<String, Object> requestBody) throws ApiException {
// Check required parameters
if (requestBody == null) {
throw new ApiException(400, "Missing the required parameter 'requestBody' when calling testAdditionalPropertiesReference");
}
String localVarAccept = apiClient.selectHeaderAccept();
String localVarContentType = apiClient.selectHeaderContentType("application/json");
return apiClient.invokeAPI("FakeApi.testAdditionalPropertiesReference", "/fake/additionalProperties-reference", "POST", new ArrayList<>(), requestBody,
new LinkedHashMap<>(), new LinkedHashMap<>(), new LinkedHashMap<>(), localVarAccept, localVarContentType,
null, null, false);
}
/**
*
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.