Giter Site home page Giter Site logo

pitmobboss1 / redocly-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tatomyr-test/redocly-cli

1.0 0.0 0.0 16.89 MB

⚒️ Redocly CLI (aka OpenAPI CLI) toolbox with rich validation and bundling features.

License: MIT License

JavaScript 16.44% TypeScript 83.34% HTML 0.06% Handlebars 0.05% Dockerfile 0.12%

redocly-cli's Introduction

Redocly CLI toolset

Redocly CLI (fka OpenAPI CLI) toolbox with rich validation and bundling features.

build and test npm (scoped) NPM

OpenAPI 3 CLI toolset

Features

Currently, @redocly/cli supports these features:

  • Multi-file validation. No need to bundle your file before validation.
  • Lightning-fast validation. Lint a 1 MB file in less than one second.
  • Built-in rules for common validations.
  • Configurable severity levels for each rule.
  • Human-readable error messages with codeframes and stylish format options.
  • Intuitive suggestions for misspelled types or references.
  • Easy to implement custom rules.
  • Bundle a multi-file definition into a single file.
  • Decorators to modify a validated definition during bundling.
  • Preview docs for local development.
  • Support for OpenAPI 2 (fka Swagger) and OpenAPI 3.0.
  • Basic support for OpenAPI 3.1

What makes this tool different

  • 💨 It's faster (uses a type tree similar to how linters for programming languages work)
  • 🎯 It's more accurate (working with types is more accurate than working with JSON path)
  • ⚙️ It's highly configurable (comes with a lot of commands and rules)
  • 🛠️ It's more extensible (architected for custom plugins and types)

Usage

Node

npx @redocly/cli lint path-to-root-file.yaml

Alternatively, install it globally with npm:

npm install @redocly/cli -g

Then you can use it as redocly [command] [options], for example:

redocly lint path-to-root-file.yaml

Docker

To give the Docker container access to the OpenAPI definition files, you need to mount the containing directory as a volume. Assuming the OAS definition is rooted in the current working directory, you need the following command:

docker run --rm -v $PWD:/spec redocly/openapi-cli lint path-to-root-file.yaml

To build and run with a local image, run the following from the project root:

docker build -t redocly-cli .
docker run --rm -v $PWD:/spec redocly-cli lint path-to-root-file.yaml

Credits

Thanks to graphql-js and eslint for inspiration of the definition traversal approach and to Swagger, Spectral, and OAS-Kit for inspiring the ruleset.

Development

See CONTRIBUTING.md

redocly-cli's People

Contributors

romanhotsiy avatar knidarkness avatar andriyl avatar jacobator avatar bandantonio avatar tatomyr avatar tatomyr-test avatar adamaltman avatar alexvarchuk avatar antonkozachuk avatar marshevskyy avatar smoliyy avatar slavikbez avatar roman-sainchuk avatar jodywinter avatar ivana-isadora avatar oprysk avatar leocete avatar andrii-tarusin avatar ohorbachevskyi avatar dependabot[bot] avatar antarus66 avatar bohdanpetryshyn avatar swapnilogale avatar and678 avatar volodymyr-rutskyi avatar yarokon avatar prooles avatar mjpieters avatar rkrauskopf avatar

Stargazers

0x2c3a452039ebb9ae053a692510221d46716c553caac178b9a37d330586a433ae 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.