-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
Relative $ref pointer not working for files #35
Comments
@BigstickCarpet can you please help with this . Is there any way i can achieve what i am trying to do ? |
There are a few errors in your code, which I think are the cause of the problem:
|
@BigstickCarpet My question is, what is the base path for a relative path in $ref? Is the base path relative to where the json file is or is it relative to The code that I have right now behaves as if |
@BigstickCarpet I too had a similar issue with relative refs. I've created a commit here that reproduces the issue: The strangest thing is, if you remove the 'title' property from here, the test will pass: |
@sorohan - Because your JSON Reference ( {
title: 'Test',
type: 'object',
properties: {
id: {
type: 'string'
}
}
} |
@BigstickCarpet. I think according to the schema additional properties should be ignored: http://json-schema.org/latest/json-schema-core.html#rfc.section.8 "All other properties in a "$ref" object MUST be ignored." In any case, it seems to be breaking the file resolution. If you run with the test I added (npm run mocha) you should see an error:
And removing the 'title' property stops the error. |
Yeah, I'm aware that merging extra properties of the That said, the existence of extra properties shouldn't affect path resolution at all. I'll have to investigate when I get a chance. I have several tests for this functionality, and they all pass, so I'm not sure what's different about your example. |
I am facing the same issue. Please, someone, give me a solution for this
error |
@gowthaman-i2i you can't merge together properties like that (mixing the $ref and the "amount", etc). You might want to read about combining schemas: |
@sorohan Thank you got it. |
I have a nodejs application and a folder where all schema reside .
The folder are different for both as given below :
Node js application run here
-- /home/ubuntu/work/node_webhook/webhook.js
Json schema files are stored here :
test_schema.json looks like this :
common_data_types.json looks like this :
enums.json looks like this
AND NODE JS APLICATION FILE : webhook.js looks like this :
Getting error as it try to resolve ref pointers in current directory in which nodejs application is running . That is : /home/ubuntu/work/node_webhook/
So it cannot find
/home/ubuntu/work/node_webhook/enums.json
/home/ubuntu/work/node_webhook/common_data_types.json
How will i provide it a base directory to load all json files from . Or how to use relative file path ?
The text was updated successfully, but these errors were encountered: