Not sure if that’s a sane way to do this, it’s the first time I’m playing around with Swagger.
I bumped into the following link and pasted the schema from the project I integrate with. From the top ‘Generate Client’ menu I chose one of the TypeScript presets and it generated a minimal project where I could extract the bits I needed, interface and classes, etc.
http://editor.swagger.io/#/
I tried running your schema. Here’s a small excerpt of the generated code:
export interface Bar {
"a"?: string;
"b": number;
"c": Date;
"baz"?: Baz;
}
export interface Baz {
"d": number;
"color": Color;
}
/**
*
*/
export type Color = "0" | "1" | "2";
Maybe with a bit more tweaking it can make exactly what you’re looking for.
Further reading may be about tools like https://github.com/swagger-api/swagger-codegen but the online web editor is a quick and dirty way to do this.