openapi-typescript-codegen
openapi-typescript-codegen copied to clipboard
Empty models
Describe the bug
https://github.com/vechain/thor/blob/master/api/doc/thor.yaml
For all models output looks like:
export const $Account = {
properties: {
},
} as const;
Got this as well. All models generated have no properties, only the types defined. In the openapi.json document properties are defined properly.
None of the schemas in the referenced OpenAPI spec specify a type. Adding type: object
to the schemas causes the models to be correctly generated.
I don't know if the type
property of schemas is supposed to be mandatory. This is certainly the first time I've seen an OpenAPI schema omit the type
field, so I would have thought this OpenAPI spec is invalid. It seems like the author of this spec is assuming type
is supposed to be optional, and it's supposed to default to object
. If that's a valid assumption, then the fix is to make the generator implement that default.