schema¶
Schema for the API and application.
Schema.
- pydantic model byte_api.lib.schema.BaseModel[source]
Bases:
BaseModelBase Settings.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "BaseModel", "description": "Base Settings.", "type": "object", "properties": {} }
- Config:
validate_assignment: bool = True
from_attributes: bool = True
use_enum_values: bool = True
arbitrary_types_allowed: bool = True
- pydantic model byte_api.lib.schema.CamelizedBaseModel[source]
Bases:
BaseModelCamelized Base pydantic schema.
This model uses camelCase for field names in serialization by default. When serialized, snake_case fields will be converted to camelCase.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Show JSON schema
{ "title": "CamelizedBaseModel", "description": "Camelized Base pydantic schema.\n\nThis model uses camelCase for field names in serialization by default.\nWhen serialized, snake_case fields will be converted to camelCase.", "type": "object", "properties": {} }
- Config:
validate_assignment: bool = True
from_attributes: bool = True
use_enum_values: bool = True
arbitrary_types_allowed: bool = True
populate_by_name: bool = True
alias_generator: function = <function camel_case at 0x7fb2219cb060>
validate_by_alias: bool = True
validate_by_name: bool = True
- byte_api.lib.schema.serialize_camelized_model(value: Any) dict[str, Any][source]
Serialize CamelizedBaseModel instances with camelCase field names.
This encoder is used by Litestar to ensure that all Pydantic models extending CamelizedBaseModel are serialized with their aliases (camelCase).
- Parameters:
value – The CamelizedBaseModel instance to serialize
- Returns:
The serialized model with camelCase field names
- Return type: