Created
July 14, 2015 10:34
-
-
Save davetransom/1f2bf02c63a4922fca33 to your computer and use it in GitHub Desktop.
Display model descriptions in swagger-ui.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This needs to be injected into swagger-ui's index.html file after 'swagger-ui.js' (where getMockSignature is defined) | |
// but _before_ it is used to render parts of the page. A horrible dirty hack. | |
var _originalGetMockSignature = window.Model.prototype.getMockSignature; | |
window.Model.prototype.getMockSignature = function newModelGetMockSignature(modelsToIgnore) { | |
var model = this; | |
var signature = _originalGetMockSignature.apply(this, arguments); | |
if (model.definition && model.definition.description) | |
signature = "<span class=\"hacked-in-model-summary\">" + model.definition.description + "</span>\n" + signature; | |
return signature; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment