roboto.sentinels
Module Contents
NotSet
NotSetType
Bases: pydantic.BaseModel
A sentinel value for fields (e.g. kwargs) that are not set, useful when ‘None’ is a meaningful value.
It extends pydantic.BaseModel so that it integrates nicely with pydantic’s schema generation/json serialization.
NotSetType.openapi_schema_modifier()
Replace NotSetType with null in anyOf lists.
To use in pydantic.BaseModel, add the following to your model: >>> class Config: … schema_extra = NotSetType.openapi_schema_modifier
See https://docs.pydantic.dev/1.10/usage/schema/#schema-customization
Parameters
schema dict[str, Any]model AnyReturn type
Null
PydanticModel
T
is_any_set()
Checks whether a Pydantic model has at least one field that is explicitly set.
Parameters
value PydanticModelReturn type
is_not_set()
Parameters
value AnyReturn type
is_set()
Parameters
value Union[T, NotSetType]Return type
maybe_null()
null
remove_not_set()
This function round-trips a pydantic model through initialization while ensuring that NotSetType values are not explicitly set. This allows value.model_dump(exclude_unset=True) to be used to generate a correct payload.
Parameters
value PydanticModelReturn type
value_or_default_if_unset()
Parameters
value Union[T, NotSetType]default TReturn type
value_or_not_set()
Parameters
value Optional[T]Return type