Open senecolas opened 4 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
openapi-zod-client-rim4 | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Mar 29, 2024 1:46pm |
thank you, this looks great ! 🙏 could you add a test with your example from the PR description ?
Implement
typescriptDefinitionRefiner
FunctionalityOverview
Following the discussion in PR #275 , this pull request introduces the
typescriptDefinitionRefiner
function, allowing for the customization of TypeScript type definitions generated by theopenapi-zod-client
tool. This functionality supports all type description customization needs, including the ability to add JSDoc comments based on OpenAPI schema properties.Functionality
The
typescriptDefinitionRefiner
function is called within the recursivegetTypescriptFromOpenApi
before returning each Tanu type result. It enables users to modify the TypeScript definitions on the fly, providing a flexible approach to enhance the generated types, such as by adding comprehensive JSDoc comments.Function signature
Example Usage
Below is an example demonstrating how to use the
typescriptDefinitionRefiner
option to add JSDoc comments to the generated TypeScript types with the help of agenerateJSDocArray
function. This example showcases how to dynamically generate JSDoc comments based on the OpenAPI schema, including descriptions, examples, deprecation notices, and more:This approach allows for significant flexibility in customizing the generated types, addressing the original concern about increasing configuration complexity and maintenance overhead.
Request for Comments
I welcome feedback on this feature, including suggestions for improvement or concerns about potential impacts. Please feel free to leave comments or questions in this pull request.
Thank you for considering this contribution to this project.