openapi-typescript-codegen icon indicating copy to clipboard operation
openapi-typescript-codegen copied to clipboard

Empty models

Open NikitaIT opened this issue 2 years ago • 2 comments

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;

NikitaIT avatar Jun 07 '22 18:06 NikitaIT

Got this as well. All models generated have no properties, only the types defined. In the openapi.json document properties are defined properly.

garcipat avatar Jul 17 '22 11:07 garcipat

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.

ajenkinski avatar Aug 05 '22 01:08 ajenkinski