How to specify $ref base url?
See original GitHub issueI serve a frontend locally with node at localhost:8000
. I pull the json schema from an API.
The backend returning the json schema seats at localhost:8888
(http://127.0.0.1:8888/api/controllers/schema
).
The schema has arrays of $ref
fields in form of relative urls :
var schema = [{$ref:"/api/controllers/123"},{...}]
.
json-schema-ref-parser resolves references relatively to the frontend url rather than the backend url. $RefParser.resolve(schema);
throws the following errors:
request.js:114 GET http://localhost:8000/api/controllers/123 404 (Not Found)
index.js:67 Uncaught (in promise) Error: Error downloading http://localhost:8000/api/controllers/123
.
How can I pass localhost:8888
to resolve as base url?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
The Document Base URL element - HTML - MDN Web Docs
The HTML element specifies the base URL to use for all relative URLs in a document. There can be only one element in...
Read more >How to specify the base URL for all relative URLs in a ...
In the below code, we have set “https://www.geeksforgeeks.org/” as the root URL for every relative URL on the page.
Read more >Django how to specify a base url - Stack Overflow
The best way to do this is the name your urls and then use the url template tag. Example below: First, name your...
Read more >API Server and Base Path - Swagger
In OpenAPI 3.0, you use the servers array to specify one or more base URLs for your API. servers replaces the host ,...
Read more >Jekyll's site.url and baseurl - Made Mistakes
Leave off trailing forward slashes when setting url. ✓ Do this, ❌ Don't do this · baseurl is not needed for most sites...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Awesome @BigstickCarpet. It was a bit cryptic 😉. But finally worked. Issue #13 gave me the clues. Here’s my version of the above.
@dzuluaga - See my reply above. You can specify the base URL as a parameter.