Bug Report Checklist
Description
Use of anyOf leads to a model class referencing another model class which isn't generated. When using the definitions below, the following field is generated within Partner:
private JsonNullable<AnyOfAddress> partner2Address = JsonNullable.<AnyOfAddress>of(null);
The problem is that the class AnyOfAddress (org.openapitools.client.model.AnyOfAddress fully qualified) doesn't exist. It should probably be generated, too, but it isn't.
openapi-generator version
4.3.0
OpenAPI declaration file content or url
The example is actually split into two files because that's how the original set of files looked like (I only deleted most of the contents and all the other files that were originally there).
address.yaml:
openapi: 3.0.2
info:
title: Address
version: '1.0'
paths:
'/Addresses(''{AddressID}'')':
parameters:
- description: 'key: AddressID'
in: path
name: AddressID
required: true
schema:
type: string
maxLength: 10
get:
summary: Get entity from Addresses by key
responses:
'200':
description: Retrieved entity
content:
application/json:
schema:
$ref: '#/components/schemas/Address'
components:
schemas:
Address:
title: Address
type: object
properties:
AddressID:
type: string
maxLength: 10
Street:
type: string
maxLength: 60
StreetNumber:
type: string
maxLength: 10
City:
type: string
maxLength: 40
partner.yaml:
openapi: 3.0.2
info:
title: Partner
version: '1.0'
paths:
'/Partners(''{PartnerId}'')':
parameters:
- description: 'key: PartnerId'
in: path
name: PartnerId
required: true
schema:
type: string
maxLength: 10
get:
summary: Get entity from Partners by key
responses:
'200':
description: Retrieved entity
content:
application/json:
schema:
$ref: '#/components/schemas/Partner'
components:
schemas:
Partner:
title: Partner
type: object
properties:
PartnerId:
type: string
maxLength: 10
LastName:
type: string
maxLength: 40
FirstName:
type: string
maxLength: 40
Partner2Address:
anyOf:
- $ref: 'address.yaml#/components/schemas/Address'
nullable: true
Command line used for generation
-g java -p dateLibrary=java8,hideGenerationTimestamp=true,java8=true,library=resttemplate -i partner.yaml
Steps to reproduce
Related issues/PRs
Suggest a fix
Bug Report Checklist
Description
Use of
anyOfleads to a model class referencing another model class which isn't generated. When using the definitions below, the following field is generated withinPartner:The problem is that the class
AnyOfAddress(org.openapitools.client.model.AnyOfAddressfully qualified) doesn't exist. It should probably be generated, too, but it isn't.openapi-generator version
4.3.0
OpenAPI declaration file content or url
The example is actually split into two files because that's how the original set of files looked like (I only deleted most of the contents and all the other files that were originally there).
address.yaml:
partner.yaml:
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix