Redocly / redocly-cli

⚒️ Redocly CLI makes OpenAPI easy. Lint/validate to any standard, generate beautiful docs, and more.
https://redocly.com/docs/cli/
MIT License
943 stars 148 forks source link

Spectral rule equivalents #1177

Open lornajane opened 1 year ago

lornajane commented 1 year ago

Is your feature request related to a problem? Please describe.

Users with existing Spectral rulesets want to migrate to Redocly, not all rules have a built-in equivalent

Describe the solution you'd like

A list of substitutions to try. Here's a starter set, these need to be tested and added to our docs. Additions, comments and feedback all gratefully received!

I wonder if it would be helpful to include configurable rule equivalents, like:

rules:
  rule/info-description:
    subject:
      type: Info
      property: description
    assertions:
      defined: true

no-eval:

rules:
  rule/no-eval:
    subject:
      type: any
      property: description
    assertions:
      notPattern: 'eval('

no-script

rules:
  rule/no-script-tag:
    subject:
      type: any
      property: description
    assertions:
      notPattern: '<script'

openapi-tags:

rules:
  rule/openapi-tags:
    subject:
      type: Tag # or maybe TagList ?
    assertions:
      defined: true

operation-tags:

rules:
  rule/operation-tags:
    subject:
      type: Operation
      property: tags
    assertions:
      defined: true
      maxLength: 1 # I guess we already have `operation-singular-tag`

(credit to @adamaltman for the list!)

Describe alternatives you've considered

Additional context

adamaltman commented 1 year ago

Maybe add to the cookbook?