arjun-g / vs-swagger-viewer

Swagger Viewer lets you preview and validate Swagger 2.0 and OpenAPI files as you type in Visual Studio Code.
MIT License
170 stars 47 forks source link

$ref path handling problematic #52

Closed n-alex-white closed 5 years ago

n-alex-white commented 5 years ago

I have the following reference in my YAML file

          schema:
            $ref: '../schema/customer-address-v1.yaml#/components/schemas/Address'

But the swagger viewer thinks that this is an improper path, and it is looking for the referenced file here

  Error opening file "users/alex/sites/work/schema/customer-address-v1.yaml"

It should be looking in

users/alex/sites/work/{project}/customer/profile/schema/customer-address-v1.yaml

Other applications like swagger-cli correctly use the relative path reference in my YAML file, but swagger-viewer does not (which renders swagger viewer problematic)

This is on a Mac, in case that is significant.

I note that internally your extension uses the open source swagger-parser, and when I use that (or swagger-cli, which uses it), then there is no problem with the reference handling.

hatakawas commented 5 years ago

+1

arjun-g commented 5 years ago

Hey devs, very sorry for the delayed response. Will try to push a fix for this by this week.

arjun-g commented 5 years ago

Will be tracked in #45