Publishing an API
A file or a zip
Section titled “A file or a zip”Drop a spec on a project or Docs in the app, or use Replace file on an API doc. A spec split across files goes up as a .zip: Dockito finds the root, follows its $refs to the other files and publishes one bundled document.
The CLI
Section titled “The CLI”dockito publish openapi.yaml --to team/apisThe CLI reads the file and every file its relative $refs name, bundles them on your machine and publishes one document. Publishing the same file again changes nothing. The reply says the version, the checks and what changed:
v3 (2.3.0 → 2.4.0): 1 breaking, 0 likely, 0 not.ERR GET /projects: param "session" (cookie): now requiredChecks in CI
Section titled “Checks in CI”dockito check runs on your machine; the file never leaves it. With --against, it downloads the published doc and compares:
dockito check openapi.yaml --against bookings-api --format markdown| Exit code | Means |
|---|---|
| 0 | Clean |
| 1 | Check errors (or a $ref that points nowhere) |
| 2 | The file differs from the published doc |
| 3 | Breaking changes against the published doc |
The highest wins. --json prints the same as JSON; --format markdown prints a table for a pull request comment.
A GitHub Actions workflow that comments on each pull request, and publishes on merge:
on: pull_request: push: branches: [main]jobs: api: runs-on: ubuntu-latest env: { DOCKITO_TOKEN: "${{ secrets.DOCKITO_TOKEN }}" } steps: - uses: actions/checkout@v4 - run: npm install -g dockito - if: github.event_name == 'pull_request' run: dockito check openapi.yaml --against ${{ vars.DOCKITO_API_DOC }} --format markdown > check.md || true - if: github.event_name == 'pull_request' run: gh pr comment ${{ github.event.number }} --body-file check.md env: { GH_TOKEN: "${{ github.token }}" } - if: github.event_name == 'push' run: dockito publish openapi.yaml --to ${{ vars.DOCKITO_API_FOLDER }} -m "${{ github.sha }}"To fail the pull request on a breaking change, drop || true (exit code 3 fails the step). A token with Publish on the workspace goes in DOCKITO_TOKEN.