openapi-ts icon indicating copy to clipboard operation
openapi-ts copied to clipboard

Add JSDOC tags to generated type declarations

Open robogeek opened this issue 1 year ago • 6 comments

Description

The type declarations generated by openapi-ts are very good.

They would be even more useful if they had JSDOC tags.

The information for JSDOC tags is readily available in an OpenAPI spec. This would open the door to using the output with tools that can consume JSDOC tags - such as documentation generation - tooltips in the IDE

robogeek avatar Oct 03 '24 17:10 robogeek

Hey @robogeek can you provide a specific example where the generated code falls short and what you'd expect to see?

mrlubos avatar Oct 04 '24 01:10 mrlubos

I'm also interested in this feature. I use ts-to-zod to generate zod schemas based on openapi-ts generated types. Since there are no jsdoc tags in the output I'm not getting validators or defaults in my zod schemas.

Funny timing, I just saw this PR @mrlubos - https://github.com/hey-api/openapi-ts/pull/1127

ghost avatar Oct 06 '24 19:10 ghost

@sberryman-mh I swear that's how it goes every time haha. Want to help me beta test https://github.com/hey-api/openapi-ts/issues/876?

mrlubos avatar Oct 07 '24 04:10 mrlubos

@mrlubos - I'm happy to help test it. I do use ts-to-zod config, specifically nameFilter as I don't need (name.endsWith OpenApiTs, Response and Error schemas)

Is the approach to bring this in-house vs instructing users to use ts-to-zod (while adding jsdoc tags) easier in the long run? That project has a pretty good following

ghost avatar Oct 07 '24 13:10 ghost

@sberryman-mh Which OpenAPI version are you on?

mrlubos avatar Oct 07 '24 13:10 mrlubos

@mrlubos 3.1 - most of our backend API's are in python/FastAPI

ghost avatar Oct 07 '24 21:10 ghost