Type Aliases
The following type aliases are used throughout the anyschema codebase:
anyschema.typing
Adapter
module-attribute
Adapter: TypeAlias = Callable[[Any], FieldSpecIterable]
Adapter expected signature.
An adapter is a callable that adapts a spec into field specifications.
FieldSpec
module-attribute
FieldSpec: TypeAlias = tuple[FieldName, FieldType, FieldConstraints, FieldMetadata]
Field specification: alias for a tuple of (str, type, tuple(constraints, ...), dict(metadata)).
FieldSpecIterable
module-attribute
FieldSpecIterable: TypeAlias = Generator[FieldSpec, None, None]
Return type of an adapter.
IntoOrderedDict
module-attribute
IntoOrderedDict: TypeAlias = Mapping[str, type] | Sequence[tuple[str, type]]
An object that can be converted into a python OrderedDict.
We check for the object to be either a mapping or a sequence of sized 2 tuples.
IntoParserPipeline
module-attribute
IntoParserPipeline: TypeAlias = "Literal['auto'] | Sequence[ParserStep]"
An object that can be converted into a ParserPipeline.
Either "auto" or a sequence of ParserStep.
Spec
module-attribute
Spec: TypeAlias = 'Schema | IntoOrderedDict | type[BaseModel] | DataclassType | TypedDictType | AttrsClassType | SQLAlchemyTableType | UnknownSpec'
Input specification supported directly by AnySchema.