idonttrustlikethat
idonttrustlikethat copied to clipboard
Update meta data of dictionnary
As a maintainer of https://github.com/nielk/idonttrustlikethat-fast-check I got troubles to figure out how to convert idtlt dictionary into fast-check Arbitrary.
The main reason is that idtlt.dictionary(union('Foo', 'Bar'), number)
returns only meta value with number type:
{
"meta": {
"tag": "dictionary",
"value": {
"meta": {
"tag": "number"
}
}
}
}
I would expect meta data with union type described, something like:
{
"meta": {
"tag": "dictionary",
"value": {
"meta": {
"tag": [{
"union": [
{
"meta": {},
"literal": "Foo"
},
{
"meta": {},
"literal": "Bar"
}
],
"tag": "union"
},
"number"]
}
}
}
}
Consequently, the following validator const dict = idtlt.dictionary(idtlt.union('Foo', 'Bar'), string)
will return no information about the key type 'Foo' | 'Bar'
so I can't convert it correctly to fast-check arbitrary.
Do you mind if you can expose more details in the meta data ?
Here is a complete exemple: playground
I believe the following line would resolve my issue: https://github.com/AlexGalays/idonttrustlikethat/pull/21/files#diff-8abac0f2a235a62814031a3fb26f4846ec5c12760f528e8bcc4d29778f49f982R453