Swagger-ui: Could not resolve reference when $ref relative path files. "basePath" undefined.

Created on 20 Mar 2017  路  14Comments  路  Source: swagger-api/swagger-ui

After upgrading to v3, the relative path references are not working:
e.g.

#...
paths:
  /index:
    $ref: "./paths/index.yaml#/index"

will result in:
Could not resolve reference because of: Tried to resolve a relative URL, without having a basePath. path: 'paths/index.yaml' basePath: 'undefined'

P1 bug 3.x

Most helpful comment

Is this issue fixed on editor ?

All 14 comments

Up
Same problem here

Yup, we should put that in the known issues. Unfortunately, this is not going to be an immediate fix.

Same problem here !!

This was fixed in swagger-js.

@buunguyen, How is this fixed? I'm still having this issue today? I'm talking about the editor, the ui seems to work OK.

The editor is based on the UI. If it works in the UI, it'll work in the editor. Likely you're using an old version.

@webron I'm actually having problem with the new version.

version 2 of the editor http://editor2.swagger.io has preferences where I can set the 'Pointer Resolution Base Path', but the new version of the editor, does not provide a preference screen.

Okay, well that's an issue with the editor, not the ui.

@buunguyen Can you point to where this was fixed in swagger-js?

Is this issue fixed on editor ?

This issue is still present even in the online editor.

Please file a new ticket.

any news?

This is fixed in Swagger UI - if you're having an issue with the Editor, please open an issue there, but there is one open there already for this: https://github.com/swagger-api/swagger-editor/issues/1409

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fehguy picture fehguy  路  3Comments

prabhat1790 picture prabhat1790  路  3Comments

ankon picture ankon  路  4Comments

songtianyi picture songtianyi  路  3Comments

zilongl picture zilongl  路  3Comments