liveBook · Manning

Redocly CLI

As explained in Automating API Delivery

Redocly is a toolset for rendering, documenting, validating, and managing APIs described with OpenAPI.

Redocly CLI supports practical transformations of OpenAPI definitions when a single file becomes difficult to maintain or a deployment pipeline needs one assembled artifact. section 8.13.4 section 9.1.1

Use its documented workflow to:

  • Split a large OpenAPI definition into reusable YAML or JSON fragments with configurable output-file naming. section 8.13.4
  • Bundle a multifile definition into one file before publishing or passing it to later pipeline steps. section 9.1.1
  • Combine bundling with filtering, removal of unused components, field sorting, and API linting in a build pipeline. section 9.1.1

Bundle an API definition in CI

Create an output directory, enter the API-definition directory, and run `npx @redocly/cli bundle openapi.yaml --output api.bundled.yaml`; then move the bundled file into `build-output` for subsequent processing.

redocly split product-catalog.oas.yaml --outDir out

Run `redocly split product-catalog.oas.yaml --outDir out` to divide a large definition; inspect the generated fragments because they contain reference objects rather than standard OpenAPI documents. section 8.13.4

How Automating API Delivery covers it

How deep it goes
Explains split and bundle commands with pipeline placement, but defers detailed Redocly configuration and validation behavior.
Examples
Uses product-catalog definitions, the redocly split command, and a GitHub workflow that bundles api.bundled.yaml.
What it assumes
Assumes familiarity with YAML or JSON OpenAPI definitions and basic pipeline file handling.
What you can do after
Operate/configure it to split and bundle OpenAPI files within a build pipeline.
How it connects
Connects OpenAPI definitions with reusable components, API filtering, unused-component removal, field sorting, and API linting.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Automating API Delivery. The section links point to the parts of the book it draws on.