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

Support .redocly.yaml for options for redoc-cli #1785

adeschamps opened this issue May 19, 2020 · 5 comments · Fixed by #1981

Support .redocly.yaml for options for redoc-cli #1785

adeschamps opened this issue May 19, 2020 · 5 comments · Fixed by #1981


Copy link


When I preview docs with openapi preview-docs, it uses the theme defined in my .redocly.yaml file. Is there a way to render a static HTML file, much like redoc-cli bundle, that reads the theme from that file?

Copy link

ArtFlag commented Jun 3, 2020

Same question here. I'm currently switching between openapi and redoc-cli to validate/bundle/publish because I do not know where the HTML is after preview-docs.

It would we great to be able to output the bundled HTML to a given folder.

Copy link

rohit-gohri commented Jun 23, 2020

So the referenceDocs section in .redocly.yaml can be passed to redoc-cli bundle --options <stringified JSON|path to JSON>.

Using js-yaml I have this setup working:

A script file to convert yaml to json.

// preDocs.js
const yaml = require('js-yaml');
const fs = require('fs');

// Get document, or throw exception on error
try {
  const redocly = yaml.safeLoad(fs.readFileSync('.redocly.yaml', 'utf8'));
  const docsConfig = redocly.referenceDocs;
  fs.writeFileSync('.redoc.json', JSON.stringify(docsConfig, null, 2));
catch (e) {
# Bundle Docs
node preDocs.js && redoc-cli bundle api.v0.yaml --options .redoc.json

And add .redoc.json to .gitignore

Adding these to package.json makes it much easy:

"scripts": {
	"predocs": "node preDocs.js",
	"docs": "redoc-cli bundle api.v0.yaml --options .redoc.json",
	"docs:preview": "openapi preview-docs api.v0.yaml"

I can do npm run docs now to build and npm run docs:preview to preview.

@RomanHotsiy RomanHotsiy self-assigned this Jun 27, 2020
Copy link

This doesn't answer initial question, you still need the redoc-cli package to create static file and @redocly/openapi-cli to lint schema.

Both packages can serve preview.

@RomanHotsiy RomanHotsiy transferred this issue from Redocly/redocly-cli Nov 1, 2021
@RomanHotsiy RomanHotsiy changed the title Render static docs Support .redocly.yaml for options for redoc-cli Nov 1, 2021
Copy link

Same issue here, is there any plan to support .redocly.yaml file as input for redoc-cli anytime soon?

Copy link

Yes. We plan to add support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

6 participants