MatthiasMargot / typegen

Generate source-code types from a swagger-specification file
MIT License
1 stars 1 forks source link

Add support for aliases in refs #32

Open MatthiasMargot opened 2 years ago

MatthiasMargot commented 2 years ago

This mr adds support for aliased refs for the use-case that a given Schema's name is aliased vie the title field e.g.:

{
  "User": {
    "type": "object",
    "properties": {
      "tags": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/TagResponse"
        }
      }
    }
  },
  "TagResponse": {
    "title": "Tag"
  }
}

resulting in

export interface User {
  tags?: Tag[];
}

instead of

export interface User {
  tags?: TagResponse[];
}