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
  • #4395
Closed
Open
Issue created Nov 06, 2019 by Administrator@rootContributor

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

Created by: erezgeva

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: https://github.com/OpenAPITools/openapi-generator/issues/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.

Assignee
Assign to
Time tracking