Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stoplight/spectral-cli

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/spectral-cli

[![](https://raw.githubusercontent.com/stoplightio/spectral/develop/docs/img/readme-header.svg)](https://stoplight.io/api-governance?utm_source=github&utm_medium=spectral&utm_campaign=readme) [![CircleCI](https://img.shields.io/circleci/build/github/stopl

  • 6.9.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
255K
decreased by-9.21%
Maintainers
2
Weekly downloads
 
Created

What is @stoplight/spectral-cli?

@stoplight/spectral-cli is a command-line tool for validating, linting, and transforming JSON/YAML documents, particularly useful for API specifications like OpenAPI and AsyncAPI. It helps enforce consistency and best practices in API design.

What are @stoplight/spectral-cli's main functionalities?

Linting

Linting is the process of running a program that will analyze code for potential errors. The `lint` command in Spectral checks the provided OpenAPI document (`openapi.yaml`) against predefined or custom rules to ensure it adheres to best practices and standards.

spectral lint openapi.yaml

Custom Rules

Spectral allows users to define their own rulesets in a YAML file. The `-r` option specifies the custom ruleset file (`custom-ruleset.yaml`) to be used for linting the OpenAPI document (`openapi.yaml`).

spectral lint -r custom-ruleset.yaml openapi.yaml

Transforming Documents

Spectral can transform documents based on rules. The `transform` command processes the input document (`openapi.yaml`) and outputs the transformed document (`transformed.yaml`).

spectral transform openapi.yaml -o transformed.yaml

Validating Documents

The `validate` command checks the provided document (`openapi.yaml`) for structural correctness and adherence to the specified format (e.g., OpenAPI, AsyncAPI).

spectral validate openapi.yaml

Other packages similar to @stoplight/spectral-cli

FAQs

Package last updated on 25 Jul 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc