Closed detomarco closed 4 months ago
Hey @detomarco, this should already be possible. Try the following example:
openapi: 3.0.1
info:
title: example
version: 0.0.1
paths:
/cars:
get:
operationId: me
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Cars'
description: OK
components:
schemas:
Cars:
type: object
properties:
types:
type: string
$ref: '#/components/schemas/CarType'
CarType:
type: string
enum:
- FERRARI
- FORD
- BMW
Running the command you mentioned should generate a separate file for you that contains an actual typescript enum that you can reuse in your application.
Thanks, that worked indeed.
I'll close this issue!!
Version: 0.51.0
Schema
Command
Current output
Desired output
As described above, I'd like to have the option to generate enums as String literals, so I could reuse
CarsType
type in my application code