Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redocly decorators not working #1721

Open
2 tasks done
waynebloss opened this issue Jun 22, 2024 · 1 comment
Open
2 tasks done

Redocly decorators not working #1721

waynebloss opened this issue Jun 22, 2024 · 1 comment
Labels
enhancement New feature or request openapi-ts Relevant to the openapi-typescript library

Comments

@waynebloss
Copy link

waynebloss commented Jun 22, 2024

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

@waynebloss waynebloss added bug Something isn't working openapi-ts Relevant to the openapi-typescript library labels Jun 22, 2024
@waynebloss
Copy link
Author

The workaround that I detailed in #1682 works now, with a small change. (The workaround is basically to just use redocly bundle to produce an intermediate schema file that gets fed into openapi-typescript.)

@drwpow drwpow added enhancement New feature or request and removed bug Something isn't working labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-ts Relevant to the openapi-typescript library
Projects
None yet
Development

No branches or pull requests

2 participants