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

Generate all build-docs at once from config.yaml

Open matejsp opened this issue 10 months ago • 7 comments

Describe the problem to be solved Based on the configuration you can specify multiple open api specs and run linter on all of them by default. https://redocly.com/docs/cli/configuration/#example-redocly-configuration-file However when I run it for build-docs it output just the first api.

Describe the solution you'd like I would like it to support the same style as it is for lint for build-docs:

redocly build-docs --config=./config.yaml

Basically it should loop across all apis and generate docs for all of them. It should be noted that output parameter should be added to the config.

Describe alternatives you've considered First we tryed running specs it in for loop with detecting file names using jq command. But it was very slow since we have 140 yamls and it takes 5 minutes to run them all (creating new redoc process each time). Second try was to run them in parallel and it was a lot faster.

Additional context

apis:
  account_activity@v1:
    root: ./folder/account_activity.yaml
    output: ./folder/account_activity.yaml
    theme:
      openapi:
        downloadDefinitionUrl: account_activity.yaml
  account@v1:
    root: ./account.yaml
    output: ./account.html
    theme:
      openapi:
        downloadDefinitionUrl: account.yaml
  api_v2@v1:
    root: ./api_v2/api_v2.yaml
    output: ./api_v2/api_v2.html
    theme:
      openapi:
        downloadDefinitionUrl: api_v2.yaml

matejsp avatar Oct 09 '23 12:10 matejsp

Thanks for the idea! Does it make sense to pick up the filenames automatically based on the api names+versions?

tatomyr avatar Oct 12 '23 13:10 tatomyr

Currently there is output as the parameter when running cmd line ... imho it would be best to have also output in yaml

But picking filesnames automatically based on the api is also possible (but a bit more restrictive) ...

matejsp avatar Oct 12 '23 13:10 matejsp

I am tentatively in favour of looking at adding the docs-output-filename as a per-API configuration and supporting multiple APIs for docs the same way we do for lint and other commands.

lornajane avatar Oct 13 '23 12:10 lornajane

Let's do #1250 first, since it reduces the complexity on this task.

lornajane avatar Oct 26 '23 12:10 lornajane

There should also be a separate option to define where to put a bundled API description file. Looks like the output field fits better to that case. Instead, I suggest to use another name for this case (docs-output? redoc-output? html-output?) Would appreciate suggestions on naming. cc @lornajane, @adamaltman

tatomyr avatar Oct 31 '23 10:10 tatomyr

I raised a priority here.

RomanHotsiy avatar Nov 02 '23 14:11 RomanHotsiy

I think adding docs-output as a config file option is a good way forward. How about docs-output to match the build-docs command? This should be supported in the config file only, not as a command line parameter, because we allow multiple APIs and I can't think of a good way to not make this super confusing.

lornajane avatar Nov 06 '23 11:11 lornajane