-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
Description
When I use schema below generation of csharp generichost code produces invalid code. There is doubled property Code in Model/TestResult.cs. When I use aspnetcore (server) or csharp httpclient/restsharp it produces valid code in this class.
openapi-generator version
7.11.0
OpenAPI declaration file content or url
openapi: '3.0.2'
info:
title: Inheritance test
version: '1.0.0'
paths:
/test/data:
get:
operationId: testOperation
responses:
'200':
description: Test operation
content:
"application/json":
schema:
$ref: "#/components/schemas/TestResult"
components:
schemas:
Result:
type: object
properties:
code:
type: string
description: Result code
uuid:
type: string
description: Result unique identifier
data:
type: object
description: list of named parameters for current message
additionalProperties:
type: string
TestResult:
type: object
allOf:
- $ref: '#/components/schemas/Result'
properties:
code:
$ref: "#/components/schemas/TestResultCode"
TestResultCode:
type: string
description: Result code
enum:
- APPROVED
- MANUAL_APPROVAL_REQUIRED
Generation Details
java -jar .\openapi-generator-cli-7.11.0.jar generate -i ./service.yaml -g csharp -o ./out-debug-host/ --additional-properties=targetFramework=net8.0,excludeTests=true,nullableReferenceTypes=true,useOneOfDiscriminatorLookup=true,packageName=Test.Client.Generic,packageVersion=1.0.0,library=generichost
Steps to reproduce
Run CLI command above and run dotnet build in ./out-debug-host/ It fail with two errors in TestResult class
Suggest a fix
Only the child property code is produced in TestResult class. Same as when I generates aspnetcore or csharp with restsharp or httpclient libraries.