This plugin is a wrapper for the tool Spectral, a linter for OpenApi schemas. It supports all Jetbrains IDEs starting at version 2020.3.
Automatic linting of your OpenApi specifications and highlighting in your editor
Specify your own ruleset in the plugins settings,
under Preferences -> Tools -> Spectral -> Ruleset
. There you can select 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
The default ruleset comes bundled with the plugin and uses Spectrals recommended OAS ruleset.
The customization of file matching is possible under Preferences -> Tools -> Spectral -> Included files
. By
default, every JSON file will be linted with default pattern **.json
by the plugin, when json file is opened. You
can adjust this to **openapi*.json
(e.g. matches openapi.json), so that some other json files,
such as composer. json
, package.json
, will not be included and linted automatically.
The latest version of the plugin is available on the Jetbrains marketplace. To install it you can follow these steps:
- Open your Jetbrains IDE
- Go to Preferences -> Plugins and search for "Spectral"
- Click install on the first result
- Checkout this repository
- Run ./gradlew buildPlugin
- Install the generated archive under build/distributions/spectral-intellij-plugin*.zip in your IDE ( See Install plugin from disk)
To debug the plugin you can open the IDE logs under Help -> Show log in Finder/Explorer. There you will find the logfile of your IDE containing detailed information about what the plugin is doing under the category "Spectral".
If you need even more information, you can enable debug logging in your IDE by going to Help -> Diagnostic Tools -> Debug Log Settings. Just add a line containing "Spectral" in there and you will receive even more detailed information in the before mentioned logfile.