added support for body params with name other than
This commit is contained in:
116
dist/lib/swagger-client.js
vendored
116
dist/lib/swagger-client.js
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user