View Source ConfluentSchema.Registry (confluent_schema v0.1.3)
Http interface for Confluent Schema.
Link to this section Summary
Functions
Creates a client to interact with Confluent Schema Registry.
Get the latest Confluent schemas from the server. Decode the JSON schemas into maps.
Link to this section Functions
@spec create(Keyword.t()) :: Tesla.Client.t()
Creates a client to interact with Confluent Schema Registry.
@spec get_subject_schemas(Tesla.Client.t()) :: {:ok, map()} | {:error, atom(), integer(), any()}
Get the latest Confluent schemas from the server. Decode the JSON schemas into maps.
examples
Examples
iex> client = RegistryMock.create()
iex> Registry.get_subject_schemas(client)
{:ok, %{"foo" => %{"type" => "string"}, "bar" => %{"type" => "string"}}}
iex> client = RegistryMock.create_error_subject()
iex> Registry.get_subject_schemas(client)
{:error, :get_subjects, 404, "Not Found"}
iex> client = RegistryMock.create_error_schema()
iex> Registry.get_subject_schemas(client)
{:error, :get_schema, 404, "Not Found"}
iex> client = RegistryMock.create_error_decode()
iex> Registry.get_subject_schemas(client)
{:error, :decode_schema, 1, %Jason.DecodeError{position: 0, token: nil, data: "invalid json"}}