erdantic.plugins.pydantic¶
get_fields_from_pydantic_model
¶
Given a Pydantic model, return a list of FieldInfo instances for each field in the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
PydanticModel
|
The Pydantic model to get fields from. |
required |
Returns:
| Type | Description |
|---|---|
list[FieldInfo]
|
List of FieldInfo instances for each field in the model |
Source code in erdantic/plugins/pydantic.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
get_fields_from_pydantic_v1_model
¶
Given a Pydantic V1 model, return a list of FieldInfo instances for each field in the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
PydanticV1Model
|
The Pydantic V1 model to get fields from. |
required |
Returns:
| Type | Description |
|---|---|
list[FieldInfo]
|
List of FieldInfo instances for each field in the model |
Source code in erdantic/plugins/pydantic.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
get_type_annotation_from_pydantic_v1_field
¶
get_type_annotation_from_pydantic_v1_field(
field_info: ModelField,
) -> type
Utility function to get the type annotation from a Pydantic V1 field info object.
Source code in erdantic/plugins/pydantic.py
135 136 137 138 139 140 141 142 | |
is_pydantic_model
¶
is_pydantic_model(obj: Any) -> TypeGuard[PydanticModel]
Predicate function to determine if an object is a Pydantic model (not an instance).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
The object to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the object is a Pydantic model, False otherwise. |
Source code in erdantic/plugins/pydantic.py
28 29 30 31 32 33 34 35 36 37 | |
is_pydantic_v1_model
¶
is_pydantic_v1_model(obj) -> TypeGuard[PydanticV1Model]
Predicate function to determine if an object is a Pydantic V1 model (not an instance).
This is for models that use the legacy pydantic.v1 namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Any
|
The object to check. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the object is a Pydantic V1 model, False otherwise. |
Source code in erdantic/plugins/pydantic.py
84 85 86 87 88 89 90 91 92 93 94 | |