-
-
Notifications
You must be signed in to change notification settings - Fork 883
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
fix: use uri-js to resovle uri's #544
Conversation
I'll have a look a bit later |
@sondrele I'm a bit reluctant to switch from internal url to uri-js for several reasons:
I think a better approach could be to allow passing uri-js (or any other library) as an option and specify in docs what methods it should support. What do you think? |
@epoberezkin I understand your concerns, both about size, and about a possibly different behavior (although that could maybe be solved with a version bump). It's a little unfortunate that not all urn's are supported, but I guess it's fine as long as it's documented as a limitation. As a curiosity (and side-note), have you considered looking into replacing the legacy An option to configure the |
That would make it more difficult to allow supporting all URIs, no?
I thought it would be just an option "uri" that should be an object compatible with the current "legacy" url package API (i.e. supply methods parse and resolve, where parse returns an object with properties (at least) protocol, href, host, path). If it is not supplied, "url" will be used. |
Probably, but I thought I'd just throw it in as a different issue, since URL id's are going to be the main concern for Ajv. :) I'll get around looking into a |
Using ajv for schema compilation in the browser is proving difficult because of the use of the node |
@sirugh your comment is unrelated to the problem this PR addresses (support for full URI spec in refs rather than just URLs). Please submit a specific example that doesn’t work in the browser for you together with how you load ajv. At the very least I expect it to work ok with the provided bundle, so maybe your issue can be addressed with the changes in how you build it? |
You're right. I'm just at wits end here trying to figure it out. I'll try to come up with a reasonably simple use case that displays the error I'm talking about. |
What issue does this pull request resolve?
This is a PR to resolve #423
In the issue you mentioned that it should maybe be part of the JSON-schema-test-suite, but juding from the last comment on the issue, it might not be necessary.
What changes did you make?
Replaced usage of the node
url
package withuri-js
for resolving url's and schema id's.Is there anything that requires more attention while reviewing?
This changes a pretty central part of url resolving, but it seems like it should be covered by the tests.
Let me know if you'd like to do some other changes, if it need more tests, or implement it some other way.