/spectral-intellij-plugin

IntelliJ plugin for continuous OpenAPI linting using the Spectral OpenAPI linter

Primary LanguageKotlinApache License 2.0Apache-2.0

jetbrains-plugin-template

Build Version Downloads

This plugin is a wrapper for the tool Spectral, a linter for OpenApi schemas.

Installation

  • Using IDE built-in plugin system:

    Settings/Preferences > Plugins > Marketplace > Search for "Spectral" > Install Plugin

  • Manually:

    Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...

Since version 2 of this plugin it is required to have the spectral CLI installed on your system. If you don't have it installed yet make sure to follow this guide: Installing Spectral

Note: The CLI needs to be in your path and executable from the command line.

Features

Automatic linting

Automatic linting of your OpenApi specifications and highlighting in your editor

Customizable Ruleset

Specify your own ruleset in the plugins settings, under Preferences -> Tools -> Spectral -> Ruleset. There you can specify a file on your local machine or just paste the URL of a ruleset available on the internet e.g.: Schwarz IT API linting rules.

Examples:

Customizable file matching

Select the files that will be linted. By default, every file called "openapi.json" or "openapi.yml" will be linted by the plugin when it's opened. You can adjust this in the settings under Preferences -> Tools -> Spectral -> Included files. All paths are relative to the projects working directory.

Examples:

  • openapi.json: Matches the file called "openapi.json" inside the root directory of the project
  • components/**.json: Matches all files inside the directory "components" that end with ".json"

Plugin based on the IntelliJ Platform Plugin Template.