[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,53 @@
openapi: 3.0.3
info:
description: test
title: test
version: 1.0.0
servers:
- url: /
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/MySchemaName._-Characters'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/MySchemaName._-Characters'
description: the response
x-contentType: application/json
x-accepts: application/json
components:
schemas:
Parent:
discriminator:
propertyName: objectType
properties:
objectType:
type: string
ChildSchema:
allOf:
- $ref: '#/components/schemas/Parent'
- $ref: '#/components/schemas/ChildSchema_allOf'
description: A schema that does not have any special character.
MySchemaName._-Characters:
allOf:
- $ref: '#/components/schemas/Parent'
- $ref: '#/components/schemas/MySchemaName___Characters_allOf'
description: 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.
ChildSchema_allOf:
properties:
prop1:
type: string
MySchemaName___Characters_allOf:
properties:
prop2:
type: string