-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
ideaJust an idea that could become feature request after some requirement investigationJust an idea that could become feature request after some requirement investigation
Description
I want it to be declarative as fuck, so why don't I implement contract-programming features for actions?
It could be schema arguments validation or even by function
And I want the same (schema/function validation) to self-check what have action returned
So design by contract usually describes 4 steps for functions: expect/require for args, and returns/ensure for result
Action({
fn(deps) {
return () => {}; // the action itself
}
expect: [ // json schema for each argument here (what to do with spread args?)
{
type: 'string',
pattern: '^[0-9]{1,19}$'
},
{
type: 'array'
minItems: 1,
items: [{
type: 'string',
}]
}
],
require(x, y) {
// do some validation
},
returns: {} // json schema here too
ensure() {} // function here
});Metadata
Metadata
Assignees
Labels
ideaJust an idea that could become feature request after some requirement investigationJust an idea that could become feature request after some requirement investigation