This commit is contained in:
Ayush Gupta
2012-11-05 13:31:17 +05:30
parent 4a77d5a20f
commit 8d3a5010b4
2 changed files with 6 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ To use swagger-ui you should take a look at the [source of swagger-ui html page]
``` ```
* *discoveryUrl* parameter should point to a resource listing url as per [Swagger Spec](https://github.com/wordnik/swagger-core/wiki) * *discoveryUrl* parameter should point to a resource listing url as per [Swagger Spec](https://github.com/wordnik/swagger-core/wiki)
* *dom_id parameter* is the the id of a dom element inside which SwaggerUi will put the user interface for swagger * *dom_id parameter* is the the id of a dom element inside which SwaggerUi will put the user interface for swagger
* *booleanValues* SwaggerUI renders boolean data types as a dropdown. By default it provides a 'true' and 'false' string as the possible choices. You can use this parameter to change the values in dropdown to be something else, for example 0 and 1 by setting booleanValues to new Array(0, 1)
* *docExpansion* controls how the API listing is displayed. It can be set to 'none' (default), 'list' (shows operations for each resource), or 'full' (fully expanded: shows operations and their details) * *docExpansion* controls how the API listing is displayed. It can be set to 'none' (default), 'list' (shows operations for each resource), or 'full' (fully expanded: shows operations and their details)
* *onComplete* is a callback function parameter which can be passed to be notified of when SwaggerUI has completed rendering successfully. * *onComplete* is a callback function parameter which can be passed to be notified of when SwaggerUI has completed rendering successfully.
* *onFailure* is a callback function parameter which can be passed to be notified of when SwaggerUI encountered a failure was unable to render. * *onFailure* is a callback function parameter which can be passed to be notified of when SwaggerUI encountered a failure was unable to render.

View File

@@ -41,6 +41,7 @@
this.failure = options.failure != null ? options.failure : function() {}; this.failure = options.failure != null ? options.failure : function() {};
this.progress = options.progress != null ? options.progress : function() {}; this.progress = options.progress != null ? options.progress : function() {};
this.headers = options.headers != null ? options.headers : {}; this.headers = options.headers != null ? options.headers : {};
this.booleanValues = options.booleanValues != null ? options.booleanValues : new Array('true', 'false');
this.discoveryUrl = this.suffixApiKey(this.discoveryUrl); this.discoveryUrl = this.suffixApiKey(this.discoveryUrl);
if (options.success != null) { if (options.success != null) {
this.build(); this.build();
@@ -263,6 +264,10 @@
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
parameter = _ref[_i]; parameter = _ref[_i];
parameter.name = parameter.name || parameter.dataType; parameter.name = parameter.name || parameter.dataType;
if (parameter.dataType.toLowerCase() === 'boolean') {
parameter.allowableValues = {};
parameter.allowableValues.values = this.resource.api.booleanValues;
}
if (parameter.allowableValues != null) { if (parameter.allowableValues != null) {
if (parameter.allowableValues.valueType === "RANGE") { if (parameter.allowableValues.valueType === "RANGE") {
parameter.isRange = true; parameter.isRange = true;