You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a specification which contains a discriminator containing an underscore the @JsonTypeInfo property is incorrectly formatted to camel case. For instance a discriminator defined with _type produces the @JsonTypeInfo property type in the super class:
This produces an API server definition which is incorrect and not able to evaluate the discriminator to instantiate the correct sub class.
openapi-generator version
4.0.3-SNAPSHOT
OpenAPI declaration file content or url
openapi: 3.0.0servers:
- url: https://api.example.com/v1info:
version: 0.0.0title: testpaths:
/pet:
get:
responses:
'200':
description: 'A Pet'content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'discriminator:
propertyName: _typemapping:
Cat: '#/components/schemas/Cat'Dog: '#/components/schemas/Dog'components:
schemas:
Pet:
type: objectrequired:
- nameproperties:
name:
type: string_type:
type: stringdiscriminator:
propertyName: _typeDog: # "Dog" is a value for the pet_type property (the discriminator value)allOf: # Combines the main `Pet` schema with `Dog`-specific properties
- $ref: '#/components/schemas/Pet'
- type: object# all other properties specific to a `Dog`properties:
bark:
type: booleanbreed:
type: stringenum: [Dingo, Husky, Retriever, Shepherd]Cat: # "Cat" is a value for the pet_type property (the discriminator value)allOf: # Combines the main `Pet` schema with `Cat`-specific properties
- $ref: '#/components/schemas/Pet'
- type: object# all other properties specific to a `Cat`properties:
hunts:
type: booleanage:
type: integer
Command line used for generation
openapi-generator-cli generate -g spring
Steps to reproduce
Generate the server stubs with the above API definition.
Description
Given a specification which contains a discriminator containing an underscore the @JsonTypeInfo property is incorrectly formatted to camel case. For instance a discriminator defined with
_type
produces the @JsonTypeInfo propertytype
in the super class:the expected @JsonTypeInfo property is
_type
:This produces an API server definition which is incorrect and not able to evaluate the discriminator to instantiate the correct sub class.
openapi-generator version
4.0.3-SNAPSHOT
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Generate the server stubs with the above API definition.
Related issues/PRs
#1699
The text was updated successfully, but these errors were encountered: