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
  • #11008
Closed
Open
Issue created Dec 01, 2021 by Administrator@rootContributor

[BUG] C# Client: Usage of Newtonsoft.Json

Created by: atinary-screoff

Bug Report Checklist

Description

When I try to use my SDK generated with the following code: 0 value is not taken in account. But going deeper, I found the SDK always use SerializeObject of Newtonsoft.Json so I directly try it.

   ParameterObj param_obj = new ParameterObj(
            description: "parameter description",
            highValue: 1,
            lowValue: 0,
            name: "param_a",
            type: ParameterType.Continuous
        );
    Console.WriteLine(JsonConvert.SerializeObject(param_obj));

The output provides me:

{"high_value":1.0,"name":"param_a"}

and the expected output should be:

{"high_value":1.0, "low_value":0, "name":"param_a"}
openapi-generator version

How I generated my C# SDK with the following command: openapi-generator-cli generate -i openapi_server/openapi/openapi.yml -g csharp -o csharp_sdk

openapi-generator-cli version : 5.3.0

OpenAPI declaration file content or url
    ParameterObj:
      type: object
      required:
        - name
      additionalProperties: false
      properties:
        high_value:
          type: number
          description: (Continuous/Discrete attribute) Upper bound value of this parameter.
          minimum: -100000
          maximum:  100000
          format: double
        low_value:
          type: number
          description: (Continuous/Discrete attribute) Lower bound value of this parameter.
          minimum: -100000
          maximum:  100000
          format: double
        name:
          $ref: '#/components/schemas/Name'
      example:
        name: x1
        low_value: 0
        high_value: 90
Steps to reproduce

Try to provide a value which is 0 of low_value or high_value.

Assignee
Assign to
Time tracking