Parcourir la source

updated swagger lib

bubble
Tony Tam il y a 10 ans
Parent
révision
0c44f83c26
3 fichiers modifiés avec 29 ajouts et 7 suppressions
  1. +14
    -3
      dist/lib/swagger.js
  2. +14
    -3
      lib/swagger.js
  3. +1
    -1
      package.json

+ 14
- 3
dist/lib/swagger.js Voir le fichier

@@ -1,5 +1,5 @@
// swagger.js // swagger.js
// version 2.0.38
// version 2.0.39


var __bind = function(fn, me){ var __bind = function(fn, me){
return function(){ 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) { if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) { Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) { for (var i = (start || 0), j = this.length; i < j; i++) {
@@ -88,6 +98,7 @@ var SwaggerApi = function(url, options) {
this.authorizationScheme = null; this.authorizationScheme = null;
this.info = null; this.info = null;
this.useJQuery = false; this.useJQuery = false;
this.modelsArray = [];


options = (options||{}); options = (options||{});
if (url) if (url)
@@ -281,7 +292,6 @@ SwaggerApi.prototype.fail = function(message) {


SwaggerApi.prototype.setConsolidatedModels = function() { SwaggerApi.prototype.setConsolidatedModels = function() {
var model, modelName, resource, resource_name, _i, _len, _ref, _ref1, _results; var model, modelName, resource, resource_name, _i, _len, _ref, _ref1, _results;
this.modelsArray = [];
this.models = {}; this.models = {};
_ref = this.apis; _ref = this.apis;
for (resource_name in _ref) { 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.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set');
this.descr = obj.description; this.descr = obj.description;
this.required = obj.required; this.required = obj.required;
this.defaultValue = obj.defaultValue;
this.defaultValue = modelPropertyMacro(obj.defaultValue);
if (obj.items != null) { if (obj.items != null) {
if (obj.items.type != null) { if (obj.items.type != null) {
this.refDataType = obj.items.type; 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) { this.resource[this.nickname] = function(args, callback, error) {
return _this["do"](args, callback, error); return _this["do"](args, callback, error);


+ 14
- 3
lib/swagger.js Voir le fichier

@@ -1,5 +1,5 @@
// swagger.js // swagger.js
// version 2.0.38
// version 2.0.39


var __bind = function(fn, me){ var __bind = function(fn, me){
return function(){ 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) { if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) { Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) { for (var i = (start || 0), j = this.length; i < j; i++) {
@@ -88,6 +98,7 @@ var SwaggerApi = function(url, options) {
this.authorizationScheme = null; this.authorizationScheme = null;
this.info = null; this.info = null;
this.useJQuery = false; this.useJQuery = false;
this.modelsArray = [];


options = (options||{}); options = (options||{});
if (url) if (url)
@@ -281,7 +292,6 @@ SwaggerApi.prototype.fail = function(message) {


SwaggerApi.prototype.setConsolidatedModels = function() { SwaggerApi.prototype.setConsolidatedModels = function() {
var model, modelName, resource, resource_name, _i, _len, _ref, _ref1, _results; var model, modelName, resource, resource_name, _i, _len, _ref, _ref1, _results;
this.modelsArray = [];
this.models = {}; this.models = {};
_ref = this.apis; _ref = this.apis;
for (resource_name in _ref) { 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.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set');
this.descr = obj.description; this.descr = obj.description;
this.required = obj.required; this.required = obj.required;
this.defaultValue = obj.defaultValue;
this.defaultValue = modelPropertyMacro(obj.defaultValue);
if (obj.items != null) { if (obj.items != null) {
if (obj.items.type != null) { if (obj.items.type != null) {
this.refDataType = obj.items.type; 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) { this.resource[this.nickname] = function(args, callback, error) {
return _this["do"](args, callback, error); return _this["do"](args, callback, error);


+ 1
- 1
package.json Voir le fichier

@@ -19,7 +19,7 @@
"readmeFilename": "README.md", "readmeFilename": "README.md",
"dependencies": { "dependencies": {
"coffee-script": "~1.6.3", "coffee-script": "~1.6.3",
"swagger-client": "2.0.36",
"swagger-client": "2.0.39",
"handlebars": "~1.0.10", "handlebars": "~1.0.10",
"less": "~1.4.2" "less": "~1.4.2"
} }


Chargement…
Annuler
Enregistrer