11 lines
339 B
JavaScript
11 lines
339 B
JavaScript
import * as F from '@efforting.tech/data/field-configuration-factories';
|
|
|
|
const s = new F.Schema({
|
|
foo: F.value(123, 'The value'),
|
|
bar: F.factory((t) => `Field ${t.name} was not set`, 'The factory'),
|
|
rq: F.required('Anything. Just not nothing.'),
|
|
}, 'Some schema');
|
|
|
|
|
|
console.log(s.load()) // { foo: 123, bar: 'Field bar was not set' }
|