cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a reference to a schema stored on my file system

New Contributor

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'

 

Thks,

Stephane

Tags (1)
3 REPLIES 3
Moderator

Re: Adding a reference to a schema stored on my file system

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.

New Contributor

Re: Adding a reference to a schema stored on my file system

I am using the swagger editor v3.0.1

 

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

Moderator

Re: Adding a reference to a schema stored on my file system

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).

New Here?
Join us and watch the welcome video:
SeptemberNews
Join our online event
SeptemberHubBub
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win