Skip to content
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

Numeric Enum #57

Open
dickermoshe opened this issue Mar 11, 2024 · 0 comments
Open

Numeric Enum #57

dickermoshe opened this issue Mar 11, 2024 · 0 comments

Comments

@dickermoshe
Copy link
Contributor

dickermoshe commented Mar 11, 2024

A enum of numbers throws an exception,
Seems that the type of enums is completly ignored.
A temp fix would be to mark it dynamic and do manual type checking, although doing this by looking at the declared type would prob be better long temp.

Schema

components:
  schemas:
    Absent:
      description: Model having absent and null values
      properties:
        default:
          type: string
        nullable:
          nullable: true
          type: string
        required:
          type: string
        requiredNullable:
          nullable: true
          type: string
      required:
      - required
      - requiredNullable
    Array:
      description: Model with arrays
      properties:
        array:
          items:
            type: string
          type: array
        arrayOfArray:
          items:
            items:
              type: string
            type: array
          type: array
        arrayOfEnum:
          items:
            $ref: '#/components/schemas/Enum'
          type: array
        arrayOfPrimitive:
          items:
            $ref: '#/components/schemas/Primitive'
          type: array
      required:
      - array
      - arrayOfArray
    Composed:
      allOf:
      - $ref: '#/components/schemas/ComposedBase'
      - properties:
          value:
            type: string
        type: object
      description: Composed model
    ComposedBase:
      properties:
        base:
          type: number
      required:
      - base
    Discriminated:
      description: Discriminated model
      discriminator:
        propertyName: kind
      properties:
        kind:
          type: string
      required:
      - kind
    DiscriminatedA:
      allOf:
      - $ref: '#/components/schemas/Discriminated'
      - properties:
          a:
            type: string
        type: object
    DiscriminatedB:
      allOf:
      - $ref: '#/components/schemas/Discriminated'
      - properties:
          b:
            type: string
        type: object
    Enum:
      enum:
      - foo
      - bar
      - baz
      type: string
    Enumeric: # Here
      enum: # Here
      - 1 # Here
      - 2 # Here
      - 3 # Here
      type: number # Here
    Maybe:
      description: Model using reserved words
      properties:
        if:
          type: boolean
        type:
          type: string
    OneOf:
      description: One of two models
      oneOf:
      - $ref: '#/components/schemas/OneOfA'
      - $ref: '#/components/schemas/OneOfB'
    OneOfA:
      properties:
        a:
          type: string
    OneOfB:
      properties:
        b:
          type: string
    Primitive:
      description: Model with primitive properties
      properties:
        boolean:
          type: boolean
        double:
          format: double
          type: number
        float:
          format: float
          type: number
        integer:
          type: integer
        long:
          format: int64
          type: integer
        number:
          type: number
        short:
          format: int32
          type: integer
        string:
          type: string
    Recursion:
      properties:
        list:
          items:
            $ref: '#/components/schemas/Recursion'
          type: array
        maybe:
          $ref: '#/components/schemas/Recursion'
        ref:
          $ref: '#/components/schemas/RecursionLoop'
    RecursionLoop:
      properties:
        ref:
          $ref: '#/components/schemas/Recursion'
    UnsafeCharacters:
      description: Model using unsafe characters
      properties:
        $prefix:
          type: string
        _before:
          type: string
        _both_:
          type: string
        after_:
          type: string
        in_the_middle:
          type: string
        r@nd0m_$t#ff:
          type: string
        suffix$:
          type: string
  securitySchemes:
    BearerAuth:
      bearerFormat: JWT
      scheme: bearer
      type: http
info:
  license:
    name: MIT
  title: Elm generator test
  version: 1.0.0
openapi: 3.0.0
paths:
  /data:
    post:
      operationId: update
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Primitive'
        description: Request body
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Primitive'
          description: Default response
      tags:
      - primitive
  /header:
    post:
      parameters:
      - in: header
        name: string
        required: true
        schema:
          type: string
      - in: header
        name: integer
        schema:
          type: integer
      - in: header
        name: headerType
        schema:
          enum:
          - left
          - right
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                type: string
          description: Default response
  /maybe:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Maybe'
          description: Default response
  /path/{string}/{integer}/{enumeration}:
    get:
      parameters:
      - in: path
        name: string
        required: true
        schema:
          type: string
      - in: path
        name: integer
        required: true
        schema:
          type: integer
      - in: path
        name: enumeration
        required: true
        schema:
          enum:
          - a
          - b
          - c
          type: string
      responses:
        '200':
          description: Default response
  /query:
    get:
      parameters:
      - in: query
        name: string
        schema:
          type: string
      - in: query
        name: int
        schema:
          type: integer
      - in: query
        name: enum
        schema:
          enum:
          - a
          - b
          - c
          type: string
      responses:
        '200':
          description: Default response
  /secured:
    post:
      responses:
        '200':
          description: Authenticated
        '401':
          description: Unauthenticated
      security:
      - BearerAuth: []
      summary: Secured endpoint
  /uuid:
    get:
      parameters:
      - in: query
        name: value
        schema:
          format: uuid
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                format: uuid
                type: string
          description: Default response
servers:
- url: http:https://localhost:9000

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

No branches or pull requests

1 participant