소스 검색

fix for required fields showing optional

bubble
Tony Tam 11 년 전
부모
커밋
1b662db2d2
2개의 변경된 파일64개의 추가작업 그리고 20개의 파일을 삭제
  1. +32
    -10
      dist/lib/swagger.js
  2. +32
    -10
      lib/swagger.js

+ 32
- 10
dist/lib/swagger.js 파일 보기

@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.4.0
(function() {
var ApiKeyAuthorization, SwaggerApi, SwaggerAuthorizations, SwaggerHttp, SwaggerModel, SwaggerModelProperty, SwaggerOperation, SwaggerRequest, SwaggerResource,
var ApiKeyAuthorization, PasswordAuthorization, SwaggerApi, SwaggerAuthorizations, SwaggerHttp, SwaggerModel, SwaggerModelProperty, SwaggerOperation, SwaggerRequest, SwaggerResource,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

SwaggerApi = (function() {
@@ -94,6 +94,7 @@
this.apis = {};
this.apisArray = [];
this.produces = response.produces;
this.authSchemes = response.authorizations;
if (response.info != null) {
this.info = response.info;
}
@@ -445,18 +446,19 @@
SwaggerModel = (function() {

function SwaggerModel(modelName, obj) {
var propertyName, value;
var prop, propertyName, value;
this.name = obj.id != null ? obj.id : modelName;
this.properties = [];
for (propertyName in obj.properties) {
if (obj["enum"] != null) {
for (value in obj["enum"]) {
if (propertyName === value) {
if (obj.required != null) {
for (value in obj.required) {
if (propertyName === obj.required[value]) {
obj.properties[propertyName].required = true;
}
}
}
this.properties.push(new SwaggerModelProperty(propertyName, obj.properties[propertyName]));
prop = new SwaggerModelProperty(propertyName, obj.properties[propertyName]);
this.properties.push(prop);
}
}

@@ -508,7 +510,6 @@

SwaggerModel.prototype.createJSONSample = function(modelsToIgnore) {
var prop, result, _i, _len, _ref;
console.log("creating json sample for " + this);
result = {};
modelsToIgnore = modelsToIgnore || [];
modelsToIgnore.push(this.name);
@@ -530,11 +531,9 @@
function SwaggerModelProperty(name, obj) {
this.name = name;
this.dataType = obj.type || obj.dataType || obj["$ref"];
console.log(this.name + " has data type " + this.dataType);
this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set');
this.descr = obj.description;
this.required = obj.required;
console.log(this);
if (obj.items != null) {
if (obj.items.type != null) {
this.refDataType = obj.items.type;
@@ -630,7 +629,6 @@
this.method = this.method.toLowerCase();
this.isGetMethod = this.method === "get";
this.resourceName = this.resource.name;
console.log("model type: " + type);
if (((_ref = this.type) != null ? _ref.toLowerCase() : void 0) === 'void') {
this.type = void 0;
}
@@ -1211,6 +1209,28 @@

})();

PasswordAuthorization = (function() {

PasswordAuthorization.prototype.name = null;

PasswordAuthorization.prototype.username = null;

PasswordAuthorization.prototype.password = null;

function PasswordAuthorization(name, username, password) {
this.name = name;
this.username = username;
this.password = password;
}

PasswordAuthorization.prototype.apply = function(obj) {
return obj.headers["Authorization"] = "Basic " + btoa(this.username + ":" + this.password);
};

return PasswordAuthorization;

})();

this.SwaggerApi = SwaggerApi;

this.SwaggerResource = SwaggerResource;
@@ -1223,6 +1243,8 @@

this.ApiKeyAuthorization = ApiKeyAuthorization;

this.PasswordAuthorization = PasswordAuthorization;

this.authorizations = new SwaggerAuthorizations();

}).call(this);

+ 32
- 10
lib/swagger.js 파일 보기

@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.4.0
(function() {
var ApiKeyAuthorization, SwaggerApi, SwaggerAuthorizations, SwaggerHttp, SwaggerModel, SwaggerModelProperty, SwaggerOperation, SwaggerRequest, SwaggerResource,
var ApiKeyAuthorization, PasswordAuthorization, SwaggerApi, SwaggerAuthorizations, SwaggerHttp, SwaggerModel, SwaggerModelProperty, SwaggerOperation, SwaggerRequest, SwaggerResource,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

SwaggerApi = (function() {
@@ -94,6 +94,7 @@
this.apis = {};
this.apisArray = [];
this.produces = response.produces;
this.authSchemes = response.authorizations;
if (response.info != null) {
this.info = response.info;
}
@@ -445,18 +446,19 @@
SwaggerModel = (function() {

function SwaggerModel(modelName, obj) {
var propertyName, value;
var prop, propertyName, value;
this.name = obj.id != null ? obj.id : modelName;
this.properties = [];
for (propertyName in obj.properties) {
if (obj["enum"] != null) {
for (value in obj["enum"]) {
if (propertyName === value) {
if (obj.required != null) {
for (value in obj.required) {
if (propertyName === obj.required[value]) {
obj.properties[propertyName].required = true;
}
}
}
this.properties.push(new SwaggerModelProperty(propertyName, obj.properties[propertyName]));
prop = new SwaggerModelProperty(propertyName, obj.properties[propertyName]);
this.properties.push(prop);
}
}

@@ -508,7 +510,6 @@

SwaggerModel.prototype.createJSONSample = function(modelsToIgnore) {
var prop, result, _i, _len, _ref;
console.log("creating json sample for " + this);
result = {};
modelsToIgnore = modelsToIgnore || [];
modelsToIgnore.push(this.name);
@@ -530,11 +531,9 @@
function SwaggerModelProperty(name, obj) {
this.name = name;
this.dataType = obj.type || obj.dataType || obj["$ref"];
console.log(this.name + " has data type " + this.dataType);
this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set');
this.descr = obj.description;
this.required = obj.required;
console.log(this);
if (obj.items != null) {
if (obj.items.type != null) {
this.refDataType = obj.items.type;
@@ -630,7 +629,6 @@
this.method = this.method.toLowerCase();
this.isGetMethod = this.method === "get";
this.resourceName = this.resource.name;
console.log("model type: " + type);
if (((_ref = this.type) != null ? _ref.toLowerCase() : void 0) === 'void') {
this.type = void 0;
}
@@ -1211,6 +1209,28 @@

})();

PasswordAuthorization = (function() {

PasswordAuthorization.prototype.name = null;

PasswordAuthorization.prototype.username = null;

PasswordAuthorization.prototype.password = null;

function PasswordAuthorization(name, username, password) {
this.name = name;
this.username = username;
this.password = password;
}

PasswordAuthorization.prototype.apply = function(obj) {
return obj.headers["Authorization"] = "Basic " + btoa(this.username + ":" + this.password);
};

return PasswordAuthorization;

})();

this.SwaggerApi = SwaggerApi;

this.SwaggerResource = SwaggerResource;
@@ -1223,6 +1243,8 @@

this.ApiKeyAuthorization = ApiKeyAuthorization;

this.PasswordAuthorization = PasswordAuthorization;

this.authorizations = new SwaggerAuthorizations();

}).call(this);

불러오는 중...
취소
저장