Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #3693
Closed
Open
Issue created Aug 19, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[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.

Related issues/PRs
Suggest a fix
Assignee
Assign to
Time tracking