From 0c44f83c2691b52d56266166c3eb9cf336937972 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Mon, 15 Sep 2014 17:36:28 -0700 Subject: [PATCH] updated swagger lib --- dist/lib/swagger.js | 17 ++++++++++++++--- lib/swagger.js | 17 ++++++++++++++--- package.json | 2 +- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/dist/lib/swagger.js b/dist/lib/swagger.js index e29dbf87..9e73a9b3 100644 --- a/dist/lib/swagger.js +++ b/dist/lib/swagger.js @@ -1,5 +1,5 @@ // swagger.js -// version 2.0.38 +// version 2.0.39 var __bind = function(fn, me){ return function(){ @@ -15,6 +15,16 @@ log = function(){ } }; +// if you want to apply conditional formatting of parameter values +parameterMacro = function(value) { + return value; +} + +// if you want to apply conditional formatting of model property values +modelPropertyMacro = function(value) { + return value; +} + if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(obj, start) { for (var i = (start || 0), j = this.length; i < j; i++) { @@ -88,6 +98,7 @@ var SwaggerApi = function(url, options) { this.authorizationScheme = null; this.info = null; this.useJQuery = false; + this.modelsArray = []; options = (options||{}); if (url) @@ -281,7 +292,6 @@ SwaggerApi.prototype.fail = function(message) { SwaggerApi.prototype.setConsolidatedModels = function() { var model, modelName, resource, resource_name, _i, _len, _ref, _ref1, _results; - this.modelsArray = []; this.models = {}; _ref = this.apis; for (resource_name in _ref) { @@ -598,7 +608,7 @@ var SwaggerModelProperty = function(name, obj) { this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set'); this.descr = obj.description; this.required = obj.required; - this.defaultValue = obj.defaultValue; + this.defaultValue = modelPropertyMacro(obj.defaultValue); if (obj.items != null) { if (obj.items.type != null) { this.refDataType = obj.items.type; @@ -776,6 +786,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not } } } + param.defaultValue = parameterMacro(param.defaultValue); } this.resource[this.nickname] = function(args, callback, error) { return _this["do"](args, callback, error); diff --git a/lib/swagger.js b/lib/swagger.js index e29dbf87..9e73a9b3 100644 --- a/lib/swagger.js +++ b/lib/swagger.js @@ -1,5 +1,5 @@ // swagger.js -// version 2.0.38 +// version 2.0.39 var __bind = function(fn, me){ return function(){ @@ -15,6 +15,16 @@ log = function(){ } }; +// if you want to apply conditional formatting of parameter values +parameterMacro = function(value) { + return value; +} + +// if you want to apply conditional formatting of model property values +modelPropertyMacro = function(value) { + return value; +} + if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(obj, start) { for (var i = (start || 0), j = this.length; i < j; i++) { @@ -88,6 +98,7 @@ var SwaggerApi = function(url, options) { this.authorizationScheme = null; this.info = null; this.useJQuery = false; + this.modelsArray = []; options = (options||{}); if (url) @@ -281,7 +292,6 @@ SwaggerApi.prototype.fail = function(message) { SwaggerApi.prototype.setConsolidatedModels = function() { var model, modelName, resource, resource_name, _i, _len, _ref, _ref1, _results; - this.modelsArray = []; this.models = {}; _ref = this.apis; for (resource_name in _ref) { @@ -598,7 +608,7 @@ var SwaggerModelProperty = function(name, obj) { this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set'); this.descr = obj.description; this.required = obj.required; - this.defaultValue = obj.defaultValue; + this.defaultValue = modelPropertyMacro(obj.defaultValue); if (obj.items != null) { if (obj.items.type != null) { this.refDataType = obj.items.type; @@ -776,6 +786,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not } } } + param.defaultValue = parameterMacro(param.defaultValue); } this.resource[this.nickname] = function(args, callback, error) { return _this["do"](args, callback, error); diff --git a/package.json b/package.json index 19e25b56..4370b011 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "readmeFilename": "README.md", "dependencies": { "coffee-script": "~1.6.3", - "swagger-client": "2.0.36", + "swagger-client": "2.0.39", "handlebars": "~1.0.10", "less": "~1.4.2" }