-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Open
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The code comments say
Line 679 in 8052c2c
| // 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
Suggest a fix
This code should be removed
Lines 679 to 684 in 8052c2c
| // 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.
Reactions are currently unavailable