Skip to content

Ignored errors show up when referenced elsewhere #620

Open
@dirkhicke

Description

@dirkhicke

I'm getting inconsistent results when linting the following spec

openapi: 3.0.1
info:
  title: '[LOCAL] Microsoft ASP.NET Core'
paths:
  /test:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    InvalidParameter:
      type: object
      properties:
        name:
          pattern: ^[a-zA-Z0-9]{0,20}$
          type: string
          nullable: true
        reasons:
          type: array
          items:
            type: string
          nullable: true
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        invalidParameters:
          type: array
          items:
            $ref: '#/components/schemas/InvalidParameter'
          nullable: true

with only owasp-string-restricted enabled and this ignore file

owasp-string-restricted:
  - $.components.schemas['InvalidParameter'].properties['reasons'].items

Most of the time linting passes but occasionally (1 out of 4 runs or so) it results in an error for path $.components.schemas['ProblemDetails'].properties['invalidParameters'].items.properties['reasons'].items or $.paths['/test'].get.responses['200'].content['text/json'].schema.properties['invalidParameters'].items.properties['reasons'].items or similar ones (paths where the ignored path is $ref'd).

Is there any way to work around this and only show errors for the component itself but not paths and components that reference the one with the error? Even showing the same error for all references every time would help.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions