PydanticSchemaManagerDependency#

class kafkit.fastapi.dependencies.pydanticschemamanager.PydanticSchemaManagerDependency#

Bases: object

A FastAPI dependency that provides a Kafkit PydanticSchemaManager for serializing Pydantic models into Avro.

Methods Summary

__call__()

Get the dependency (call during FastAPI request handling).

initialize(*, http_client, registry_url, models)

Initialize the dependency (call during FastAPI startup).

Methods Documentation

async __call__()#

Get the dependency (call during FastAPI request handling).

Return type:

PydanticSchemaManager

async initialize(*, http_client, registry_url, models, suffix='', compatibility='FORWARD')#

Initialize the dependency (call during FastAPI startup).

Parameters:
  • http_client (AsyncClient) – The httpx AsyncClient instance to use for HTTP requests.

  • registry_url (str) – The URL of the Schema Registry.

  • models (Iterable[type[AvroBaseModel]]) – The Pydantic models to register.

  • suffix (str, default: '') – A suffix that is added to the schema name (and thus subject name), for example _dev1.

  • compatibility (str, default: 'FORWARD') – The compatibility level to use when registering the schemas.

Return type:

None