-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
Intermittent failures resolving filesystem $ref's #26
Comments
To be clear this is using dereference() without using promises syntax, going to test promises now |
After switching to promises syntax, I was able to run through 1000 iterations of my test without a failure, so I'd say the issue is somewhere there. Maybe related to call-me-maybe library. |
Odd. It doesn't make sense that it would behave incorrectly only 10% of the time, and the code is the same regardless of whether it uses promises or callbacks. I suspect that there's some other variable at play. Perhaps you have multiple tests running simultaneously, and some of them are making modifications to the same folder structure that others are reading? |
Nope, the folder structure isn't being modified. As soon as we switched to promises the issue stopped happening, maybe callbacks aren't playing nice with whatever async setup our testing library (abao) is using. I am new to nodejs so it's very possible I messed something up when I added json-schema-ref-parser to the abao testing library. You can see where we call into json-schema-ref-parser here, and further up in that file you can also see how abao is implementing async behavior: https://github.com/flywheel-io/abao/blob/add-jsonschema-deref/lib/test.coffee#L113 |
Here is what the code looked like when it had the issue, before switching to promises: https://github.com/flywheel-io/abao/blob/015bf54a5b9a72b847e89a7a2b27f4a1c454f62d/lib/test.coffee#L113 |
This was due to my lack of knowledge in coffeescript syntax, closing |
We have discovered that json-schema-ref-parser will intermittently fail resolving $ref's from the local filesystem. The failure symptom is attempting to resolve the $ref relative to the current working directory, instead of the referring document. This is estimated to happen about 1 of every 10 times.
json-schema-ref-parser is attempting to load "/Users/coltonlw/projects/definitions/user.json", however the directory structure is like this:
/Users/coltonlw/projects/core/raml/schemas/definitions/user.json
With the referring document located at
/Users/coltonlw/projects/core/raml/schemas/output/user.json
The text was updated successfully, but these errors were encountered: