egg-controller
Advanced tools
Comparing version 0.3.30 to 0.3.31
@@ -0,1 +1,5 @@ | ||
# 0.3.31 / 2019-10-09 | ||
- fix: parameter data to schema. | ||
# 0.3.30 / 2019-09-03 | ||
@@ -2,0 +6,0 @@ |
@@ -46,2 +46,12 @@ "use strict"; | ||
function convertValidateToSchema(validateType) { | ||
if (validateType === 'string') { | ||
return { | ||
type: 'string', | ||
}; | ||
} | ||
if (validateType === 'int' || validateType === 'number') { | ||
return { | ||
type: 'number', | ||
}; | ||
} | ||
if (validateType.type === 'object' && validateType.rule) { | ||
@@ -51,4 +61,5 @@ let properties = {}; | ||
Object.keys(validateType.rule).forEach(key => { | ||
properties[key] = convertValidateToSchema(validateType.rule[key]); | ||
if (validateType.rule[key].required) { | ||
const rule = validateType.rule[key]; | ||
properties[key] = convertValidateToSchema(rule); | ||
if (rule.required !== false) { | ||
required.push(key); | ||
@@ -71,3 +82,3 @@ } | ||
? validateType.itemType === 'object' | ||
? convertValidateToSchema(validateType.rule) | ||
? convertValidateToSchema({ type: 'object', rule: validateType.rule }) | ||
: { type: validateType.itemType } | ||
@@ -74,0 +85,0 @@ : undefined, |
{ | ||
"name": "egg-controller", | ||
"version": "0.3.30", | ||
"version": "0.3.31", | ||
"description": "controller for egg.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
96620
2108