typeconv
typeconv copied to clipboard
TypeScript to OpenApi
I would like to serve multiple versions of an api from a single web service. I also don't want to write OpenApi schemas. I want to write TypeScript, then I want to convert that to OpenApi. I am able to convert from TS to OpenApi (thanks!), however, I need to support multiple schema versions. If my project dirs look something like this...
.
`-- src/
|-- business/
| `-- dtos/
| |-- v1/
| | `-- index.ts
| `-- v2/
| `-- index.ts
`-- customer/
`-- dtos/
|-- v1/
| `-- index.ts
`-- v2/
`-- index.ts
then i want the schema to look something like
{
...
components:{
schemas: {
v1: {
...
},
v2:{
...
}
}
}
}
extending the example above, one of the index.ts files may have an interface like...
export interface Customer {
name: string;
creditCardNumber: string
socialSecurityNumber: string
streetAddress: string
passportId: string
dateOfBirth: string
isHouseKeyUnderMat: boolean
}
export interface AttackAnimal {
isExoticPet: boolean
isillegal: boolean
isTerritorial: boolean
}