OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.3k stars 6.44k forks source link

[BUG][Nim] Nim doesn't create enums #13960

Open TimWhiting opened 1 year ago

TimWhiting commented 1 year ago

Bug Report Checklist

Description

Generator does not create enums

openapi-generator version

5.3.1

OpenAPI declaration file content or url
openapi: "3.0.2"
info:
  title: Test
  version: "1.0"
servers: 
  -
    url: "https://localhost:8080"
    description: "local emulator"
paths:
  /api/doSomething:
    post:
      requestBody:
        required: true
        content: 
          application/json:
            schema:
              type: boolean
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AnObject"

components:
  schemas:
    Status:
      type: string
      enum:
        - ok
        - bad

    AnObject:
      type: object
      required: [a]
      properties:
        a:
          $ref: "#/components/schemas/Status"
Generation Details

(Using npm package openapi-generator-cli -- npm i -g @openapitools/openapi-generator-cli) openapi-generator-cli generate -g nim -i test.yml -o generated/test

Steps to reproduce
Related issues/PRs

None

Suggest a fix

Instead of this

type Status* = object
  ## 

generate:

type Status* = enum
  ## 
  ok, bad

@hokamoto

wing328 commented 1 year ago

5.3.1

FYI. A newer stable version is v6.2.1.

Generator does not create enums

May I know if you've time to contribute a fix (PR) or you would like to sponsor @hokamoto to fix the issue?