Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: correct handling of base class with no __annotations__ in AllOptionalMetaclass #1740

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion antarest/study/business/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class FormFieldsBaseModel(BaseModel):
class Config:
alias_generator = to_camel_case
extra = Extra.forbid
validate_assignment = True
allow_population_by_field_name = True


class FieldInfo(TypedDict, total=False):
Expand Down Expand Up @@ -108,7 +110,7 @@ def __new__(
) -> Any:
annotations = namespaces.get("__annotations__", {})
for base in bases:
annotations.update(base.__annotations__)
annotations.update(getattr(base, "__annotations__", {}))
for field, field_type in annotations.items():
if not field.startswith("__"):
# Optional fields are correctly handled
Expand Down