-
Couldn't load subscription status.
- Fork 10
Description
A unified data syntax (UDS) allows expressing any sort of random data (strings, integers, words, phone numbers, coordinates, arrays, etc.). The existing schemes for any data can be converted into a UDS string, which can then be parsed to create random data. This is somewhat similar to "inverting" a regex (i.e. generating a random string that matches a regex), except that the regex syntax is not well-suited for this problem (no native support for ranges, hard to read, dictionaries result in very long strings).
Instead of giving each data action a generateStrings method, each scheme can be compiled to a UDS string which has the #random(Random) method to instantiate a random string that matches the UDS.
This system will pave the way to creating arbitrary new data types, and in particular will allow users to create their own data types. It will also make it easier to add many presets that do not necessarily match any particular data type, but without cluttering any menus. Note that this issue is not about implementing new data types; the goal here is only to introduce the UDS.
Currently, I envision UDS to be similar to the string representations of Kotlin data classes, except that default values can be left out. For example, to create an integer in the range [0, 15], the UDS would be Int[min=0, max=15]. To generate two integers in different ranges with a dash in between would then be Int[min=0, max=15]-Int[min=5, max=15]. Naturally, it should be possible to escape this syntax to allow users to insert literally the string Int[min=0, max=15]; and spaces should be ignored (except in strings).
Other native types should be Dec (decimal), Str (string), Word (word), Time (to insert current time?), maybe UUID if this one cannot be represented with the other types.
I should start with a basic syntax. After this issue, no new functionalities are directly exposed to users; this issue does not yet give users the ability to insert new data types.