-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
Add possibility to specify location when you pass object #13
Comments
I like this idea. Will add it soon |
My current workaround is to just change working directory with |
+1. @BigstickCarpet Any progress on this? |
@litek workaround with changing working directory will not work if you deal with URLs (referenced issue). |
alright. I'll get this knocked out this weekend |
As of version 3.1.1, you can now pass a URL and an object to any method. $RefParser.dereference("http://example.com/my-schema.json", mySchemaObject, {})
|
@BigstickCarpet thanks a lot for feature, but there is a bug: paths begin to duplicate (i pass schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"items": {
"$ref": "schemas/item.json"
}
}
}
deferred = @q.defer()
require('json-schema-ref-parser').dereference(
'test/raml-files/deferenced.raml', schema, {}
)
.then((dereferencedSchema) ->
deferred.resolve(JSON.stringify(dereferencedSchema))
)
.catch((err) ->
deferred.reject(err)
) I'll get following error:
Path seems to be duplicated here. |
@alvassin - Good catch. I had forgotten to account for relative URLs. In all my tests, I was passing absolute URLs. Anyway, it's fixed now. Try the latest version |
@BigstickCarpet yeeeah! it works! thanks for super-fast fix, much appreciated 🍺 |
* master: "release v3.1.2" Added tests for Issue #13 Object paths weren't being converted to absolute URLs #13 (comment) "release v3.1.1" Revert "Removed the external-facing YAML object. All methods will now allow a YAML string to be passed-in instead" "release v3.1.0" updated dependencies Fixed Issue #13 (#13) Conflicts: lib/bundle.js lib/index.js lib/resolve-external.js package.json
If you pass object it's impossible to resolve external relative references.
It would be cool if I can add option where I can specify base path for relative refs.
The text was updated successfully, but these errors were encountered: