Link should apply for put and update by default #871
lucas-subli
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
@lucas-subli Not against it, but it would be a breaking change so I will not implement it right away, but rather toward the end of the year. I was also thinking about using a single .and((prevSchema) => ({
// 'onPut' by default
someAttribute: string().link<typeof prevSchema>(item => ...),
// Similar to:
someAttribute: string().link<typeof prevSchema>('onPut', item => ...),
// For updates:
someAttribute: string().link<typeof prevSchema>('onUpdate', item => ...),
// 'onKey' by default for key attribute:
someAttribute: string().key().link<typeof prevSchema>(item => ...),
})); This way I can create a |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As stated in the docs:
In a situation where you need the link to work on both situations (setting up a preconfigured
_ttl
for example)You must write the same code twice, one for putLink and one for updateLink.
My proposal is for
link
to be a shorthand for both, and if needed, you can use the individual ones for fine-tuning.Example of usage:
This would run both on PUT and UPDATE, so the TTL would be set on item creation and any subsequent updates if the start time ever changes.
Beta Was this translation helpful? Give feedback.
All reactions