budibase/packages/server/specs/resources/utils/index.ts

12 lines
256 B
TypeScript

export const object = (props: any, opts?: any) => {
const base = {
type: "object",
properties: props,
...opts,
}
if (Object.keys(props).length > 0 && (!opts || !opts.required)) {
base.required = Object.keys(props)
}
return base
}