[Java][Jersey2] Add JsonTypeName annotation (#6551)

* Mustache template should use invokerPackage tag to generate import

* add JsonSubTypes annotation to handle scenario when OAS name has special characters

* add JsonSubTypes annotation to handle scenario when OAS name has special characters. Add unit test

* run sample scripts

* fix unit test

* run sample scripts

* add minimal openapi document to show issue with special characters and discriminators

* Add 'isClassnameSanitized' tag

* Add 'isClassnameSanitized' tag

* Add 'isClassnameSanitized' tag

* Add 'isClassnameSanitized' tag

* Add 'isClassnameSanitized' tag

* Add 'isClassnameSanitized' tag

* Add unit tests for unmarshaling of discriminators with special characters

* Add unit tests for unmarshaling of discriminators with special characters

* use JsonTypeName

Co-authored-by: Vikrant Balyan (vvb) <vvb@cisco.com>
Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
Sebastien Rosset
2020-07-18 06:56:41 -07:00
committed by GitHub
parent 8a774f636b
commit 968f32b55e
176 changed files with 4796 additions and 13 deletions

View File

@@ -0,0 +1,13 @@
# ChildSchema
A schema that does not have any special character.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**prop1** | **String** | | [optional]

View File

@@ -0,0 +1,12 @@
# ChildSchemaAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**prop1** | **String** | | [optional]

View File

@@ -0,0 +1,72 @@
# DefaultApi
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testPost**](DefaultApi.md#testPost) | **POST** /test |
## testPost
> MySchemaNameCharacters testPost(mySchemaNameCharacters)
### 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.DefaultApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost");
DefaultApi apiInstance = new DefaultApi(defaultClient);
MySchemaNameCharacters mySchemaNameCharacters = new MySchemaNameCharacters(); // MySchemaNameCharacters |
try {
MySchemaNameCharacters result = apiInstance.testPost(mySchemaNameCharacters);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#testPost");
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
------------- | ------------- | ------------- | -------------
**mySchemaNameCharacters** | [**MySchemaNameCharacters**](MySchemaNameCharacters.md)| | [optional]
### Return type
[**MySchemaNameCharacters**](MySchemaNameCharacters.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | the response | - |

View File

@@ -0,0 +1,13 @@
# MySchemaNameCharacters
A schema name that has letters, numbers, punctuation and non-ASCII characters. The sanitization rules should make it possible to generate a language-specific classname with allowed characters in that programming language.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**prop2** | **String** | | [optional]

View File

@@ -0,0 +1,12 @@
# MySchemaNameCharactersAllOf
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**prop2** | **String** | | [optional]

View File

@@ -0,0 +1,12 @@
# Parent
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**objectType** | **String** | | [optional]