Open craigmiller160 opened 1 year ago
maybe you could do it with a custom handlebars template ?
another simple way would be to traverse your OpenAPI schemas and add readonly on each properties before passing that OpenAPI document to openapi-zod-client
The documentation on how to use the custom handlebars template is far from ideal. I've been trying to figure it out for a minute, I haven't used handlebars very much but it seems simple enough. The big issue for me is understanding all the different context variables that are available and how to use them. Again, I don't see good documentation about this.
As for marking things as readonly in the OpenAPI schema, that is something I hadn't considered. I will investigate this option.
I'm not seeing any easy ways with handlebars to customize things to the point of making all types readonly. Customizing the openapi schema isn't always an option as well. I'm really hoping that this feature could be added in the future.
Customizing the openapi schema isn't always an option as well.
what's the issue with your case ?
I'm really hoping that this feature could be added in the future.
feel free to send a PR 🙏
feel free to send a PR 🙏
Thanks for the invitation. Here is the PR adding the requested functionality: https://github.com/astahmer/openapi-zod-client/pull/221
I'm a strong proponent of immutable data structures. I would love if there was some way that the schemas generated would have all properties set to readonly. I'm currently exploring the API of this library, and I don't see a way to do this yet. Hoping there is a solution, or that a new argument can be added to the CLI.
Thanks.