Description
Given a model with an underscore in the name, the generated
does not match the generated model class file name.
openapi-generator version
3.3.4
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: Sample API
description: API description in Markdown.
version: 1.0.0
paths:
/animals:
get:
summary: Returns all animals.
description: Optional extended description in Markdown.
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Animal'
components:
schemas:
Dog_Animal:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
breed:
type: string
Cat_Animal:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
breed:
type: string
Animal:
type: object
discriminator:
propertyName: className
required:
- className
properties:
className:
type: string
color:
type: string
default: red
(for YAML code) or
Command line used for generation
openapi-generator generate -g spring
Steps to reproduce
Invoke the command line above with the provided API definition.
Suggest a fix
Transform the name when adding the MappedModel to the discriminator in DefaultCodegen.createDiscriminator using DefaultCodegent.toModelName().
Description
Given a model with an underscore in the name, the generated
does not match the generated model class file name.
openapi-generator version
3.3.4
OpenAPI declaration file content or url
(for YAML code) or
Command line used for generation
openapi-generator generate -g springSteps to reproduce
Invoke the command line above with the provided API definition.
Suggest a fix
Transform the name when adding the
MappedModelto the discriminator inDefaultCodegen.createDiscriminatorusingDefaultCodegent.toModelName().