nadia.builder_provider module

Implementation of class responsible for obtaining schema builders for OpenAPI types.

class nadia.builder_provider.BuilderProvider(builders)

Bases: object

Class for providing builders for various data types.

Parameters:builders (dict) – mapping between OpenAPI types and classes implementing builder interface for them.


The purpose of this class is to act as a mapping between types and corresponding builders, while elegantly handling unknown types and lazy creation of the builders. It is injected as a dependency in nadia.api.SchemaBuilder.


Get builder instance for given OpenAPI type.

Parameters:typename (str) – OpenAPI type for which to get a builder.
Returns:a builder corresponding to given type.
Return type:a subclass of nadia.common.Builder
Raises:nadia.exceptions.UnknownTypeException if typename does not correspond to known OpenAPI type.
static get_default()

Construct BuilderProvider with default builders.

Return type:nadia.builder_provider.BuilderProvider

Logger used by this BuilderProvider.