CamelCaseModel#
- class safir.pydantic.CamelCaseModel(**data)#
Bases:
BaseModel
pydantic.BaseModel
configured to accept camel-case input.This is a convenience class identical to
BaseModel
except with an alias generator configured so that it can be initialized with either camel-case or snake-case keys. Model exports withdict
orjson
also default to exporting in camel-case.- Parameters:
data (
Any
) –
Methods Summary
dict
(*[, include, exclude, by_alias, ...])Export the model as a dictionary.
json
(*[, include, exclude, by_alias, ...])Export the model as JSON.
Methods Documentation
- dict(*, include=None, exclude=None, by_alias=True, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False)#
Export the model as a dictionary.
Overridden to change the default of
by_alias
fromFalse
toTrue
, so that by default the exported dictionary uses camel-case.- Parameters:
include (
Union
[AbstractSet
[Union
[int
,str
]],Mapping
[Union
[int
,str
],Any
],None
], default:None
) –exclude (
Union
[AbstractSet
[Union
[int
,str
]],Mapping
[Union
[int
,str
],Any
],None
], default:None
) –by_alias (
bool
, default:True
) –exclude_unset (
bool
, default:False
) –exclude_defaults (
bool
, default:False
) –exclude_none (
bool
, default:False
) –
- Return type:
- json(*, include=None, exclude=None, by_alias=True, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs)#
Export the model as JSON.
Overridden to change the default of
by_alias
fromFalse
toTrue
, so that by default the exported dictionary uses camel-case.- Parameters:
include (
Union
[AbstractSet
[Union
[int
,str
]],Mapping
[Union
[int
,str
],Any
],None
], default:None
) –exclude (
Union
[AbstractSet
[Union
[int
,str
]],Mapping
[Union
[int
,str
],Any
],None
], default:None
) –by_alias (
bool
, default:True
) –exclude_unset (
bool
, default:False
) –exclude_defaults (
bool
, default:False
) –exclude_none (
bool
, default:False
) –models_as_dict (
bool
, default:True
) –dumps_kwargs (
Any
) –
- Return type: