Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
in order to pass preset/plugins we need to add checking in jsTplString so it can push new functions to array
for (var attrname in customOptions) {
if(attrname == "presets" || attrname == "plugins"){
swaggerOptions[attrname].push(customOptions[attrname]);
}else{
swaggerOptions[attrname] = customOptions[attrname];
}
}
here's inject example
var SwaggerHmacAuth = function (system) {
return {
statePlugins: {
spec: {
wrapActions: {
setMutatedRequest: (oriAction, system) => (str) => {
// here, you can hand the value to some function that exists outside of Swagger UI
console.log('Here is my API definition', str, oriAction, system);
return oriAction(str); // don't forget! otherwise, Swagger UI won't update
},
},
},
},
};
};
let swaggerOptions = {
presets: [SwaggerHmacAuth],
};
in order to pass preset/plugins we need to add checking in
jsTplString
so it can push new functions to arrayhere's inject example