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

Wrong report position on `path-excludes-patterns` rule

Open tatomyr opened this issue 3 years ago • 3 comments

Describe the bug

Rule path-excludes-patterns reports on PathItem value instead of a key when referencing the PathItem value.

To Reproduce Steps to reproduce the behavior:

  1. Given this .redocly.yaml file:
styleguide: 
  extends: []
  rules: 
    path-excludes-patterns: 
      severity: error
      patterns:
        - \/WRONG

  1. And this OpenAPI file(s)
# openapi.yaml
openapi: 3.0.0
paths:
  '/WRONG':
    $ref: value.yaml
# value.yaml
get:
  summary: wrong get
  1. Run this command with these arguments... redocly lint openapi.yaml
  2. See error

Expected behavior

It should report on the PathItem key (e. g. /WRONG:) as it does for not referenced paths items.

Redocly Version(s) 1.0.0-beta.105

Node.js Version(s) v16.14.0

tatomyr avatar Aug 04 '22 11:08 tatomyr

I wonder if we could deprecate this rule in favour of a custom rule. This will work even better:

rules:
  rule/path-exclude:
    subject: 
      type: Paths
    assertions: 
      notPattern: \/WRONG

@RomanHotsiy, @lornajane thoughts?

tatomyr avatar Jan 04 '24 16:01 tatomyr

The configurable rule looks like a better solution to me. How do we deprecate rule though? How about publishing this as a cookbook recipe and linking to it from the changelog, adding a deprecation notice to the config linting if someone is using this rule?

lornajane avatar Jan 05 '24 13:01 lornajane

Added the docs: https://github.com/Redocly/redocly-cli-cookbook/pull/21.

tatomyr avatar Jan 09 '24 20:01 tatomyr