tessl install tessl/pypi-pydantic@2.11.0Data validation using Python type hints
Agent Success
Agent success rate when using this tile
90%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.3x
Baseline
Agent success rate without this tile
69%
{
"context": "This criteria evaluates how well the engineer uses pydantic's alias system to automatically convert field names between internal (snake_case) and external (camelCase) API formats. It specifically assesses the use of alias generators for automatic conversion, custom serialization aliases for special cases, and proper serialization with the by_alias parameter.",
"type": "weighted_checklist",
"checklist": [
{
"name": "ConfigDict with alias_generator",
"description": "Uses ConfigDict with alias_generator (e.g., to_camel from pydantic.alias_generators or a custom function) to automatically convert snake_case field names to camelCase during serialization",
"max_score": 25
},
{
"name": "Custom serialization_alias usage",
"description": "Uses Field() with serialization_alias parameter to specify that registration_date should serialize as 'regDate' instead of following the camelCase pattern",
"max_score": 20
},
{
"name": "serialize_by_alias configuration",
"description": "Configures models to serialize by alias by either setting serialize_by_alias=True in ConfigDict or using by_alias=True parameter in model_dump() calls",
"max_score": 20
},
{
"name": "to_api_format method implementation",
"description": "Implements a to_api_format() method in each model that calls model_dump() with appropriate parameters (by_alias=True if not configured globally) to return aliased field names",
"max_score": 15
},
{
"name": "Nested model aliasing",
"description": "Correctly applies alias generation to nested models (User and Address within UserProfile) so that nested fields also serialize with camelCase names",
"max_score": 10
},
{
"name": "BaseModel inheritance",
"description": "Defines all three models (User, Address, UserProfile) as classes that inherit from pydantic.BaseModel",
"max_score": 5
},
{
"name": "Field type annotations",
"description": "Uses proper type annotations (int, str) for all fields in all models to enable pydantic validation",
"max_score": 5
}
]
}