@dweber019/backstage-plugin-api-docs-spectral-linter
TypeScript icon, indicating that this package has built-in type declarations

0.2.12 • Public • Published

Spectral Linter Plugin

Welcome to the Spectral Linter plugin!

This plugin allows you to lint (validate) API's with rule sets.

Spectral linter

Setup

  1. Install this plugin:
# From your Backstage root directory
yarn --cwd packages/app add @dweber019/backstage-plugin-api-docs-spectral-linter

Entity Pages

  1. Add the plugin as a tab to your Entity pages:
// In packages/app/src/components/catalog/EntityPage.tsx
import { EntityApiDocsSpectralLinterContent, isApiDocsSpectralLinterAvailable } from '@dweber019/backstage-plugin-api-docs-spectral-linter';

...

const apiPage = (
  <EntityLayout>
    {/* other tabs... */}
    <EntityLayout.Route if={isApiDocsSpectralLinterAvailable} path="/linter" title="Linter">
      <EntityApiDocsSpectralLinterContent />
    </EntityLayout.Route>
  </EntityLayout>
  1. Add backstage.io/spectral-ruleset-url annotation to your catalog-info.yaml:
metadata:
  annotations:
    backstage.io/spectral-ruleset-url: <url-to-your-yaml-or-json-file>

Default rule sets

You can provide default rule sets in you app-config.yaml like this

spectralLinter:
  openApiRulesetUrl: <url-to-your-yaml-or-json-file>
  asyncApiRulesetUrl: <url-to-your-yaml-or-json-file>

Local development

There is a local setup at plugins/api-docs-spectral-linter/dev which can be started with yarn --cwd plugins/api-docs-spectral-linter start from the root.

Readme

Keywords

none

Package Sidebar

Install

npm i @dweber019/backstage-plugin-api-docs-spectral-linter

Weekly Downloads

562

Version

0.2.12

License

MIT

Unpacked Size

36.1 kB

Total Files

10

Last publish

Collaborators

  • dweber019