Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to resolve multi-file #/definitions/ references #28

Closed
PrideDivide opened this issue Oct 19, 2016 · 2 comments
Closed

Fails to resolve multi-file #/definitions/ references #28

PrideDivide opened this issue Oct 19, 2016 · 2 comments

Comments

@PrideDivide
Copy link

I have my definitions in separate files, and the schemas in my paths link to them through the definitions object.

Swagger index file:
... definitions: $ref: './definitions/index.yaml' ...

definitions/index.yaml:
... user: $ref: './main/user.yaml' ...

random path file:
... get: responses: '200': schema: $ref: '#/definitions/user' ...

When I try to dereference this, I get the following error:

SyntaxError: Error resolving $ref pointer "paths/main/user.yaml#/definitions/user". ,
"Token "definitions" does not exist.",

Is this supported? What am I doing wrong?

@JamesMessinger
Copy link
Member

That's the correct behavior. JSON References ($ref) are resolved against the file that they're in, not against the root file. See this issue for more details

@PrideDivide
Copy link
Author

Thanks for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants