[BUG][aspnetcore] Virtual and abstract not used correctly
Created by: Sshnyari
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
In the server generated code for aspnetcore:
-
When using the 'generateBody' option to false, we get a virtual method with no body. It should be an abstract method if the method have no body, and the class should also be made abstract in this case.
-
When using the 'operationModifier', we get abstract methods, but not an abstract class. The class should also be abstract for it to work.
Also, unless I am mistaken, it seems that these two options (generateBody and operationModifier) have the same purpose
openapi-generator version
4.3.1
OpenAPI declaration file content or url
can be reproduced with the petstore file
Command line used for generation
openapi-generator generate -g aspnetcore -i petstore.json -c config.json -o src and one of the following config.json files can be used depending on the case (1 or 2)
{
"aspnetCoreVersion":"3.1",
"operationModifier": "abstract"
}
or
{
"aspnetCoreVersion":"3.1",
"generateBody": false
}
Steps to reproduce
just running the command is enough to see the results
Related issues/PRs
Suggest a fix
changing virtual with abstract when relevant and adding abstract to the class when methods are abstract