Annotated Handlers
Type annotations to use with __get_pydantic_core_schema__ and __get_pydantic_json_schema__.
GetJsonSchemaHandler ¶
次のJSONスキーマ生成関数を呼び出すハンドラです。
Attributes:
| Name | Type | Description |
|---|---|---|
mode |
JsonSchemaMode
|
Jsonスキーマモードで、 |
resolve_ref_schema ¶
resolve_ref_schema(
maybe_ref_json_schema: JsonSchemaValue,
) -> JsonSchemaValue
{"$ref": ...}スキーマの実際のスキーマを取得します。
指定したスキーマが$refスキーマでない場合は、そのまま返されます。
つまり、この関数を呼び出す前にチェックする必要はありません。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
maybe_ref_json_schema |
JsonSchemaValue
|
|
required |
Raises:
| Type | Description |
|---|---|
LookupError
|
参照が見つからない場合。 |
Returns:
| Name | Type | Description |
|---|---|---|
JsonSchemaValue |
JsonSchemaValue
|
|
Source code in pydantic/annotated_handlers.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
GetCoreSchemaHandler ¶
CoreSchemaスキーマ生成関数を呼び出すハンドラ。
generate_schema ¶
generate_schema(source_type: Any) -> CoreSchema
現在のコンテキストに関連しないスキーマを生成します。
この関数は、例えばシーケンスのスキーマ生成を処理していて、その項目のスキーマを生成したい場合に使用します。
そうしないと、シーケンス自体を対象としたmin_length制約を項目に適用するようなことになってしまいます。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_type |
Any
|
入力タイプ。 |
required |
Returns:
| Name | Type | Description |
|---|---|---|
CoreSchema |
CoreSchema
|
生成された |
Source code in pydantic/annotated_handlers.py
78 79 80 81 82 83 84 85 86 87 88 89 | |
resolve_ref_schema ¶
resolve_ref_schema(
maybe_ref_schema: CoreSchema,
) -> CoreSchema
definition-refスキーマの実際のスキーマを取得します。
指定されたスキーマがdefinition-refスキーマでない場合は、そのまま返されます。
つまり、この関数を呼び出す前にチェックする必要はありません。
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
maybe_ref_schema |
CoreSchema
|
|
required |
Raises:
| Type | Description |
|---|---|
LookupError
|
|
Returns:
| Type | Description |
|---|---|
CoreSchema
|
具体的な |
Source code in pydantic/annotated_handlers.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |