[aspnetcore] Minor cleanups to library-based output
Description
Some minor issues found during verification of #2282, but can be fixed after merge of that PR:
- generating as
buildTarget=library
omits Dockerfile, but does not remove docker build steps from README.md - When specifying
classModifier=abstract
and method body is omitted, semicolon is below the abstract method signature, and should be on the same line - I think this was mentioned in the original PR:
wwwroot
shouldn't be generated for library options (or should it? I don't think it makes sense, and I don't know if aspnet allows pulling wwwroot from a dependency).
Additional TODOs for the library-based generated output:
-
make class and operation modifiers enums on CLI input
-
validate combinations of modifiers (class + operation), and disallow any which shouldn't be allowed by the language (such as disallowing partial methods, which can't be virtual and can't be applied to non-void methods-- we return
IActionResult
) -
README should explain how to use the generated code, as it may not be immediately obvious to some users. Example of
ConfigureServices
inStartup.cs
:services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddApplicationPart(typeof(PetApiController).Assembly) .AddControllersAsServices();
Note: users installing new
dotnet
SDK(at least on Mac with Rider) can only generate .NETCore 2.2 and need to upgrade the project for the above to work. The above should work for .NETCore 2.1 by removing.SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
openapi-generator version
n/a
OpenAPI declaration file content or url
n/a
Command line used for generation
n/a
Steps to reproduce
Related issues/PRs
#2282
Suggest a fix/enhancement
n/a