Redocly / redocly-vs-code

Redocly VS Code extension
35 stars 6 forks source link

Error output is not formed correctly in Problems tab #54

Open jeremyfiel opened 11 months ago

jeremyfiel commented 11 months ago

What happened?

Recently, the VS Code output is not formatted correctly. I'm not sure exactly when it started, but it seems to have been from last week.. 03/10/23+

openapi: 3.0.3
info:
  title: blah
  version: 1.1.0
paths:
  /test/api:
    get:
      parameters: 
        - name: jeremy
          in: query
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "../../../common/shared/confirm-message-schema_v03.json"
    post:
      requestBody:
        $ref: "#/components/requestBodies/jeremy"
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: "schemas/test-schema_v01.json"
              examples: 
                example: 
                  externalValue: "./examples/example.json"
                example1:
                  $ref: "./not-schemas/test-schema_v01.json"
components:
  requestBodies:
    jeremy:
      required: true
      content:
        application/json:
          schema:
            $ref: "./common/shared/-schema_v01.json"
  schemas:
    jeremy:
      type: object
      properties:
        test:
          $ref: "jeremy-test"

Screenshots

two diff examples of output from different files.

image image

Additional context

Last released
2023-9-20, 10:16:31
Last updated
2023-9-20, 20:18:54
jeremyfiel commented 11 months ago

I found a configurable rule is causing this behavior

  rule/header-param-exists:
    subject:
      type: Parameter
      property: in
    where:
      - subject:
          type: Operation
          property: parameters
        assertions:
          defined: true
    assertions:
      const: header

I was playing around with trying to find a solution to https://github.com/Redocly/redocly-cli/pull/1286

tatomyr commented 11 months ago

Thank you @jeremyfiel for reporting this!

RomanHotsiy commented 10 months ago

@jeremyfiel so if you remove the configurable rule the formatting gets back to normal?

jeremyfiel commented 10 months ago

Yes, something with the reporting and the way this rule is written causes the invalid output

jeremyfiel commented 9 months ago

@RomanHotsiy I found this happens again with this new rule I was testing:

The formatting issue seems to be in both VSC and the cli output

rules:
  rule/operation-tags-must-be-defined:
  severity: error
  subject:
    type: Operation
  assertions:
    required:
      - tags

image

image

jeremyfiel commented 7 months ago

@RomanHotsiy @tatomyr

I think I found the root cause of this formatting error. If I omit message in the configurable rule, it creates this formatting error.

tatomyr commented 7 months ago

@jeremyfiel I think it has something to do with OS. On Mac I get correct problems' output formatting:

Screenshot 2024-01-19 at 20 19 14

Do you use Windows?

jeremyfiel commented 7 months ago

I do use windows. But if you remove the message property it doesn't give you incorrect formatting?

tatomyr commented 7 months ago

Yes, this is without the message property.