This repository was moved to our monorepo: https://github.com/scalar/scalar/tree/main/packages/cli
Command-line interface to work with OpenAPI files
- Format & validate OpenAPI files
- Upload your OpenAPI files to Scalar
- Get a fully mocked API for testing purposes
- Preview your API reference
- Bundle multiple OpenAPI files
npx @scalar/cli help
npm install -g @scalar/cli
scalar --version
scalar init
scalar format openapi.json
scalar validate openapi.json
scalar bundle openapi.json --output bundle.json
scalar reference openapi.json --watch
scalar mock openapi.json --watch
scalar share openapi.json
To validate your OpenAPI file in GitHub Actions, add this workflow:
# .github/workflows/validate-openapi-file.yml
name: Validate OpenAPI File
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Validate OpenAPI File
# Replace `./my-openapi-file.json` with the correct path and filename for your project.
# Or: run `npx @scalar/cli init` and add the config file to your repository.
run: npx @scalar/cli validate ./my-openapi-file.json
We are API nerds. You too? Let’s chat on Discord: https://discord.gg/8HeZcRGPFS
hanspagel |
hwkr |
Contributions are welcome! Read CONTRIBUTING
.
The source code in this repository is licensed under MIT.