Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
@scalar/cli
Advanced tools
Command-line interface to work with OpenAPI files
npx @scalar/cli help
If you really want to become friends you should install the CLI:
npm -g install @scalar/cli
Otherwise just prefix all commands with npx @scalar/cli
instead of scalar
. That’s fine, too.
The given JSON file will be formatted with Prettier.
scalar format
To check whether your OpenAPI file adheres to the Swagger 2.0, OpenAPI 3.0 or OpenAPI 3.1 specification, run the following command:
scalar validate
To quickly share an OpenAPI file or reference with someone, you can use the share command:
scalar share
This will upload your OpenAPI file to the Scalar Sandbox to give you a public reference URL and a public URL to your OpenAPI JSON file.
We can even mock your API, and it’s just one command:
scalar mock
This will boot up a server on port 3000 which gives you an API returning the dummy data according to your schema.
If you’d like to watch for file changes (to the OpenAPI file), do it like this:
scalar mock openapi.json --watch
You can also change the port like this:
scalar mock openapi.json --watch --port 8080
Some OpenAPI files reference other files from the file system or an URL. You can bundle those files and make them a single file:
scalar bundle openapi.json --output bundle.json
If you don’t provide an output
file name, the input file will be overwritten.
If you’re tired of passing the file name again and again, just configure it once:
scalar init
This will create a scalar.config.json
file for you. All commands will use the configured OpenAPI file by default.
If you want to check which version of the CLI is installed, just run this:
scalar --version
scalar --help
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
Set up the development environment:
pnpm install
pnpm @scalar/cli --version
To symlink the package and use it globally on your machine:
pnpm cli:link
scalar --version
FAQs
A command-line interface to work with OpenAPI files
The npm package @scalar/cli receives a total of 557 weekly downloads. As such, @scalar/cli popularity was classified as not popular.
We found that @scalar/cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.