utils
Things that make working with DTOs nicer.
config ¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
purpose |
Purpose | Literal['read', 'write']
|
Is the DTO for parsing "write" data, or serializing "read" data? |
required |
exclude |
set[str] | None
|
Omit fields from dto by key name. |
None
|
Returns:
Type | Description |
---|---|
DTOConfig
|
|
field ¶
Create dto.DTOField()
wrapped in a dict for SQLAlchemy info field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mark |
Mark | Literal['read-only', 'private'] | None
|
How this field should be treated by the model factory. |
None
|
pydantic_type |
Any | None
|
Override the type annotation for this field. |
None
|
pydantic_field |
FieldInfo | None
|
Result of Pydantic's |
None
|
validators |
Iterable[Callable[[Any], Any]] | None
|
Added to the generated model as validators, with |
None
|