View Source Avrogen.Schema (avrogen v0.8.1)

Utils for extracting various info from avro schemas. Schemas can be records or enums.

Summary

Functions

Get a list of external types referenced in a given record/enum.

Get a schema's fully qualified name by combining its namespace and name.

Load a schema from a file.

Get a schema's name.

Get a schema's namespace.

Resolve a schema's file path from its fqn.

Sort a list of avro schemas in topological order based on dependencies.

Types

@type schema() :: map()

Functions

Link to this function

external_dependencies(arg1)

View Source
@spec external_dependencies(schema()) :: [String.t()]

Get a list of external types referenced in a given record/enum.

@spec fqn(schema()) :: String.t()

Get a schema's fully qualified name by combining its namespace and name.

Link to this function

load_schema!(path_to_schema)

View Source
@spec load_schema!(Path.t()) :: schema()

Load a schema from a file.

@spec name(schema()) :: String.t()

Get a schema's name.

@spec namespace(schema()) :: String.t()

Get a schema's namespace.

Note: Unsure what to do if the schema has no namespace - make it a MatchError for now...

Link to this function

path_from_fqn(root, schema_fqn, atom)

View Source
@spec path_from_fqn(Path.t(), String.t(), :flat | :tree) :: Path.t()

Resolve a schema's file path from its fqn.

Link to this function

topological_sort(elements)

View Source
@spec topological_sort([schema()]) :: {:ok, [schema()]} | {:error, any()}

Sort a list of avro schemas in topological order based on dependencies.