Closed afarbman closed 3 years ago
No, they are always interfaces. As interfaces are compile-time only, they don't increase the size of the generated JS bundle.
@luisfpg isn't the size of the bundle the choice of the developer ? I would like to use classes instead of interfaces (perhaps choose per interface / class) as I want to check what sort of parameter is being passed into a method, rather than having to write two methods, one for each parameter type
By default, generate interfaces. However, if a stupid developer wants to use classes instead, why not let them ?
You can just customize the object.handlebars template and replace interface by class. However, this will probably stop working in future releases, as it is planned to change from inheritance to composition, so the semantics of OpenAPI are kept (ex: allOf / anyOf with multiple type="object"). This can only be achieved with interfaces, not with classes, as there's no multiple inheritance.
Hi, Is there any flag to make the generated models be classes instead of interfaces? Thx