Skip to content

Commit 001f52b

Browse files
committed
Fix defaults manifest. Closes #2134
1 parent 06d7604 commit 001f52b

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

lib/schemas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ exports.description = Joi.object({
215215
type: Joi.string().required(),
216216
flags: Joi.object({
217217
cast: Joi.string(),
218-
default: internals.desc.entity.allow(''),
218+
default: Joi.any(),
219219
description: Joi.string(),
220220
empty: Joi.link('/'),
221221
failover: internals.desc.entity,

test/manifest.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,20 @@ describe('Manifest', () => {
266266
]
267267
});
268268
});
269+
270+
it('describes defaults', () => {
271+
272+
const schema = Joi.object({
273+
foo: Joi.string().default('bar')
274+
})
275+
.default({ foo: 'bar' });
276+
277+
expect(schema.describe()).to.equal({
278+
type: 'object',
279+
flags: { default: { foo: 'bar' } },
280+
keys: { foo: { type: 'string', flags: { default: 'bar' } } }
281+
});
282+
});
269283
});
270284

271285
describe('build()', () => {

test/types/array.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,8 @@ describe('array', () => {
14651465
label: 'value',
14661466
value: [null, 1, 2]
14671467
}
1468-
}]
1468+
}],
1469+
[{}, false, '"value" must be an array']
14691470
]);
14701471
});
14711472

@@ -1634,7 +1635,8 @@ describe('array', () => {
16341635
label: 'value',
16351636
value: [0, '1']
16361637
}
1637-
}]
1638+
}],
1639+
[{}, false, '"value" must be an array']
16381640
]);
16391641
});
16401642

0 commit comments

Comments
 (0)