joi-to-json 2.1.1 → 2.2.0
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 +12 -5
- package/package.json +1 -1
package/lib/parsers/json.js
CHANGED
|
@@ -28,6 +28,7 @@ class JoiJsonSchemaParser {
|
|
|
28
28
|
this._setAlternativesProperties(schema, joiSpec)
|
|
29
29
|
this._setAnyProperties(schema, joiSpec)
|
|
30
30
|
this._addNullTypeIfNullable(schema, joiSpec)
|
|
31
|
+
this._setMetaProperties(schema, joiSpec)
|
|
31
32
|
|
|
32
33
|
return schema
|
|
33
34
|
}
|
|
@@ -226,11 +227,6 @@ class JoiJsonSchemaParser {
|
|
|
226
227
|
if (fieldDefn.flags && fieldDefn.flags.encoding) {
|
|
227
228
|
fieldSchema.contentEncoding = fieldDefn.flags.encoding
|
|
228
229
|
}
|
|
229
|
-
_.forEach(fieldDefn.meta, (m) => {
|
|
230
|
-
if (m.contentMediaType) {
|
|
231
|
-
fieldSchema.contentMediaType = m.contentMediaType
|
|
232
|
-
}
|
|
233
|
-
})
|
|
234
230
|
|
|
235
231
|
const ruleArgFieldName = this.ruleArgFieldName
|
|
236
232
|
|
|
@@ -398,6 +394,17 @@ class JoiJsonSchemaParser {
|
|
|
398
394
|
'null'
|
|
399
395
|
]
|
|
400
396
|
}
|
|
397
|
+
|
|
398
|
+
_setMetaProperties(schema, joiSpec) {
|
|
399
|
+
_.forEach(joiSpec.metas, (m) => {
|
|
400
|
+
if (m.contentMediaType) {
|
|
401
|
+
schema.contentMediaType = m.contentMediaType
|
|
402
|
+
}
|
|
403
|
+
if (m.format) {
|
|
404
|
+
schema.format = m.format
|
|
405
|
+
}
|
|
406
|
+
})
|
|
407
|
+
}
|
|
401
408
|
}
|
|
402
409
|
|
|
403
410
|
module.exports = JoiJsonSchemaParser
|