2022-02-24 19:15:13 +01:00
|
|
|
exports.object = (props, opts) => {
|
2022-02-25 00:25:03 +01:00
|
|
|
const base = {
|
2022-02-22 16:06:08 +01:00
|
|
|
type: "object",
|
|
|
|
properties: props,
|
2022-02-24 19:15:13 +01:00
|
|
|
...opts,
|
2022-02-22 16:06:08 +01:00
|
|
|
}
|
2022-02-25 00:25:03 +01:00
|
|
|
if (Object.keys(props).length > 0 && (!opts || !opts.required)) {
|
|
|
|
base.required = Object.keys(props)
|
|
|
|
}
|
|
|
|
return base
|
2022-02-22 16:06:08 +01:00
|
|
|
}
|