bool_schema
Returns a schema that matches a bool value, e.g.:
from pydantic_core import SchemaValidator, core_schema
schema = core_schema.bool_schema()
v = SchemaValidator(schema)
assert v.validate_python('True') is True
def bool_schema(
strict: bool | None = None,
ref: str | None = None,
metadata: dict[str, Any] | None = None,
serialization: SerSchema | None = None
) - > BoolSchema
Returns a schema that matches a bool value.
Parameters
| Name | Type | Description |
|---|---|---|
| strict | `bool | None` = None |
| ref | `str | None` = None |
| metadata | `dict[str, Any] | None` = None |
| serialization | `SerSchema | None` = None |
Returns
| Type | Description |
|---|---|
BoolSchema | A dictionary-based schema definition for boolean validation and serialization. |