Authors: Ilya Staheev (ilya.staheev@klarna.com).
array_type() = #avro_array_type{type = avro:type_or_name(), custom = [avro:custom_prop()]}
avro_type() = primitive_type() | array_type() | enum_type() | fixed_type() | map_type() | record_type() | union_type()
avro_value() = avro:canonicalized_value() | #avro_value{type = avro:type_or_name(), data = avro:avro_value()} | [#avro_value{type = avro:type_or_name(), data = avro:avro_value()}] | [{avro:name(), #avro_value{type = avro:type_or_name(), data = avro:avro_value()}}] | avro_map:data() | {json, binary()} | {binary, binary()}
decoder_hook_fun() = fun((avro_type(), name() | integer(), avro:in(), fun((avro:in()) -> avro:out())) -> avro:out())
decoder_options() = #{encoding := avro_binary | avro_json, map_type := proplist | map, record_type := proplist | map, is_wrapped := boolean(), hook := decoder_hook_fun()}
default_parse_fun() = fun((type_or_name(), json_value()) -> avro:out())
enum_type() = #avro_enum_type{name = avro:name(), namespace = avro:namespace(), aliases = [avro:name()], doc = avro:typedoc(), symbols = [avro:enum_symbol()], fullname = avro:fullname(), custom = [avro:custom_prop()]}
fixed_type() = #avro_fixed_type{name = avro:name(), namespace = avro:namespace(), aliases = [avro:name()], size = pos_integer(), fullname = avro:fullname(), custom = [avro:custom_prop()]}
fullname() = binary()
json_value() = jsone:json_value()
lkup_fun() = fun((fullname()) -> avro_type())
map_type() = #avro_map_type{type = avro:type_or_name(), custom = [avro:custom_prop()]}
name() = binary()
name_raw() = atom() | string() | binary()
primitive_type() = #avro_primitive_type{name = avro:name(), custom = [avro:custom_prop()]}
record_type() = #avro_record_type{name = avro:name(), namespace = avro:namespace(), doc = avro:typedoc(), aliases = [avro:name()], fields = [avro:record_field()], fullname = avro:fullname(), custom = [avro:custom_prop()]}
sc_opts() = avro:schema_opts()
schema_store() = avro_schema_store:store()
type_or_name() = avro_type() | name_raw()
union_type() = #avro_union_type{id2type = avro_union:id2type(), name2id = avro_union:name2id()}
decode_schema/1 | Decode JSON format avro schema into erlavro internals. |
decode_schema/2 | Decode JSON format avro schema into erlavro internals. |
decode_value/3 | Decode value with default options and default hook. |
decode_value/4 | Decode JSON encoded payload to wrapped (boxed) #avro_value{} record, or unwrapped (unboxed) Erlang term. |
parse/4 | |
parse_schema/1 |
decode_schema(JSON::binary()) -> avro_type()
Decode JSON format avro schema into erlavro internals.
decode_schema(JSON::binary(), Opts::sc_opts()) -> avro_type()
Decode JSON format avro schema into erlavro internals.
Supported options:
* ignore_bad_default_values: boolean()
Some library may produce invalid default values,
if this option is set, bad default valus will be whatever values
obtained from JSON decoder.
However, the encoder built from this schema may crash in case bad default
value is used (e.g. when a record field is missing from encoder input)
* allow_bad_references: boolean()
This option is to allow referencing to a name reference to a non-existing
type. This allow types to be defined in multiple JSON schema files
and all imported to schema store to construct a valid over-all schema.
* allow_type_redefine: boolean()
This option is to allow one type being defined more than once.
decode_value(JsonValue::binary(), Schema::type_or_name(), StoreOrLkupFun::schema_store() | lkup_fun()) -> avro_value()
Decode value with default options and default hook.
decode_value(JsonValue::binary(), Schema::type_or_name(), MaybeLkup::avro:schema_all(), Options::decoder_options()) -> avro_value() | avro:out()
Decode JSON encoded payload to wrapped (boxed) #avro_value{} record, or unwrapped (unboxed) Erlang term. Options: is_wrapped (optional, default = true) By default, this function returns #avro_value{} i.e. all values are wrapped together with the type info. If {is_wrapped, false} is given in Options, it returns unwrapped values which is equivalent as calling avro_xxx:to_term/1 recursively Unwrapped values for each avro type as in erlang spec: null: 'null'. int: integer(). long: integer(). float: float(). double: float(). bytes: binary(). string: binary(). enum: binary(). fixed: binary(). union: avro:out(). array: [avro:out()]. map: [{Key :: string(), Value :: avro:out()}]. record: [{FieldName() :: binary(), FieldValue :: avro:out()}]}
parse(Value::json_value(), TypeName::type_or_name(), Lkup::lkup_fun(), Options::decoder_options()) -> avro_value() | avro:out() | no_return()
parse_schema(Array::json_value()) -> avro_type() | no_return()
Generated by EDoc