-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Labels
Description
TODO if it's a template, enforce dict structure on the template
AutoPR/autopr/models/config/elements.py
Lines 211 to 221 in 1d818f4
| and issubclass(type_, pydantic.BaseModel) | |
| ): | |
| for field_name in type_.__fields__.keys(): | |
| if any(field_name in m.__fields__ for m in typing.get_args(add_union)): | |
| raise ValueError(f"{field_name} is a restricted field name.") | |
| # TODO if it's a template, enforce dict structure on the template | |
| type_ = Union[type_, add_union] | |
| template_fields[name_] = (type_, template_field) | |
| inputs_template = pydantic.create_model( | |
| action.id + model.__name__ + "ActionFieldTemplate", | |
| __base__=StrictModel, |
To resolve this TODO, you can start by checking if the code is dealing with a template. If it is, you can enforce the dict structure by validating the input data against a predefined template structure.