Skip to content

[BUG][C#][API client: csharp] Integer Enumeration produce same code as String Enumeration #4395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
erezgeva opened this issue Nov 6, 2019 · 1 comment

Comments

@erezgeva
Copy link

erezgeva commented Nov 6, 2019

Description

When generatin API client for C#. the code for Integer Enumerator produce have the same properties as if it was a String Enumerator.

openapi-generator version

4.2.0

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  version: "1"
  title: BUG Report
paths:
  /Create:
    put:
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/new_item'
      responses:
        default:
          description:  return
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/new_item'
components:
  schemas:
    new_item:
      properties:
        class:
          type: string
          enum:
            - high
            - low
        size:
          type: integer
          format: int8
          enum:
            - 2
            - 4
            - 8
Command line used for generation

java -jar openapi-generator-cli.jar generate -i my.yaml -g csharp

Steps to reproduce

Just run the command and compare JSON attribute of "enum ClassEnum" and "enum SizeEnum" at src/Org.OpenAPITools/Model/NewItem.cs

Related issues/PRs

Resamble but more simple then:
#3246

Suggest a fix

The JSON attribute "[JsonConverter(typeof(StringEnumConverter))]" should be used on string Enomurators,
but should be omit in case of Integer Enomurators.

@auto-labeler
Copy link

auto-labeler bot commented Nov 6, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant