updated swagger-js versions

This commit is contained in:
Tony Tam
2014-02-13 14:11:31 -08:00
parent b336076a19
commit cc49093471
3 changed files with 1323 additions and 1486 deletions

1341
dist/lib/swagger.js vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
// swagger.js // swagger.js
// version 2.0.13 // version 2.0.14
var __bind = function(fn, me){ var __bind = function(fn, me){
return function(){ return function(){
@@ -350,8 +350,8 @@ SwaggerResource.prototype.addModels = function(models) {
} }
} }
var output = []; var output = [];
for (var i = 0; i < this.modelsArray; i++) { for (var i = 0; i < this.modelsArray.length; i++) {
model = this.modelsArray[_i]; model = this.modelsArray[i];
output.push(model.setReferencedModels(this.models)); output.push(model.setReferencedModels(this.models));
} }
return output; return output;
@@ -450,7 +450,7 @@ var SwaggerModel = function(modelName, obj) {
SwaggerModel.prototype.setReferencedModels = function(allModels) { SwaggerModel.prototype.setReferencedModels = function(allModels) {
var results = []; var results = [];
for (i = 0; i < this.properties.length; i++) { for (var i = 0; i < this.properties.length; i++) {
var property = this.properties[i]; var property = this.properties[i];
var type = property.type || property.dataType; var type = property.type || property.dataType;
if (allModels[type] != null) if (allModels[type] != null)
@@ -465,7 +465,7 @@ SwaggerModel.prototype.setReferencedModels = function(allModels) {
SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) { SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
var propertiesStr = []; var propertiesStr = [];
for (i = 0; i < this.properties.length; i++) { for (var i = 0; i < this.properties.length; i++) {
prop = this.properties[i]; prop = this.properties[i];
propertiesStr.push(prop.toString()); propertiesStr.push(prop.toString());
} }
@@ -480,7 +480,7 @@ SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
modelsToIgnore = []; modelsToIgnore = [];
modelsToIgnore.push(this); modelsToIgnore.push(this);
for (i = 0; i < this.properties.length; i++) { for (var i = 0; i < this.properties.length; i++) {
prop = this.properties[i]; prop = this.properties[i];
if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel) === -1) { if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel) === -1) {
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore)); returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
@@ -493,7 +493,7 @@ SwaggerModel.prototype.createJSONSample = function(modelsToIgnore) {
var result = {}; var result = {};
var modelsToIgnore = (modelsToIgnore||[]) var modelsToIgnore = (modelsToIgnore||[])
modelsToIgnore.push(this.name); modelsToIgnore.push(this.name);
for (i = 0; i < this.properties.length; i++) { for (var i = 0; i < this.properties.length; i++) {
prop = this.properties[i]; prop = this.properties[i];
result[prop.name] = prop.getSampleValue(modelsToIgnore); result[prop.name] = prop.getSampleValue(modelsToIgnore);
} }
@@ -534,7 +534,7 @@ var SwaggerModelProperty = function(name, obj) {
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) { SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
var result; var result;
if ((this.refModel != null) && (modelsToIgnore[this.refModel.name] === 'undefined')) { if ((this.refModel != null) && (modelsToIgnore[this.refModel.name] === undefined)) {
result = this.refModel.createJSONSample(modelsToIgnore); result = this.refModel.createJSONSample(modelsToIgnore);
} else { } else {
if (this.isCollection) { if (this.isCollection) {
@@ -615,8 +615,8 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
this.responseSampleJSON = this.getSampleJSON(this.type, this.resource.models); this.responseSampleJSON = this.getSampleJSON(this.type, this.resource.models);
} }
for(i = 0; i < parameters.length; i ++) { for(var i = 0; i < this.parameters.length; i ++) {
var param = parameters[i]; var param = this.parameters[i];
// might take this away // might take this away
param.name = param.name || param.type || param.dataType; param.name = param.name || param.type || param.dataType;
@@ -763,7 +763,7 @@ SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
} }
var possibleParams = []; var possibleParams = [];
for(i = 0; i < this.parameters.length; i++) { for(var i = 0; i < this.parameters.length; i++) {
var param = this.parameters[i]; var param = this.parameters[i];
if(param.paramType === 'header') { if(param.paramType === 'header') {
if(args[param.name]) if(args[param.name])
@@ -806,7 +806,7 @@ SwaggerOperation.prototype.pathXml = function() {
SwaggerOperation.prototype.urlify = function(args) { SwaggerOperation.prototype.urlify = function(args) {
var url = this.resource.basePath + this.pathJson(); var url = this.resource.basePath + this.pathJson();
var params = this.parameters; var params = this.parameters;
for(i = 0; i < params.length; i ++){ for(var i = 0; i < params.length; i ++){
var param = params[i]; var param = params[i];
if (param.paramType === 'path') { if (param.paramType === 'path') {
if(args[param.name]) { if(args[param.name]) {
@@ -821,7 +821,7 @@ SwaggerOperation.prototype.urlify = function(args) {
} }
var queryParams = ""; var queryParams = "";
for(i = 0; i < params.length; i ++){ for(var i = 0; i < params.length; i ++){
var param = params[i]; var param = params[i];
if(param.paramType === 'query') { if(param.paramType === 'query') {
if(queryParams !== '') if(queryParams !== '')
@@ -853,7 +853,7 @@ SwaggerOperation.prototype.getHeaderParams = function(args) {
SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args) { SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args) {
var matchingParams = {}; var matchingParams = {};
var params = this.parameters; var params = this.parameters;
for (i = 0; i < params.length; i++) { for (var i = 0; i < params.length; i++) {
param = params[i]; param = params[i];
if (args && args[param.name]) if (args && args[param.name])
matchingParams[param.name] = args[param.name]; matchingParams[param.name] = args[param.name];
@@ -869,7 +869,7 @@ SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args) {
SwaggerOperation.prototype.help = function() { SwaggerOperation.prototype.help = function() {
var msg = ""; var msg = "";
var params = this.parameters; var params = this.parameters;
for (i = 0; i < params.length; i++) { for (var i = 0; i < params.length; i++) {
var param = params[i]; var param = params[i];
if (msg !== "") if (msg !== "")
msg += "\n"; msg += "\n";
@@ -908,7 +908,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
var params = this.operation.parameters; var params = this.operation.parameters;
for(i = 0; i < params.length; i++) { for(var i = 0; i < params.length; i++) {
var param = params[i]; var param = params[i];
if(param.paramType === "form") if(param.paramType === "form")
formParams.push(param); formParams.push(param);
@@ -958,7 +958,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
var possibleParams = {}; var possibleParams = {};
var values = {}; var values = {};
for(i = 0; i < formParams.length; i++){ for(var i = 0; i < formParams.length; i++){
var param = formParams[i]; var param = formParams[i];
values[param.name] = param; values[param.name] = param;
} }
@@ -1095,7 +1095,7 @@ JQueryHttpClient.prototype.execute = function(obj) {
headers = {}; headers = {};
headerArray = response.getAllResponseHeaders().split(":"); headerArray = response.getAllResponseHeaders().split(":");
for(i = 0; i < headerArray.length / 2; i++) for(var i = 0; i < headerArray.length / 2; i++)
headers[headerArray[i] = headerArray[i+1]]; headers[headerArray[i] = headerArray[i+1]];
out = { out = {
@@ -1107,9 +1107,15 @@ JQueryHttpClient.prototype.execute = function(obj) {
headers: headers headers: headers
}; };
if(response._headers["Content-Type"] && response._headers["Content-Type"].indexOf("application/json") == 0 && var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null)
response.content.data && response.content.data !== "") {
if(contentType != null) {
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
if(response.responseText && response.responseText !== "")
out.obj = JSON.parse(response.responseText); out.obj = JSON.parse(response.responseText);
else
out.obj = {}
}
} }
if(response.status >= 200 && response.status < 300) if(response.status >= 200 && response.status < 300)
@@ -1186,7 +1192,7 @@ ShredHttpClient.prototype.execute = function(obj) {
var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null) var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null)
if(contentType != null) { if(contentType != null) {
if(contentType.indexOf("application/json") == 0) { if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
if(response.content.data && response.content.data !== "") if(response.content.data && response.content.data !== "")
out.obj = JSON.parse(response.content.data); out.obj = JSON.parse(response.content.data);
else else

View File

@@ -1,6 +1,6 @@
{ {
"name": "swagger-ui", "name": "swagger-ui",
"version": "2.0.7", "version": "2.0.8",
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API", "description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"scripts": { "scripts": {
"build": "PATH=$PATH:./node_modules/.bin cake dist", "build": "PATH=$PATH:./node_modules/.bin cake dist",
@@ -19,7 +19,7 @@
"readmeFilename": "README.md", "readmeFilename": "README.md",
"dependencies": { "dependencies": {
"coffee-script": "~1.5.0", "coffee-script": "~1.5.0",
"swagger-client": "2.0.13", "swagger-client": "2.0.14",
"handlebars": "~1.0.10", "handlebars": "~1.0.10",
"less": "~1.4.2" "less": "~1.4.2"
} }