redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

Remove unused components removes used security schemes

Open adamaltman opened this issue 3 years ago • 1 comments

Describe the bug

--remove-unused-components removes security schemes defined in components through references.

To Reproduce Steps to reproduce the behavior:

  1. Clone or pull against rebilly/api-definitions and switch to the feat/bundler branch.
  2. Run redocly bundle --remove-unused-components core@latest -o dist/core.yaml
  3. See error

Expected behavior

I expected it to work.

Logs

➜  api-definitions git:(feat/bundler) redocly bundle --remove-unused-components core@latest -o dist/core.yaml
bundling openapi/openapi.yaml...
[1] openapi/openapi.yaml:44:3 at #/components/parameters/integrationLabel/schema

Can't resolve $ref

42 |
43 | components:
44 |   securitySchemes:
45 |     JWT:
 … |     < 8 more lines >
54 |       $ref: components/securitySchemes/CustomerJWT.yaml
55 |
56 | tags:

Error was generated by the bundler rule.


[2] openapi/openapi.yaml:44:3 at #/components/schemas/PurchaseBumpOfferList/items

Can't resolve $ref

42 |
43 | components:
44 |   securitySchemes:
45 |     JWT:
 … |     < 8 more lines >
54 |       $ref: components/securitySchemes/CustomerJWT.yaml
55 |
56 | tags:

Error was generated by the bundler rule.


[3] openapi/openapi.yaml:44:3 at #/components/schemas/UpcomingInvoiceItemCollection/items

Can't resolve $ref

42 |
43 | components:
44 |   securitySchemes:
45 |     JWT:
 … |     < 8 more lines >
54 |       $ref: components/securitySchemes/CustomerJWT.yaml
55 |
56 | tags:

Error was generated by the bundler rule.


❌ Errors encountered while bundling openapi/openapi.yaml: bundle not created (use --force to ignore errors).

OpenAPI definition 3.0

Redocly Version(s) 1.0.0-beta.114

Node.js Version(s) 16

Additional context n/a

adamaltman avatar Nov 19 '22 18:11 adamaltman