Skip to content

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

@atinary-screoff

Description

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions