Skip to content

Does not validate exemples correctly with no-invalid-media-type-examples (ref resolving problem) #1369

@Apoorva64

Description

@Apoorva64

Describe the bug

When linting with the rule no-invalid-media-type-examples. Redocly throws errors when it shouldn't.
More precisely it dosen't resolve the ref when validating the json schema.

To Reproduce
Steps to reproduce the behavior:

  1. Given this redocly.yaml file
extends:
  - recommended
apis:
  main:
    root: ./openapi.yaml
  1. And this OpenAPI file(s)
    example.zip

  2. Run this command with these arguments... redocly lint

  3. See error

[1] paths/owner@{owner}@car/get.yaml:15:17 at #/responses/200/content/application~1json/examples/$ref/value

Example value must conform to the schema: type must be array.

13 |           $ref: ../../components/schemas/Car.yaml
14 |       examples: 
15 |         $ref: ./examples/get/200/_index-json.yaml
16 | '404':
17 |   description: Not Found

referenced from paths/owner@{owner}@car/get.yaml:10:9 at #/responses/200/content/application~1json

Warning was generated by the no-invalid-media-type-examples rule.

Expected behavior
The error should not show as the example is correct. Futhermore if you bundle the api it correctly verifies the example.

OpenAPI description

OpenApi version 3.0.0. It is a simple API made to test this case

Redocly Version(s)

1.6.0

Node.js Version(s)

18

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions