View Source ConfluentSchema

Provides cache and validation for confluent schemas that are pulled from a registry.

It mixes

To provide fast validation for schemas registered remotely on a registry server, for example confluent.cloud.

installation

Installation

def deps do
  [
    {:confluent_schema, "~> 0.1.1"}
  ]
end

usage

Usage

On application.ex:

  def start(_type, _args) do
    opts = [
      period: :timer.seconds(10),
      debug: true,
      base_url: "https://foobar.region.aws.confluent.cloud",
      username: "key",
      password: "api secret",
    ]

    children = [
      {ConfluentSchema, opts}
    ]

    supervisor_opts = [strategy: :one_for_one, name: MyApp.Supervisor]
    Supervisor.start_link(children, supervisor_opts)
  end

Then you can use confluent schema registry to validate payloads for a subject:

payload = %{foo: "bar"}
ConfluentSchema.validate(payload, "my-subject")

Check out ConfluentSchema.child_spec/1 for documentation about all options.