Validate, lint and bundle
The RapiDoc CLI’s spec commands work on a whole portal: run in a portal folder, they take the APIs from rapidoc.config.*. Every option, the output formats and the lint rules are in the RapiDoc CLI docs; this page covers what is particular to a portal.
npx rapidoc validate # every local OpenAPI spec in apis:, and the Arazzo specsnpx rapidoc lint # every API in rapidoc.config.*npx rapidoc bundle --api orders -o dist/orders.yamlA portal folder needs @rapidoc/portal installed, to read the apis: list; one spec or a URL needs @rapidoc/cli alone.
Validate
Section titled “Validate”rapidoc validate checks every local OpenAPI spec in apis: strictly against the OpenAPI Specification (required fields and types, path parameters, $refs), with file, line and column for each error. It also warns about operations without an operationId (their page URLs change when their summary is edited), and checks that the steps of each Arazzo spec resolve against your APIs. Every option.
A valid spec can still make a poor portal: operations without an operationId get page URLs that change when their summary is edited, bodies without examples leave Try and the mock server with nothing to show, tags that aren’t declared have no description for their sidebar group. rapidoc lint finds those, after running validate’s check. The rules and options; rapidoc lint --rules prints them too.
Set severities in rapidoc.config.yaml, for every API or per API. Most specific wins: --rule on the command line, then the API’s entry under lint.apis, then lint.rules, then the defaults.
lint: rules: operation-description: warn no-unused-components: off apis: legacy: # an API that can't meet a rule yet operation-operationId: offBundle
Section titled “Bundle”rapidoc bundle writes a spec split over several files as one document: every $ref to another file becomes a component. The portal itself follows $refs across files, so it doesn’t need this; code generators, gateways and review tools often do. --api <id> bundles the spec of an API in rapidoc.config.* (its default version) instead of a file. Every option.
validate and lint exit with code 1 on errors (or warnings, with --strict), so they can gate a pull request; lint exits with 2 for a wrong rule name or severity. Projects created with npm create rapidoc have npm run validate.
# in a job's steps:- run: npm ci- run: npx rapidoc validate- run: npx rapidoc lint --strict- run: npx rapidoc buildTo see the problems on the pull request itself, upload a SARIF report to GitHub code scanning:
permissions: security-events: write# in a job's steps:- run: npx rapidoc validate --format sarif > rapidoc.sarif || true- uses: github/codeql-action/upload-sarif@v3 with: sarif_file: rapidoc.sarif