GithubHelp home page GithubHelp logo

emiliosp / spectral Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stoplightio/spectral

0.0 1.0 0.0 9.18 MB

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v2 & v3.

Home Page: https://stoplight.io/spectral

License: Apache License 2.0

TypeScript 98.25% JavaScript 0.93% Shell 0.11% Dockerfile 0.26% HTML 0.45%

spectral's Introduction

Spectral logo

CircleCI NPM Downloads Treeware (Trees)

A flexible JSON/YAML linter, with out of the box support for OpenAPI v2/v3 and AsyncAPI v2.

Demo of Spectral linting an OpenAPI document from the CLI

Features

  • Create custom rules to lint JSON or YAML objects
  • Ready-to-use rules to validate and lint:
    • OpenAPI v2 and v3 documents
    • AsyncAPI v2 documents
  • Use JSON path to apply rules to specific parts of your objects
  • Built-in set of functions to help create custom rules. Functions include pattern checks, parameter checks, alphabetical ordering, a specified number of characters, provided keys are present in an object, etc.
  • Create custom functions for advanced use cases
  • Validate JSON with Ajv

License

Spectral is 100% free and open-source, under Apache License 2.0.

Installation

npm install -g @stoplight/spectral

# OR

yarn global add @stoplight/spectral

Find more installation methods in our documentation.

This package is Treeware so if you would like to thank us for creating it, we ask that you buy the world a tree.

Documentation

Take a look at our getting started documentation, then peek through some of our guides:

FAQs

How is this different to AJV

Ajv is a JSON Schema validator, and Spectral is a JSON/YAML linter. Instead of just validating against JSON Schema, it can be used to write rules for any sort of JSON/YAML object, which could be JSON Schema, or OpenAPI, or anything similar. Spectral does expose a schema function that you can use in your rules to validate all or part of the target object with JSON Schema (we even use Ajv used under the hood for this), but that's just one of many functions.

I want to lint my OpenAPI documents but don't want to implement Spectral right now.

No problem! A hosted version of Spectral comes free with the Stoplight platform. Sign up for a free account here.

What is the difference between Spectral and Speccy

Speccy was a great inspiration for Spectral, but was designed to work only with OpenAPI v3. Spectral can apply rules to any JSON/YAML object (including OpenAPI v2/v3 and AsyncAPI). It's mostly been abandoned now, and is JavaScript not TypeScript.

Integrations

Contributing

If you are interested in contributing to Spectral, check out CONTRIBUTING.md.

Thanks

Support

If you need help using Spectral or have a support question, please use GitHub Discussions. It's also a great place to share your rulesets, or tools that leverage Spectral.

If you have a bug or feature request, please create an issue.

spectral's People

Contributors

arno-di-loreto avatar billiegoose avatar casserni avatar cg-cnu avatar chris-miaskowski avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar github-actions[bot] avatar hpatoio avatar jamesmills avatar jaredk3nt avatar johlo avatar karol-maciaszek avatar kylesykes avatar lag-of-death avatar lornajane avatar m-mohr avatar mallachari avatar marbemac avatar mikeralphson avatar nulltoken avatar p0lip avatar pseudo-su avatar rossmcdonald avatar sagikazarmark avatar sixlive avatar tbarn avatar tillig avatar xvincentx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.