Skip to content

Oats doesn't populate referenced types (just any) #24

@glinton

Description

@glinton

When making swagger more friendly for better code generators, it was noticed that oats drops types of referenced parameters/schemas and instead defines them as any.

Given this swagger, oats generates the following typescript.

openapi: 3.0.0
info:
  title: Test API
  version: 0.0.0
servers:
  - url: ''
paths:
  /a:
    post:
      parameters:
        - in: query
          name: range
          schema:
            type: string
            enum:
              - 24h
              - 7d
              - 30d
            default: 24h
      responses:
        '200':
          description: Success
  /b:
    post:
      parameters:
        - in: query
          name: range
          schema:
            $ref: '#/components/schemas/TimeRange'
      responses:
        '200':
          description: Success
components:
  schemas:
    TimeRange:
      type: string
      enum:
        - 24h
        - 7d
        - 30d
      default: 24h
export interface PostAParams {
  query?: {
    range?: string;
  };
}

export interface PostBParams {
  query?: {
    range?: any;
  };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions