fix for #632, param names other than

This commit is contained in:
Tony Tam
2014-10-17 08:52:44 -07:00
parent c6fb33a9c7
commit d16b149f39
3 changed files with 59 additions and 60 deletions

3
dist/index.html vendored
View File

@@ -20,8 +20,6 @@
<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">
@@ -34,7 +32,6 @@
}
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,5 +1,61 @@
// 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
@@ -96,63 +152,7 @@ PasswordAuthorization.prototype.apply = function(obj, authorizations) {
var base64encoder = this._btoa;
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
return true;
};/**
* 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){
};var __bind = function(fn, me){
return function(){
return fn.apply(me, arguments);
};

View File

@@ -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