Context
Currently, many Pydantic models in the service/api/response_models layer use PascalCase directly from the AFIP XML structure (e.g., Code, Msg, FchProceso).
We need to transition to snake_case for all fields using Pydantic Field aliases.
This task is strictly limited to models within the ./service/api/response_models/
For example:
Before (Now):
class Err(BaseModel):
Code: int
Msg: str | None = None
After:
class Err(BaseModel):
model_config = ConfigDict(populate_by_name=True)
code: int = Field(..., alias="Code")
msg: str | None = Field(None, alias="Msg")
Technical Notes
-
Remember to include model_config = ConfigDict(populate_by_name=True) in the models so the fields can still be accessed or initialized by their original AFIP names.
-
Field Optionality: Pay close attention to the types:
If the field is mandatory (e.g., code: int): Use Field(..., alias="Code").
If the field is optional (e.g., msg: str | None = None): Use Field(None, alias="Msg").
-
You don't need to write new test cases for this issue.
-
Before submitting your PR, ensure the existing suite passes by running:
pytestc implementation details.
Context
Currently, many Pydantic models in the service/api/response_models layer use PascalCase directly from the AFIP XML structure (e.g.,
Code,Msg,FchProceso).We need to transition to snake_case for all fields using Pydantic Field aliases.
This task is strictly limited to models within the
./service/api/response_models/For example:
Before (Now):
After:
Technical Notes
Remember to include
model_config = ConfigDict(populate_by_name=True)in the models so the fields can still be accessed or initialized by their original AFIP names.Field Optionality: Pay close attention to the types:
If the field is mandatory (e.g.,
code: int):Use Field(..., alias="Code").If the field is optional (e.g.,
msg: str | None = None): UseField(None, alias="Msg").You don't need to write new test cases for this issue.
Before submitting your PR, ensure the existing suite passes by running:
pytestc implementation details.