orval-labs / orval

orval is able to generate client with appropriate type-signatures (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification, either in yaml or json formats. 🍺
https://orval.dev
MIT License
3.18k stars 336 forks source link

feat(core): add mode include/exclude to input filters option #1690

Closed jbcam closed 1 week ago

jbcam commented 2 weeks ago

Status

READY

Description

Fix https://github.com/orval-labs/orval/issues/1676

Extend the filters input option by introducing a mode optional parameter to specify if filtering should include or exclude tags or schemas.

Related PRs

List related PRs against other branches:

branch PR
yesyesufcurs:issues/739 link

Todos

Steps to Test or Reproduce

Add a tag that should be filtered out to orval.config:

output: {
    mode: :"exclude"
    tags: ["pets"]
},

Only endpoints that do not contain the tag "pets" will be generated.

melloware commented 2 weeks ago

Running the build now. This looks like a good change.

jbcam commented 2 weeks ago

@jbcam

Thanks for the good reinforcement!

I have just one request. we have tests yaml as a regression test in the tests directory so could you please add a new test case like petstore-filter-exclude-mode to here?

master/tests/configs/default.config.ts#L9-L18

@soartec-lab no problem! should be ok now (and rebased)