Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema usage not checked inside patternProperties #1447

Open
samuel-deal-tisseo opened this issue Feb 16, 2024 · 1 comment
Open

Schema usage not checked inside patternProperties #1447

samuel-deal-tisseo opened this issue Feb 16, 2024 · 1 comment
Labels
p3 Type: Bug Something isn't working

Comments

@samuel-deal-tisseo
Copy link

What happened?

Within an OpenAPI definition file, the extension falsely reports a component schema to not be used

Minimal reproducible OpenAPI snippet

openapi: 3.1.0
tags:
- name: minimal
  description: Minimal endpoint
servers:
- url: https://redocly.com/api
  description: fake
info:
  description: "Example for bug"
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  title: "Redocly bug example"
  version: 2.0.0
paths:
  /ping:
    get:
      description: "Some endpoint"
      summary: "some_endpoint"
      operationId: ping
      security:
      - OpenIdConnectSecurityScheme:
        - account:view_profile
      tags:
      - "minimal"
      parameters: []
      responses:
        '200':
          description: result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MainSchema'
              example:
                data:
                  "abc:123":
                    - label: "some game"
        '400':
          description: result
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    minLength: 1
                    description: "Error description label"
                    example: "Invalid request"
                required:
                - error
components:
  schemas:
    ChildSchema:
      type: object
      properties:
        label:
          type: string
          minLength: 1
          description: "Some label"
          example: "hello world"
      required:
      - label
    MainSchema:
      type: object
      properties:
        data:
          type: object
          description: ""
          patternProperties:
            "^[a-z]+:[0-9]+$":
              description: ""
              type: array
              items:
                $ref: '#/components/schemas/ChildSchema'
          additionalProperties: false
      required:
      - data
  securitySchemes:
    OpenIdConnectSecurityScheme:
      type: openIdConnect
      openIdConnectUrl: https://redocly.com/.well-known/openid-configuration
      description: 'OIDC token'

Screenshots

redoclky_ext_bug

Additional context

  • VSCode Version: 1.86.2 (user setup)
  • VSCode Commit: 903b1e9d8990623e3d7da1df3d33db3e42d80eda
  • OS: Windows_NT x64 10.0.19045
  • Redocly v0.4.2
@samuel-deal-tisseo samuel-deal-tisseo added the Type: Bug Something isn't working label Feb 16, 2024
@tatomyr
Copy link
Contributor

tatomyr commented Feb 19, 2024

@samuel-deal-tisseo thank you for reporting this!
As a workaround, you can suppress that issue explicitly by using ignore file.

I'm transferring the issue to the Redocly CLI repo as this is related to the linter and not to the extension itself.

@tatomyr tatomyr transferred this issue from Redocly/redocly-vs-code Feb 19, 2024
@tatomyr tatomyr added the p3 label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3 Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants