{"action":"created","issue":{"url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/20","repository_url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser","labels_url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/20/comments","events_url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/20/events","html_url":"https://github.com/BigstickCarpet/json-schema-ref-parser/issues/20","id":160069219,"number":20,"title":"How to specify $ref base url?","user":{"login":"Alain1405","id":2998545,"avatar_url":"https://avatars.githubusercontent.com/u/2998545?v=3","gravatar_id":"","url":"https://api.github.com/users/Alain1405","html_url":"https://github.com/Alain1405","followers_url":"https://api.github.com/users/Alain1405/followers","following_url":"https://api.github.com/users/Alain1405/following{/other_user}","gists_url":"https://api.github.com/users/Alain1405/gists{/gist_id}","starred_url":"https://api.github.com/users/Alain1405/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alain1405/subscriptions","organizations_url":"https://api.github.com/users/Alain1405/orgs","repos_url":"https://api.github.com/users/Alain1405/repos","events_url":"https://api.github.com/users/Alain1405/events{/privacy}","received_events_url":"https://api.github.com/users/Alain1405/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-13T23:49:14Z","updated_at":"2016-06-14T14:55:17Z","closed_at":null,"body":"I serve a frontend locally with node at `localhost:8000`. I pull the json schema from an API. \r\nThe backend returning the json schema seats at `localhost:8888`  (`http://127.0.0.1:8888/api/controllers/schema`).\r\n\r\nThe schema has arrays of `$ref` fields in form of relative urls : \r\n`var schema = [{$ref:\"/api/controllers/123\"},{...}]`.\r\n\r\njson-schema-ref-parser resolves references relatively to the frontend url rather than the backend url. `$RefParser.resolve(schema);` throws the following errors:\r\n\r\n- `request.js:114 GET http://localhost:8000/api/controllers/123 404 (Not Found)` \r\n- `index.js:67 Uncaught (in promise) Error: Error downloading http://localhost:8000/api/controllers/123`. \r\n\r\nHow can I pass `localhost:8888` to resolve as base url?"},"comment":{"url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/comments/225908166","html_url":"https://github.com/BigstickCarpet/json-schema-ref-parser/issues/20#issuecomment-225908166","issue_url":"https://api.github.com/repos/BigstickCarpet/json-schema-ref-parser/issues/20","id":225908166,"user":{"login":"BigstickCarpet","id":3453903,"avatar_url":"https://avatars.githubusercontent.com/u/3453903?v=3","gravatar_id":"","url":"https://api.github.com/users/BigstickCarpet","html_url":"https://github.com/BigstickCarpet","followers_url":"https://api.github.com/users/BigstickCarpet/followers","following_url":"https://api.github.com/users/BigstickCarpet/following{/other_user}","gists_url":"https://api.github.com/users/BigstickCarpet/gists{/gist_id}","starred_url":"https://api.github.com/users/BigstickCarpet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BigstickCarpet/subscriptions","organizations_url":"https://api.github.com/users/BigstickCarpet/orgs","repos_url":"https://api.github.com/users/BigstickCarpet/repos","events_url":"https://api.github.com/users/BigstickCarpet/events{/privacy}","received_events_url":"https://api.github.com/users/BigstickCarpet/received_events","type":"User","site_admin":false},"created_at":"2016-06-14T14:55:17Z","updated_at":"2016-06-14T14:55:17Z","body":"Sorry I didn't get a chance to respond yesterday, but it looks like you've discovered what I was going to say anyway.   The trick is to pass the URL that you want (in your case `http://localhost:8888`) along with the schema object."}}
{"actor":{"display_login":"BigstickCarpet"}}