ferdikoomen / openapi-typescript-codegen

NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification
MIT License
2.89k stars 519 forks source link

Models folder is completely empty for my spec #1427

Open brodo opened 1 year ago

brodo commented 1 year ago

Description

The models-directory is is empty which leads to the client not working. I have linted my spec using Spectral and can render it using Elements therefore I assume this is a bug in openapi-typescript-codegen.

How to reproduce

git clone https://github.com/brodo/openapi-typescript-codegen-empty-models-bug.git
cd openapi-typescript-codegen-empty-models-bug
openapi --input OpenApi.json --output ./generated

The ./generated/models/ folder will be empty.

tvharris commented 1 year ago

@brodo I had the same problem yesterday and found it was because models are only generated for schemas in #/components/schemas. Bundling can do that for you, but seems to be something you have to do as a separate step unless there's a bundle option in this library that I missed.

tyrone2kx commented 1 year ago

@brodo I had the same problem yesterday and found it was because models are only generated for schemas in #/components/schemas. Bundling can do that for you, but seems to be something you have to do as a separate step unless there's a bundle option in this library that I missed.

How exactly do you mean? I have a similar issue, mine generates the models but they are all empty types. export type UserProfile = {} in models/UserProfile. Please can you explain what you meant above? Do you have any idea why mine might be working this way?

creativecreature commented 1 year ago

I think the issue I created #1475 is a duplicate of this but the description might make it easier to work on