MCPcopy
hub / github.com/pydantic/pydantic / wrapped_field_serializer

Method wrapped_field_serializer

tests/test_validators.py:3060–3061  ·  view source on GitHub ↗
(cls, field_value, validator)

Source from the content-addressed store, hash-verified

3058 @field_validator('nested', mode='wrap')
3059 @classmethod
3060 def wrapped_field_serializer(cls, field_value, validator):
3061 return validator(field_value)
3062
3063 my_model = MyParentModel.model_validate({'nested': {'inner_value': 'foo'}})
3064 assert my_model.nested.inner_value == 'wrap_prefix:foo'

Callers

nothing calls this directly

Calls 1

validatorFunction · 0.90

Tested by

no test coverage detected