Redocly / Redocly/redocly-cli

Support a configurable version of redoc.standalone.js for preview-docs

Open
#734 5 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.
At times, the latest version of the redoc.standalone.js bundle can contain bugs. This is the situation right now, with 2.0.0-rc.72, which has several bugs. Preview-docs references https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.js, with no option to override it.

Describe the solution you'd like
An additional optional parameter to specify the standalone.js version.
For example redocly preview-docs ./petstore.yaml --standalone-version=2.0.0-rc.58

This would result in https://cdn.jsdelivr.net/npm/redoc@2.0.0-rc.58/bundles/redoc.standalone.js being used instead of https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.js.

Describe alternatives you've considered
I have not found other good alternatives. When publishing the documentation, we can always point to the desired version, but we would like to have the same experience when designing and testing the documentation using preview-docs.

Additional context
The affected code is to be found here:
https://github.com/Redocly/redocly-cli/blob/67c53ee8e75a6ca002d6aaaa889adcca0507d8bd/packages/cli/src/commands/preview-docs/preview-server/preview-server.ts#L37

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 with packages/cli/src/commands/preview-docs/preview-server/preview-server.ts at the referenced line, then trace how preview-docs options are defined and passed into the preview server. Add the optional standalone version path described in the issue, and verify that the generated URL uses it instead of the latest bundle when provided while preserving the current default.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.