Function modifiers
avroHint
Commentary
added in 1.0.9
Explicitly defines how this data will be represented if ShadowTraffic automatically creates its Avro schema.
Examples
Overriding Avro types
For the most part, ShadowTraffic is able to automatically infer an Avro schema for the data you want to generate. But sometimes, it either guesses wrong or isn't capable of statically determing it.
For those situations, use avroHint to explicitly define the type.
In this example, avroHint overrides ShadowTraffic's guess that weightedOneOf should produce a union type.
{
"topic": "sandbox",
"value": {
"b": {
"_gen": "uniformDistribution",
"bounds": [
1,
10
]
},
"c": {
"_gen": "weightedOneOf",
"choices": [
{
"weight": 1,
"value": "d"
},
{
"weight": 2,
"value": "e"
}
],
"avroHint": {
"type": "string"
}
}
}
}
Specification
JSON schema
{
"type": "string"
}