Upgrading pydantic 0.17 to 0.18
Breaking0.17 → 0.18.2Breaking2New3Changed1Fixed3
BreakingUpgrade verdict
2 breaking changes.
In plain terms
- breaking change: Set BaseConfig attributes min_anystr_length and max_anystr_length to None by default in.
- breaking change: don't call validators on keys of dictionaries.
Must act 2 items need code or config changes
What you must change
Breaking2
breaking change: Set BaseConfig attributes min_anystr_length and max_anystr_length to None by default in.
BaseConfigmin_anystr_lengthmax_anystr_lengthNonebreaking change: don't call validators on keys of dictionaries.
API changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- added:
class Validator - added:
class ValidatorGroup - added:
class ValidatorSignature(IntEnum) - added:
constructor ValidatorGroup(validators) - added:
field Validator.always: bool - added:
field Validator.check_fields: bool - added:
field Validator.func: Callable - added:
field Validator.pre: bool - added:
field Validator.whole: bool - added:
field ValidatorSignature.CLS_JUST_VALUE - added:
field ValidatorSignature.CLS_VALUE_KWARGS - added:
field ValidatorSignature.JUST_VALUE - added:
field ValidatorSignature.VALUE_KWARGS - added:
function extract_validators(namespace) - added:
function get_validator_signature(validator) - added:
function inherit_validators(base_validators, validators) - added:
function validator(*fields, pre: bool=…, whole: bool=…, always: bool=…, check_fields: bool=…) - added:
method ValidatorGroup.check_for_unused() - added:
method ValidatorGroup.get_validators(name)
- added:
class NoneIsAllowedError(PydanticTypeError) - added:
field NoneIsAllowedError.code - added:
field NoneIsAllowedError.msg_template
- removed:
class Validator(NamedTuple) - removed:
class ValidatorSignature(IntEnum) - removed:
field Validator.always: bool - removed:
field Validator.check_fields: bool - removed:
field Validator.func: Callable - removed:
field Validator.pre: bool - removed:
field Validator.whole: bool - removed:
field ValidatorSignature.CLS_JUST_VALUE - removed:
field ValidatorSignature.CLS_VALUE_KWARGS - removed:
field ValidatorSignature.JUST_VALUE - removed:
field ValidatorSignature.VALUE_KWARGS - changed:
constructor Field(*, name: str, type_: Type, class_validators: Dict[str, Validator], default: Any, required: bool, model_config: Any, alias: str=…, allow_none: bool=…, schema=…) → constructor Field(*, name: str, type_: Type, class_validators: Optional[Dict[str, Validator]], model_config: Any, default: Any=…, required: bool=…, alias: str=…, schema=…) - added:
method Field.include_in_schema() -> bool - added:
method Field.is_complex()
- removed:
class ValidatorGroup - removed:
constructor ValidatorGroup(validators) - removed:
function inherit_validators(base_validators, validators) - removed:
function validator(*fields, pre: bool=…, whole: bool=…, always: bool=…, check_fields: bool=…) - removed:
method ValidatorGroup.check_for_unused() - removed:
method ValidatorGroup.get_validators(name) - changed:
function validate_model(model, input_data: dict, raise_exc=…) → function validate_model(model: BaseModel, input_data: dict, raise_exc=…) - added:
static method BaseModel.update_forward_refs(**localns)
- added:
class ConstrainedBytes(bytes) - added:
field ConstrainedBytes.max_length: Optional[int] - added:
field ConstrainedBytes.min_length: Optional[int] - added:
field ConstrainedBytes.strip_whitespace - added:
function conbytes(*, strip_whitespace=…, min_length=…, max_length=…) -> Type[bytes]
- added:
function resolve_annotations(raw_annotations, module) - added:
variable ForwardRef
- added:
function is_none_validator(v)