-
Notifications
You must be signed in to change notification settings - Fork 35
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
Use API Umbrella for REST calls made through Swagger UI #517
Comments
@elnzv How about this one - would you be interested? This is a continuation of task #76, which is being implemented by @frenchbread. Please estimate the size if you can take it. |
Will estimate the size after discussion with @frenchbread, since he was working on the related issue. |
@frenchbread status report? |
@brylie We kind of stuck with this one. With @elnzv we found out that the only way to change the proxy to apiUmbrella is to download swagger.json file itself, change the host and base path values to be that we want and then use the same file for future requests in Swagger UI base url field. |
Alright, that makes sense. Should we get together to plan this feature a bit? We can all three have a planning meeting later this sprint. @elnzv @frenchbread |
@elnzv @frenchbread @brylie I talked about this issue with @kyyberi as 2015-10-26 9:53 GMT+02:00 Brylie Christopher Oxley <notifications@github.com
Taija Björklund |
Yes, I had to manually edit a few files from swagger editor generated nodejs api skeleton to make it work correctly. Config was one and if I recall correctly, there was a variable in the beginning that was never used. |
PR #590 created. The approach is
Issues
Testing
|
Make sure to store the original values for basePath and host, so they can be retrieved later. I.e. keep the file integrity and override the values on a temporary basis where needed. |
Also, the Swagger UI is retrieved from our server. What 'remote swagger UI' are you referring to? |
According to the Swagger UI docs, we can simply pass in a JSON string when invoking the Swagger UI. This is probably a better approach than using an iframe. |
Example code for invoking Swagger UI in our template: Template.documentationBrowser.rendered = function () {
var swaggerUi = new SwaggerUi({
url:"http://petstore.swagger.io/v2/swagger.json",
dom_id:"swagger-ui-container"
});
};
swaggerUi.load(); It may be possible to pass a JavaScript object directly in to the URL parameter, or at least write a route that returns the JSON fields stored in a collection. |
@brylie "remote swagger UI" because it loads its data through iFrame |
OK, see above comment. |
Created meteor-package for SwaggerUI. @brylie I am getting an issue in browser console |
OK, your package should include only what is in the |
Also, be sure not to 'provide' or 'export' the HTML files when defining your package. The HTML files will cause conflicts. All you need to export are the JS, CSS, fonts, etc. |
@frenchbread and I added comments to a Meteor packaging feature request on Swagger UI project. |
When making API calls in documentation browser, i.e. Swagger UI, it is desirable to use API Umbrella proxy, e.g. umbrella.apinf.io, for requests.
The API Umbrella proxy URL can be found in config.json (as api_umbrella.base_url)
One approach to this task would be to rewrite the .swagger file, changing the
host
property to match theapi_umbrella.base_url
.Task
host
in the .swagger file should be set to the same value asapi_umbrella.base_url
Reference
Check the Swagger specification for information about the
host
property.Related
Related to #76.
Co-pilot: @elnzv
The text was updated successfully, but these errors were encountered: