Forum Discussion

scanon's avatar
New Contributor
5 years ago

Adding a reference to a schema stored on my file system

I'm trying to use the swagger 3.1 feature allowing to store the data schema in an external file. The file is stored on my local drive.

I got the following error message:


Resolver error at components.schemas.Person.$ref

Could not resolve reference: Tried to resolve a relative URL, without having a basePath. path: 'PersonProfile.json' basePath: 'undefined'




3 Replies

  • Please provide more information about your case. Swagger is a collection of tools and it's unclear which one you're using, and what your input to the tool is. With the additional details, hopefully we can guide you in the right direction.

    • scanon's avatar
      New Contributor

      I am using the swagger editor v3.0.1


          Person: $ref: "//PersonProfile.json"

      • RonRatovsky's avatar

        Swagger Editor, being a browser-based application, cannot access your file system. This is a browser/security limitation. If you want to access the file using a reference, you'll have to host it (even locally).