openapi-typescript
openapi-typescript copied to clipboard
Redocly decorators not working
Description
I tried using the Redocly filter-in decorator and it was not applied by openapi-typescript.
There was no error
| Name | Version |
|---|---|
openapi-typescript |
7.0.0 |
| Node.js | 20.14.0 |
| OS + version | Linux version 6.6.32-1-MANJARO |
Reproduction
Use a redocly.yaml file with the filter-in decorator which allows you to exclude non-matching operations.
When I use this same redocly.yaml file with the redocly bundle command directly, it produces a new OpenAPI schema file that only includes the desired operation.
I thought that I could workaround this issue by just taking the new filtered OpenAPI schema file produced by my redocly bundle command and feeding that into openapi-typescript instead of the url, but that caused openapi-typescript to freeze. I did not open an issue for the freezing, but you can read about the details of my adventure in #1682 starting here.
redocly.yaml file:
apis:
main:
root: http://localhost:43020/api/v1/docs/json
x-openapi-ts:
output: ./src/api.ts
decorators:
filter-in:
property: operationId
value: [connectRepo]
rules:
operation-operationId-unique: error
operation-parameters-unique: error
path-not-include-query: error
spec: error
Expected result
I should get an output file with only the operations specified by the filter-in decorator.
Checklist
- [X] My OpenAPI schema passes the Redocly validator (
npx @redocly/cli@latest lint) - [X] I’m willing to open a PR (see CONTRIBUTING.md)