Bug Report Checklist
Description
The code comments say
|
// If class modifier is abstract then the methods need to be abstract too. |
But this is not and has never been true. Virtual methods should indeed be allowed and it's confusing that it doesn't work with the correct settings. operationModifier is forced to be abstract when classModifier is abstract.
openapi-generator version
7.10.0 (not a regression)
Generation Details
java -jar .\openapi-generator-cli.jar generate -g aspnetcode -c config.json
{
"classModifier": "abstract",
"operationModifier": "virtual" // Also the default setting
}
Steps to reproduce
Just generate
Related issues/PRs
#7042
Suggest a fix
This code should be removed
|
// If class modifier is abstract then the methods need to be abstract too. |
|
if ("abstract".equals(classModifier.getOptValue())) { |
|
operationModifier.setOptValue(classModifier.getOptValue()); |
|
additionalProperties.put(OPERATION_MODIFIER, operationModifier.getOptValue()); |
|
LOGGER.warn("classModifier is {} so forcing operationModifier to {}", classModifier.getOptValue(), operationModifier.getOptValue()); |
|
} |
This changes methods from abstract to virtual but is still technically a non-breaking change.
If this is an acceptable change, I can create a PR.
Bug Report Checklist
Description
The code comments say
openapi-generator/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetServerCodegen.java
Line 679 in 8052c2c
But this is not and has never been true. Virtual methods should indeed be allowed and it's confusing that it doesn't work with the correct settings.
operationModifieris forced to beabstractwhenclassModifierisabstract.openapi-generator version
7.10.0 (not a regression)
Generation Details
java -jar .\openapi-generator-cli.jar generate -g aspnetcode -c config.json
{ "classModifier": "abstract", "operationModifier": "virtual" // Also the default setting }Steps to reproduce
Just generate
Related issues/PRs
#7042
Suggest a fix
This code should be removed
openapi-generator/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetServerCodegen.java
Lines 679 to 684 in 8052c2c
This changes methods from abstract to virtual but is still technically a non-breaking change.
If this is an acceptable change, I can create a PR.