Skip to content

External reference is invalid when it appears in object properties #499

@lusingander

Description

@lusingander

Error occurs while loading spec file when references internal object definitions(defined in same file), and references external schema definitions in its properties.

some/dir/openapi.yml

openapi: 3.0.0
info:
  title: 'spec'
  version: 1.2.3

paths:
  /foo:
    get:
      summary: get foo
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Foo"

components:
  schemas:
    Foo:
      type: object
      properties:
        id:
          $ref: "./common/foo.yml"

some/dir/common/foo.yml

type: string

In this case, following errors occurs:

open some/common/foo.yml: no such file or directory

It seems that file paths is joined incorrectly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions