Skip to content

[BUG][aspnetcore][csharp][csharp-dotnet2] allOf generates source code for *AllOf model #3338

@oleksabor

Description

@oleksabor
Description

I've tried to use allOf to check inherited classes case. But the problem is that it generates surplus model class ExtendedErrorModelAllOf.cs among with ErrorModel.cs ExtendedErrorModel.cs
I expect that ExtendedErrorModelAllOf.cs should not be generated.

openapi-generator version

v4.0.3

OpenAPI declaration file content or url

classInherit.yml.zip

Command line used for generation

java -jar D:/os/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i classInherit.yml -g aspnetcore -o d:\temp\ErrorMessage

java -jar D:/os/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i classInherit.yml -g csharp -o d:\temp\ErrorMessage

java -jar D:/os/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i classInherit.yml -g csharp-dotnet2 -o d:\temp\ErrorMessage

Steps to reproduce

clone openapi-generator
checkout v4.0.3
build mvnw package
get classInherit.yml
run commands

Related issues/PRs
Suggest a fix

I suppose the reason is in the AbstractCSharpCodegen since all three c# is affected.

probably it happens because of ExtendedErrorModel has -ref$ and -type

  ExtendedErrorModel:
    allOf:
    - $ref: '#/definitions/ErrorModel'
    - type: object

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions