redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

Support per-format configurable rules

Open lornajane opened this issue 1 year ago • 2 comments

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

We have a (very cool!) configurable rules feature that also works well for all the different formats we support (OpenAPI, AsyncAPI, Arazzo - of various versions). However, the rules defined in a configuration file apply to all API descriptions of all formats when linting. It would be better to be able to define rules for each API description format/version to avoid having to pre-process, repeat-define rules in per-api configurations, or use multiple config files (these are the existing alternatives as I see them).

Describe the solution you'd like

I would like us to support configurable rules alongside per-format rules configuration (which exists and is under renaming discussion in #1723 ):

oas3_1Rules:
  rule/info-description:
    subject:
      type: Info
      property: description
    assertions:
      defined: true
      minLength: 300

Describe alternatives you've considered

Everyone has to write their rules in plugins, so they can be exported for different types and included in the per-format sections of the config file.

Additional context

From a discussion about support and documentation for linting multiple API description formats in a single project with @DmitryAnansky and @tatomyr .

lornajane avatar Sep 10 '24 17:09 lornajane

Currently, all configurable rules are mixed together, even if they are defined under a specific rule section. We have to change the way we group them (probably in groupStyleguideAssertionRules).

tatomyr avatar Sep 11 '24 10:09 tatomyr

I think a unified approach would be better:

https://github.com/Redocly/redocly-cli/issues/1723#issuecomment-2396894803

adamaltman avatar Oct 07 '24 13:10 adamaltman