acacode / swagger-typescript-api

Generate the API Client for Fetch or Axios from an OpenAPI Specification
MIT License
3.36k stars 360 forks source link

any typings using refs to components params #264

Open KappyJS opened 3 years ago

KappyJS commented 3 years ago

Hi,

Codegen in cool ^^, but i have some problem

I'm trying to use next yaml

openapi: 3.0.2

components:

  schemas:
    Employee:
      type: object
      required:
        - id
      properties:
        id:
          type: string
        head:
          type: object
          required:
            - id
          properties:
            id:
              $ref: '#/components/schemas/Employee/id'

And after generating i have this model

export interface Employee {
  id?: string;
  head?: { id?: any };
}

But I think it should turn out like this:

export interface Employee {
  id?: string;
  head?: { id: string };
}
taranvohra commented 1 year ago

+1, noticed it too

sdirosa commented 12 months ago

Just stumbled into this as well

pavel-shchepko commented 1 month ago

+1