Redocly / Redocly/redocly-cli

Add an option to configure batch size for Promise.all for resolveDocument function

Open
#1,399 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

p3 Type: Enhancement
Dominant language
TypeScript
Stars
1.5k
Forks
228
Avg merge
1d 14h
Merged PRs (30d)
48

Description

Is your feature request related to a problem? Please describe.

We have a huge API definition, with more than 2 thousand YAML files with refs. When we run npx @redocly/cli lint command in AWS lambda we faced with File descriptors limitation and as a result, a lint command throws an error. It could be fixed if we can pass MAX_BATCH_SIZE_FILES_LIMIT to @redocly/cli lint command.

Screenshot 2024-01-19 at 11 34 07 Screenshot 2024-01-19 at 11 33 00

image (7)

Describe the solution you'd like

Add an option to configure MAX_BATCH_SIZE_FILES_LIMIT. It should be unlimited by default.

Code place where we should apply this configuration:
resolved = await Promise.all(resolvePromises);

Describe alternatives you've considered

Do not add this configuration and just pre-bundle OpenAPI definition either locally or with CI/CD.

Additional context

Front logo Front conversations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/core/src/resolve.ts at the Promise.all call around line 233, then trace how the npx @redocly/cli lint command receives configuration. Add a configurable MAX_BATCH_SIZE_FILES_LIMIT with unlimited behavior by default, and verify that large YAML reference sets can be resolved without exceeding file-descriptor limits.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, performance
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.