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
34 35 36 37 38 39 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 |
|
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
91 92 93 94 95 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 |
|
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
130 131 132 133 134 135 |
|
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
22 23 24 25 26 27 28 29 30 31 |
|
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
78 79 80 81 82 83 84 85 86 87 88 |
|