Skip to content

Commit 50a7ad7

Browse files
AllieJonssonAlfred Jonsson
and
Alfred Jonsson
authoredMay 14, 2024··
fix: fix type of filters.tags, add regexp to docs (#1369)
Co-authored-by: Alfred Jonsson <alfred.jonsson@decerno.se>
1 parent dc18a87 commit 50a7ad7

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed
 

‎docs/src/pages/reference/configuration/input.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,25 @@ Example of transformer <a href="https://github.com/anymaniax/orval/blob/master/s
6767

6868
Type: `Object`.
6969

70+
Default Value: `{}`.
71+
7072
If specified, Orval only generates the endpoints after applying the filter.
71-
It is possible to filter on `tags`.
7273

73-
For instance the example below only generates the endpoints that contain the tag `pets`.
74+
#### tags
75+
76+
Type: Array of `string` or `RegExp`.
77+
78+
Default Value: `[]`.
79+
80+
It is possible to filter on `tags`.
81+
For instance the example below only generates the endpoints that contain the tag `pets` or matches the regular expression `/health/`.
7482

7583
```js
7684
module.exports = {
7785
petstore: {
7886
input: {
7987
filters: {
80-
tags: ['pets'],
88+
tags: ['pets', /health/],
8189
},
8290
},
8391
},

‎packages/core/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export type InputOptions = {
197197
converterOptions?: swagger2openapi.Options;
198198
parserOptions?: SwaggerParserOptions;
199199
filters?: {
200-
tags?: string[];
200+
tags?: (string | RegExp)[];
201201
};
202202
};
203203

‎packages/orval/src/import-specs.ts

-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export const importSpecs = async (
6565
if (isObject(input.target)) {
6666
return importOpenApi({
6767
data: { [workspace]: input.target },
68-
// @ts-expect-error // FIXME
6968
input,
7069
output,
7170
target: workspace,
@@ -86,7 +85,6 @@ export const importSpecs = async (
8685

8786
return importOpenApi({
8887
data,
89-
// @ts-expect-error // FIXME
9088
input,
9189
output,
9290
// @ts-expect-error // FIXME

0 commit comments

Comments
 (0)
Please sign in to comment.