Avrora.Schema.ReferenceCollector (avrora v0.23.0) View Source

Collect non local type references from erlavro structures.

Link to this section Summary

Functions

Collect non local type referenced types from erlavro structure.

Link to this section Functions

Specs

collect(term()) :: {:ok, [String.t()]} | {:error, term()}

Collect non local type referenced types from erlavro structure.

Type definition aliases counted as type definitions too.

Every json-string type value considered to be a reference if it's not one of the reserved by Avro Specification types, such as:

  • int - null - enum
  • long - boolean - array
  • float - string - map
  • double - record - union
  • bytes - fixed

Examples

iex> json_schema = File.read!("test/fixtures/schemas/io/confluent/Account.avsc")
iex> erlavro = :avro_json_decoder.decode_schema(json_schema, allow_bad_references: true)
iex> Avrora.Schema.ReferenceCollector.collect(erlavro)
{:ok, ["io.confluent.Email", "io.confluent.Messenger", "io.confluent.PaymentHistory"]}