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

Preview does not render when chained $refs #62

Closed bbettke closed 5 years ago

bbettke commented 5 years ago

In the current directory we have a api.yaml and a common-schemas.yaml file. In the api.yaml file there is a ref to a definition.yaml file in a subdirectory.

-api.yaml -common-schemas.yaml -customactions/definition.yaml

The api.yaml file has a reference to a path in the customactions/definitions.yaml file.

paths: /customactions: $ref: "customactions/definition.yaml#/paths/~1customactions"

The customactions definition.yaml file has in a schema section a reference to a file in the parent directory.

$ref: "../common-schemas.yaml#/components/schemas/hateoasLink"

If you preview the definiton.yaml file by itself the doc renders properly with the $ref: "../common-schemas.yaml#/components/schemas/hateoasLink" being resolved correctly. However if you try to render the parent api.yaml file it does not include the definitions from the definition.yaml file. There is an error on that page that says:

Invalid $ref pointer "components,schemas,hateoasLinks". Pointers must begin with "#/"

If I use swagger-ui to view the same code, the api.yaml doc renders correctly.

bbettke commented 5 years ago

Identified issue, problem was with a typo in another ref. Please disregard.