Bug Report Checklist
Description
When oneOf or anyOf constructs are used, the generated model file has duplicate constructor and duplicate getObject() method. There's no reference to the actual properties (aId, bId, cId, dId) in the generated file. These problems are not seen with allOf. The attached example YAML file uses oneOf. The same problem will be observed if it's replaced with anyOf.
With aspnetcore, the model file has no duplicates but shows other problems, such as no constructor. This issue focuses only on csharp-netcore.
openapi-generator version
Version used is 6.2.1. Did not test against the latest commit on the master branch.
OpenAPI declaration file content or url
openapi: 3.0.0
info:
version: '1.0.0'
title: 'Problem example with OneOf'
paths: {}
components:
schemas:
SomeId:
type: object
properties:
aId:
$ref: '#/components/schemas/AId'
bId:
$ref: '#/components/schemas/BId'
cId:
$ref: '#/components/schemas/CId'
dId:
$ref: '#/components/schemas/DId'
oneOf:
- required: [ aId ]
- required: [ bId ]
- required: [ cId ]
AId:
type: integer
minimum: 0
maximum: 10
BId:
type: integer
CId:
type: integer
DId:
type: integer
Generation Details
java -jar C:\openapi-generator-cli.jar generate -i C:\ModelExample.yaml -g csharp-netcore -o C:\out --additional-properties=targetFramework=net6.0 --additional-properties=packageName=Com.Example
Steps to reproduce
Just run the command above and check the generated model file. We will see the duplicates.
Related issues/PRs
This could be related: #8382
Suggest a fix
None at the moment
Bug Report Checklist
Description
When
oneOforanyOfconstructs are used, the generated model file has duplicate constructor and duplicategetObject()method. There's no reference to the actual properties (aId, bId, cId, dId) in the generated file. These problems are not seen withallOf. The attached example YAML file usesoneOf. The same problem will be observed if it's replaced withanyOf.With
aspnetcore, the model file has no duplicates but shows other problems, such as no constructor. This issue focuses only oncsharp-netcore.openapi-generator version
Version used is 6.2.1. Did not test against the latest commit on the master branch.
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Just run the command above and check the generated model file. We will see the duplicates.
Related issues/PRs
This could be related: #8382
Suggest a fix
None at the moment