[BUG][C#][csharp-netcore] Many warnings detected when building generated code
Created by: 414004738
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
When building a generated client using the csharp-netcore generator with a targetFramework of netcoreapp2.0, there are many compilation warning detected. When using the test yaml from 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, 70 warnings are detected.
Most of the warnings are of the form:
PetApi.cs(713, 17): [CS0472] The result of the expression is always 'false' since a value of type 'long' is never equal to 'null' of type 'long?'
Expected behavior is for no warnings to be generated.
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 build the project. Look at the compiler warnings.