added support for body params with name other than

This commit is contained in:
Tony Tam
2014-10-17 08:51:15 -07:00
parent b0301d6ee3
commit c6fb33a9c7
6 changed files with 65 additions and 64 deletions

4
dist/css/screen.css vendored
View File

@@ -669,10 +669,6 @@
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a:hover {
text-decoration: underline;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.path a.deprecated {
color: #666666;
text-decoration: line-through;
}
.swagger-section .swagger-ui-wrap ul#resources li.resource ul.endpoints li.endpoint ul.operations li.operation div.heading h3 span.http_method a {
text-transform: uppercase;
text-decoration: none;

3
dist/index.html vendored
View File

@@ -20,6 +20,8 @@
<script src='swagger-ui.js' type='text/javascript'></script>
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
<script src='spec.js' type='text/javascript'></script>
<!-- enabling this will enable oauth2 implicit scope support -->
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
@@ -32,6 +34,7 @@
}
window.swaggerUi = new SwaggerUi({
url: url,
spec: spec,
dom_id: "swagger-ui-container",
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
onComplete: function(swaggerApi, swaggerUi){

View File

@@ -1,61 +1,5 @@
// swagger-client.js
// version 2.1.0-alpha.1
/**
* Array Model
**/
var ArrayModel = function(definition) {
this.name = "name";
this.definition = definition || {};
this.properties = [];
this.type;
this.ref;
var requiredFields = definition.enum || [];
var items = definition.items;
if(items) {
var type = items.type;
if(items.type) {
this.type = typeFromJsonSchema(type.type, type.format);
}
else {
this.ref = items['$ref'];
}
}
}
ArrayModel.prototype.createJSONSample = function(modelsToIgnore) {
var result;
modelsToIgnore = (modelsToIgnore||{})
if(this.type) {
result = type;
}
else if (this.ref) {
var name = simpleRef(this.ref);
result = models[name].createJSONSample();
}
return [ result ];
};
ArrayModel.prototype.getSampleValue = function(modelsToIgnore) {
var result;
modelsToIgnore = (modelsToIgnore || {})
if(this.type) {
result = type;
}
else if (this.ref) {
var name = simpleRef(this.ref);
result = models[name].getSampleValue(modelsToIgnore);
}
return [ result ];
}
ArrayModel.prototype.getMockSignature = function(modelsToIgnore) {
var propertiesStr = [];
if(this.ref) {
return models[simpleRef(this.ref)].getMockSignature();
}
};
/**
* SwaggerAuthorizations applys the correct authorization to an operation being executed
@@ -152,7 +96,63 @@ PasswordAuthorization.prototype.apply = function(obj, authorizations) {
var base64encoder = this._btoa;
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
return true;
};var __bind = function(fn, me){
};/**
* Array Model
**/
var ArrayModel = function(definition) {
this.name = "name";
this.definition = definition || {};
this.properties = [];
this.type;
this.ref;
var requiredFields = definition.enum || [];
var items = definition.items;
if(items) {
var type = items.type;
if(items.type) {
this.type = typeFromJsonSchema(type.type, type.format);
}
else {
this.ref = items['$ref'];
}
}
}
ArrayModel.prototype.createJSONSample = function(modelsToIgnore) {
var result;
modelsToIgnore = (modelsToIgnore||{})
if(this.type) {
result = type;
}
else if (this.ref) {
var name = simpleRef(this.ref);
result = models[name].createJSONSample();
}
return [ result ];
};
ArrayModel.prototype.getSampleValue = function(modelsToIgnore) {
var result;
modelsToIgnore = (modelsToIgnore || {})
if(this.type) {
result = type;
}
else if (this.ref) {
var name = simpleRef(this.ref);
result = models[name].getSampleValue(modelsToIgnore);
}
return [ result ];
}
ArrayModel.prototype.getMockSignature = function(modelsToIgnore) {
var propertiesStr = [];
if(this.ref) {
return models[simpleRef(this.ref)].getMockSignature();
}
};
var __bind = function(fn, me){
return function(){
return fn.apply(me, arguments);
};
@@ -828,6 +828,8 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
headers[param.name] = args[param.name];
else if (param.in === 'formData')
formParams[param.name] = args[param.name];
else if (param.in === 'body')
args.body = args[param.name];
}
}
// handle form params

2
dist/swagger-ui.js vendored
View File

@@ -1886,7 +1886,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
o = _ref6[_j];
if ((o.value != null) && jQuery.trim(o.value).length > 0) {
map["body"] = o.value;
map[o.name] = o.value;
}
}
_ref7 = form.find("select");

File diff suppressed because one or more lines are too long

View File

@@ -158,7 +158,7 @@ class OperationView extends Backbone.View
for o in form.find("textarea")
if(o.value? && jQuery.trim(o.value).length > 0)
map["body"] = o.value
map[o.name] = o.value
for o in form.find("select")
val = this.getSelectedValue o