var swaggerUi = new SwaggerUi({
url: './cbrain-4.5.0-swagger.json',
dom_id: 'swagger-ui-container',
defaultModelRendering: 'schema',
onComplete: function(swaggerApi, swaggerUi) {
// Overide the built-in CBRAIN service config to use the current page's.
var host = window.location.host; // can include the port number
var scheme = window.location.protocol.replace(/:/,""); // "http" or "https"
swaggerApi.scheme = scheme;
swaggerApi.host = host;
swaggerApi.swaggerObject.schemes = [ scheme ];
swaggerApi.swaggerObject.host = host;
}
});
swaggerUi.load();As you can see, I found 4 properties in both the swaggerAPI and internal swaggerObject where I can change the values; it works in that the values are changed, but it seems it makes no difference because the UI has already been built at this point and all the "Try it out!" dialogs are all configured to use the old HOST and SCHEME that were defined in the JSON.
My question is, how can I initialize a swaggerUI with a URL for a JSON spec, yet get the UI built with a different HOST and SCHEME ? Is there some kind of callback I can provide such that the values of the JSON object be updated BEFORE the UI is built?
Thanks.
--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.