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

Improve error output for this case, invalid rule fails

Open jeremyfiel opened this issue 9 months ago • 1 comments

https://github.com/Redocly/redocly-cli/blob/35fd19861dadc6670cfe724ed22e3944dda0b38d/packages/core/src/rules/common/assertions/utils.ts#L88

How can we improve this error output? Is there some way to reference the rule that is failing?

The extension completely fails when this error is encountered, is there a way to log the error but continue validation? The other option may be to output a notification in VS Code for those users.

I incorrectly used the property keyword with defined: true and a sibling disallowed assertion on this rule. changing it to required: ["get"] and removing property fixes the issue

rules:
  rule/paths-meta-must-only-define-get-operation:
    severity: error
    message: '"/meta" MUST only define a GET operation'
    subject:
      type: PathItem
      matchParentKeys: /\/meta$/
      property: get
    assertions:
      defined: true
      disallowed:
        - post
        - put
        - patch
        - delete
openapi: 3.0.4
info:
  title: test
  version: 1.0.0
paths:
  '/thing/meta':
     delete: 
      summary: thing meta
      responses:
        '204':
          description: No Content

jeremyfiel avatar Mar 21 '25 16:03 jeremyfiel

Thank you for reporting the issue.

DmitryAnansky avatar Apr 04 '25 14:04 DmitryAnansky