swagger-typescript-api icon indicating copy to clipboard operation
swagger-typescript-api copied to clipboard

any typings using refs to components params

Open KappyJS opened this issue 4 years ago • 3 comments

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 };
}

KappyJS avatar Jun 05 '21 01:06 KappyJS

+1, noticed it too

taranvohra avatar Apr 06 '23 03:04 taranvohra

Just stumbled into this as well

sdirosa avatar Nov 15 '23 18:11 sdirosa