View Source Avrogen.AvroModule behaviour (avrogen v0.7.1)
Behaviour for generated record modules.
Summary
Callbacks
The fully qualified avro name of this record type.
The name of the schema that defines the record represented by this module.
Turn a raw map from an erlavro decoding operation into (nested) structs as defined by the generated avro modules.
Whether embedded schemas should be scoped to the type they are defined in.
Turn a (nested) struct (as defined by the generated avro modules) into an intermediate map that can be passed to a suitable erlavro encoder.
Callbacks
@callback avro_fqn() :: String.t()
The fully qualified avro name of this record type.
@callback avro_schema_name() :: String.t()
The name of the schema that defines the record represented by this module.
Turn a raw map from an erlavro decoding operation into (nested) structs as defined by the generated avro modules.
@callback scope_embedded_types?() :: boolean()
Whether embedded schemas should be scoped to the type they are defined in.
For example, for the following schema
{
"name": "Event",
"namespace": "events",
"type": "record",
"fields": [
{
"name": "details",
"type": {
"name": "Subtype",
"type": "record",
"fields": [
...
]
}
}
]
}
If set to true
the internal type would be called "Events.Event.Subtype", otherwise, it would be
"Events.Subtype".
If not provided default to false
Turn a (nested) struct (as defined by the generated avro modules) into an intermediate map that can be passed to a suitable erlavro encoder.