openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[REQ] Add support for UUID in typescript-fetch generator

Open jivanic-demystdata opened this issue 1 year ago • 0 comments

UUID type is extremely common in REST APIs. Most, if not all, resources fetched from a REST API contain an ID and most of the time, this ID is a UUID

OpenAPI already supports the uuid type with the following notation:

"MyObject": {
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
  },
  "required": [
    "id"
  ]
},

It could be great if the generator was able to generate this kind of code:

export interface MyObject {
    /**
     * 
     * @type {uuid}
     * @memberof MyObject
     */
    id: uuid;
}

This support might require the addition of a library (https://www.npmjs.com/package/@types/uuid) so the generation of UUID fields could be optional and only activated with a flag

jivanic-demystdata avatar Aug 23 '24 11:08 jivanic-demystdata