Can you disable certain endpoints from being generated in Tanstack react-query? #3575
Replies: 3 comments
-
|
Yes! You can exclude specific endpoints using the export default {
input: 'path/to/openapi.json',
output: 'src/client',
parser: {
filters: {
operations: {
exclude: ['GET /api/v1/sse', '/^[A-Z]+ \\/api\\/v1\\/sse/']
}
}
},
plugins: ['@tanstack/react-query']
}You can use exact matches like To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Beta Was this translation helpful? Give feedback.
-
|
@Andrew-Chen-Wang That's actually a bug and there's an issue for that, but yes let me add this option too. |
Beta Was this translation helpful? Give feedback.
-
|
@Andrew-Chen-Wang my bad, you can actually do this already by removing classifiers from operations. You can read more about it here https://heyapi.dev/openapi-ts/configuration/parser#hooks-operations {
name: '@tanstack/react-query',
"~hooks": {
operations: {
getKind(operation) {
if (filterOperations(operation)) {
return []; // <- return empty array to skip generating anything
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Can you disable certain endpoints from being generated in Tanstack react-query? Sometimes, I have an endpoint that is SSE, so it creates red squigglies in the react-query.gen.ts file
Beta Was this translation helpful? Give feedback.
All reactions