kubb-labs / kubb

The ultimate toolkit for working with APIs.
https://kubb.dev
MIT License
686 stars 58 forks source link

Include, Exclude, experimentalFilters not working for pluginOas, pluginTs, pluginZod #1088

Closed LukeMauve-Lawrence closed 3 weeks ago

LukeMauve-Lawrence commented 2 months ago

What version of kubb is running?

2.23.3

What platform is your computer?

MacOS

What version of external packages are you using(@tanstack-query, MSW, React, Vue, ...)

"@kubb/cli": "^2.23.3", "@kubb/core": "^2.23.3", "@kubb/swagger-client": "^2.23.3", "@kubb/swagger-tanstack-query": "^2.23.3", "@kubb/swagger-zod": "^2.23.3",

What steps can reproduce the bug?

Using the Include/Exclude field in [pluginTs, pluginZod]: (Tried with "operationId", "method" on both include and exclude). Same object works perfectly fine on "pluginTanstackQuery" and "pluginClient" E.g. include: [ { type: "operationId", pattern: "getUsers" }, { type: "operationId", pattern: "getUser" }, ],

pluginOas "experimentalFilter" not working either, tried filtering with "operationIds" and "methods"

How often does this bug happen?

Every time

What is the expected behavior?

To filter in/out the specified types and zod schemas based on the given filters

Swagger/OpenAPI file?

No response

Additional information

No response

stijnvanhulle commented 2 months ago

include and exclude on the TypeScript and Zod plugins do not work for schemas and types. For that, we started with a new approach(see experimentalFilter) that will replace the include and exclude in v3.

experimentalFilter should normally work because that one will filter out the items and create a new swagger file to be passed to Kubb. If that is not the case, then we have a bug.

LukeMauve-Lawrence commented 2 months ago

experimentalFilter seems to only be present on the Oas plugin as of my current version (2.23.3). However, it does not seem to be filtering out any of the json generated schemas. I've tried using the operationIds and methods experimentalFilters with no luck thus far.

stijnvanhulle commented 3 weeks ago

@LukeMauve-Lawrence I have removed experimentalFilter and experimentalSort out of Kubb(https://github.com/kubb-labs/kubb/pull/1234).

I would suggest using openapi-format directly(before passing your Swagger/OpenAPI to kubb). We used that library before but making it part of Kubb makes it hard to keep it up to date and also not to break the internal Oas generator.