Closed alex35mil closed 3 years ago
We have this use case quite often and so far we have been putting it into another field on the input
which is definitely clumsy and doesn't feel correct. Adding a data
or metadata
sounds like a fantastic change to me.
metadata
sounds perfect 👍
We would love to have this concept to separate "hacky" fake inputs to a designated location to store data later needed to run validations.
One thing to mention here. We would require an API that allows us to update these metadata
fields as these can be dynamic or change at a later time.
I would love to help make this happen but the PPX stuff is a bit over my head, is there anything we can do to speed this feature up?
@dan003400 I will look into this in upcoming weeks
Sometimes, converting
input
tooutput
requires some additional metadata. E.g. there is a select in UI with a list of items, each item is ofFoo.t
type which is a record{id: int, label: string}
. Select's value is stringifiedid
. In the output, there should beFoo.t
. To get the output value in validator,array(Foo.t)
is required.It's achievable in the current state of things by:
input
Foo.t
instead of stringified idfoos: array(Foo.t)
so it's available in validatorBut neither looks nice to me.
Proposal: introduce an optional
metadata
type. If defined, it would be passed as a second argument to validators.