avro-random-generator
avro-random-generator copied to clipboard
README is unclear
I think that the readme misses some examples to understand the correct syntaxes. It would be helpfull to give example for each flags and the corresponding schema used for each use case. Thanks !
There's already tons of examples in the README, what specifically do you think should be added?
You could for example document the way this works through use cases from command line.
As a user I want to use not to guess the way it works.
A simple usage is for example :
./arg -f ../yourSchema.json --json -o output.json -i 10
where yourSchema.json could be something like :
{
"type": "record",
"name": "options_test_record",
"fields": [
{
"name": "myUuid",
"type": {
"type": "string",
"arg.properties": {
"regex": "[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}"
}
}
},
{
"name": "myEnumType",
"type": {
"type": "enum",
"name": "enum_test",
"symbols": [
"MY_VALUE_1",
"MY_VALUE_2",
"MY_VALUE_3"
],
"arg.properties":
{
"options": [
"MY_VALUE_1",
"MY_VALUE_2",
"MY_VALUE_3"
]
}
}
},
{
"name": "myNumber",
"type": {
"type": "int",
"arg.properties": {
"range" : {"min": 1, "max": 10}
}
}
}
]
}
May be I missused the enum type but I was surprised to see I had to add both 'symbols' and 'options' fields. I would have thought to define the different values of the enum, the name of the field and the library would need nothing more to generate the data. In this example we defined an input example and to make it clear we would need to show the output.
Does it make sense ?
Ah, CLI examples could be useful.
With regards to the enum example--are you familiar with Avro at all? Because that's a bit of a prerequisite for using this tool. We also clearly demonstrate here that you do not need to specify a value for options
when using an enum, and here we show that, when you do, it can be used to narrow down which enum values are emitted by the generator.
I did some Avro yes.
Thank you I saw that it was possible to narrow down the number of values of the source Enum, but I find it weard actually.
I guess it could be used when you dynamically change your schema file depending on a specific use case.
Finally as you said I did not need the options part, it works great thank you!
"arg.properties":{
"options": [