@bedrockio/model 0.7.5 → 0.7.6
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/dist/cjs/validation.js +2 -2
- package/package.json +1 -1
- package/src/validation.js +2 -2
package/dist/cjs/validation.js
CHANGED
|
@@ -23,7 +23,7 @@ const DATE_TAGS = {
|
|
|
23
23
|
'x-schema': 'DateTime',
|
|
24
24
|
'x-description': 'A `string` in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.'
|
|
25
25
|
};
|
|
26
|
-
const OBJECT_ID_SCHEMA = exports.OBJECT_ID_SCHEMA = _yada.default.string().mongo().message('
|
|
26
|
+
const OBJECT_ID_SCHEMA = exports.OBJECT_ID_SCHEMA = _yada.default.string().mongo().message('{field} must be an id.').tag({
|
|
27
27
|
'x-schema': 'ObjectId',
|
|
28
28
|
'x-description': 'A 24 character hexadecimal string representing a Mongo [ObjectId](https://bit.ly/3YPtGlU).'
|
|
29
29
|
});
|
|
@@ -33,7 +33,7 @@ const REFERENCE_SCHEMA = _yada.default.allow(OBJECT_ID_SCHEMA, _yada.default.obj
|
|
|
33
33
|
stripUnknown: true
|
|
34
34
|
}).custom(obj => {
|
|
35
35
|
return obj.id;
|
|
36
|
-
})).message('
|
|
36
|
+
})).message('{field} must be an id or object containing "id" field.').tag({
|
|
37
37
|
'x-schema': 'Reference',
|
|
38
38
|
'x-description': `
|
|
39
39
|
A 24 character hexadecimal string representing a Mongo [ObjectId](https://bit.ly/3YPtGlU).
|
package/package.json
CHANGED
package/src/validation.js
CHANGED
|
@@ -19,7 +19,7 @@ const DATE_TAGS = {
|
|
|
19
19
|
export const OBJECT_ID_SCHEMA = yd
|
|
20
20
|
.string()
|
|
21
21
|
.mongo()
|
|
22
|
-
.message('
|
|
22
|
+
.message('{field} must be an id.')
|
|
23
23
|
.tag({
|
|
24
24
|
'x-schema': 'ObjectId',
|
|
25
25
|
'x-description':
|
|
@@ -40,7 +40,7 @@ const REFERENCE_SCHEMA = yd
|
|
|
40
40
|
return obj.id;
|
|
41
41
|
})
|
|
42
42
|
)
|
|
43
|
-
.message('
|
|
43
|
+
.message('{field} must be an id or object containing "id" field.')
|
|
44
44
|
.tag({
|
|
45
45
|
'x-schema': 'Reference',
|
|
46
46
|
'x-description': `
|