adaptix.integrations.pydantic package

Module contents

adaptix.integrations.pydantic.native_pydantic(
*preds: str | Pattern | type | Any | LocStackChecker | LocStackPattern,
config: ConfigDict | None = None,
validate_python: ValidatePythonParams | None = None,
to_python: ToPythonParams | None = None,
) Provider

Provider that represents value via pydantic. You can use this function to validate or serialize pydantic models via pydantic itself. Provider constructs TypeAdapter for a type to load and dump data.

Parameters:
  • preds – Predicates specifying where the provider should be used. The provider will be applied if any predicates meet the conditions, if no predicates are passed, the provider will be used for all Enums. See Predicate system for details.

  • validate_python – Dict directly unpacked to .validate_python() method

  • to_python – Dict directly unpacked to .to_python() method

  • config – Parameter passed directly to config parameter of TypeAdapter constructor

Returns:

Desired provider