astahmer / openapi-zod-client

Generate a zodios (typescript http client with zod validation) from an OpenAPI spec (json/yaml)

Home Page:openapi-zod-client.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Endpoint-Specific Generation

andenacitelli opened this issue · comments

commented

I've been using this package to generate types for the GitHub OpenAPI spec here: https://github.com/github/rest-api-description/blob/main/descriptions/api.github.com/api.github.com.yaml

This seems to work reasonably well, but I really don't need 98% of it, and it tends to bog down my editor. I'm just using the GET /repository/search endpoint and a few others. It would be cool to be able to specify those and have it only generate APIs and schemas for those specific endpoints (i.e. a --endpoints /repository/search,... option)

this seems out of scope for this library, if you want to filter an openapi doc you can do so by simply parsing the openapi document JSON/YAML beforehand, apply any filter you want however you want, and then passing that filtered doc to openapi-zod-client

commented

Agree, I am working on a solution. Will update this later once complete.

commented

@astahmer Developed my own CLI tool that does it. Check it out! https://github.com/aacitelli/openapi-endpoint-trimmer

this looks great ! 🙏 feel free to make a PR here if you want to promote it in the README for that use case, which is probably a common one

commented

Sure, taking care of it now. Expect a PR to README.md in a bit.