base
NullableBaseModel
Bases: BaseModel
Base model that allows fields to be None. This is useful for cases where fields may not always have a value.
null
classmethod
Returns a null instance of the model with all fields set to None. This is useful for cases where no data is expected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quiet
|
bool
|
If True, suppresses logging of the null response (default: True) |
True
|
Returns:
| Type | Description |
|---|---|
Self
|
A null instance of the model with all fields set to None. |
Source code in src/nexosapi/domain/base.py
model_dump
model_dump(
*,
mode: Literal["json", "python"] = "python",
include: IncEx | None = None,
exclude: IncEx | None = None,
context: Any | None = None,
by_alias: bool | None = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False,
round_trip: bool = False,
warnings: bool
| Literal["none", "warn", "error"] = True,
fallback: Callable[[Any], Any] | None = None,
serialize_as_any: bool = False,
) -> dict[str, Any]
Dumps the model to a dictionary, excluding fields that are None.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
Literal['json', 'python']
|
The mode to use for dumping the model (json or python). |
'python'
|
include
|
IncEx | None
|
Fields to include in the output. |
None
|
exclude
|
IncEx | None
|
Fields to exclude from the output. |
None
|
context
|
Any | None
|
Contextual information to include in the output. |
None
|
by_alias
|
bool | None
|
Whether to use field aliases in the output. |
None
|
exclude_unset
|
bool
|
Whether to exclude unset fields from the output. |
False
|
exclude_defaults
|
bool
|
Whether to exclude fields with default values from the output. |
False
|
exclude_none
|
bool
|
Whether to exclude fields with None values from the output. |
False
|
round_trip
|
bool
|
Whether to enable round-trip serialization. |
False
|
warnings
|
bool | Literal['none', 'warn', 'error']
|
Warning level for the serialization process. |
True
|
fallback
|
Callable[[Any], Any] | None
|
Fallback function to call in case of serialization errors. |
None
|
serialize_as_any
|
bool
|
Whether to serialize the model as "any" type. |
False
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dictionary representation of the model. |