joi-to-json 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/parsers/json.js +3 -7
- package/package.json +1 -1
package/lib/parsers/json.js
CHANGED
|
@@ -96,14 +96,10 @@ class JoiJsonSchemaParser {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
_getEnum(fieldDefn) {
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
const enumList = fieldDefn[this.enumFieldName]
|
|
100
|
+
if (fieldDefn.flags && fieldDefn.flags.only && !_.isEmpty(enumList)) {
|
|
101
|
+
return _.uniq(enumList)
|
|
101
102
|
}
|
|
102
|
-
|
|
103
|
-
const enumList = _.filter(fieldDefn[this.enumFieldName], (item) => {
|
|
104
|
-
return !_.isEmpty(item)
|
|
105
|
-
})
|
|
106
|
-
return _.isEmpty(enumList) ? undefined : enumList
|
|
107
103
|
}
|
|
108
104
|
|
|
109
105
|
_getUnknown(joiSpec) {
|