OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[x] Have you provided a full/minimal spec to reproduce the issue?
[x] Have you validated the input using an OpenAPI validator (example)?
[x] What's the version of OpenAPI Generator used?
[x] Have you search for related issues/PRs?
[x] What's the actual output vs expected output?
[ ] [Optional] Bounty to sponsor the fix (example)
Description
When generating a client using the csharp-netcore generator with a targetFramework of netcoreapp2.0, there is the following warning output to the console:
[main] WARN o.o.c.languages.CSharpClientCodegen - Invalid .NET framework version, defaulting to v4.6.1
[main] INFO o.o.c.languages.CSharpClientCodegen - Generating code for .NET Framework v4.6.1
This seems unexpected for a few reasons:
v4.6.1 is not one of the valid target frameworks listed in the documentation when running the command openapi-generator config-help -g csharp-netcore (although it is listed as the default, which is confusing):
targetFramework
The target .NET framework version. (Default: v4.6.1)
netstandard1.3 - .NET Standard 1.3 compatible
netstandard1.4 - .NET Standard 1.4 compatible
netstandard1.5 - .NET Standard 1.5 compatible
netstandard1.6 - .NET Standard 1.6 compatible
netstandard2.0 - .NET Standard 2.0 compatible
netcoreapp2.0 - .NET Core 2.0 compatible
The generate command sets targetFramework=netcoreapp2.0, which is listed as a valid value in the documentation, so it isn't clear why this warning is saying the framework version is invalid.
The warning indicates the logger was for the class "o.o.c.languages.CSharpClientCodegen", but the csharp-netcore generator is defined in the CSharpNetCoreClientCodegen class. I think this class is not setting up its logger correctly.
Bug Report Checklist
Description
When generating a client using the csharp-netcore generator with a targetFramework of netcoreapp2.0, there is the following warning output to the console:
This seems unexpected for a few reasons:
v4.6.1 is not one of the valid target frameworks listed in the documentation when running the command openapi-generator config-help -g csharp-netcore (although it is listed as the default, which is confusing):
The generate command sets targetFramework=netcoreapp2.0, which is listed as a valid value in the documentation, so it isn't clear why this warning is saying the framework version is invalid.
The warning indicates the logger was for the class "o.o.c.languages.CSharpClientCodegen", but the csharp-netcore generator is defined in the CSharpNetCoreClientCodegen class. I think this class is not setting up its logger correctly.
openapi-generator version
4.1.0
OpenAPI declaration file content or url
I used the test yaml here: https://github.com/OpenAPITools/openapi-generator/blob/v4.1.0/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
Command line used for generation
openapi-generator generate -g csharp-netcore -i ./petstore-with-fake-endpoints-models-for-testing.yaml --additional-properties targetFramework=netcoreapp2.0 -o ./netcoreapp2.0
Steps to reproduce
Run the command line above and look at the console output.
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/3682
Suggest a fix