avrora v0.1.0-beta Avrora.Schema View Source
A wrapper struct around AvroEx.Schema and Confluent Schema Registry for more convinient use.
Link to this section Summary
Functions
Parses a Map payload and converts it to the schema with id, AvroEx representation and Map representation.
Link to this section Types
Link to this type
t()
View Source
t()
View Source
t() :: %Avrora.Schema{
ex_schema: AvroEx.Schema.t(),
id: nil | integer(),
raw_schema: map(),
version: nil | integer()
}
t() :: %Avrora.Schema{ ex_schema: AvroEx.Schema.t(), id: nil | integer(), raw_schema: map(), version: nil | integer() }
Link to this section Functions
Link to this function
parse(payload) View Source
Parses a Map payload and converts it to the schema with id, AvroEx representation and Map representation.
Examples
iex> payload = %{"namespace" => "io.confluent", "type" => "record", "name" => "Payment", "fields" => [%{"name" => "id", "type" => "string"}, %{"name" => "amount", "type" => "double"}]}
iex> {:ok, avro} = Avrora.Schema.parse(payload)
iex> avro.ex_schema.schema.qualified_names
["io.confluent.Payment"]
iex> Map.get(avro.raw_schema, "name")
"Payment"