Skip to content

Commit a8ac294

Browse files
Vaghinak BasentsyanVaghinak Basentsyan
authored andcommitted
allow extra fields
1 parent 5698328 commit a8ac294

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

src/superannotate/lib/core/entities/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pydantic import constr
99
from pydantic import EmailStr
1010
from pydantic import Field
11+
from pydantic import Extra
1112
from pydantic import validator
1213
from pydantic.errors import EnumMemberError
1314

@@ -29,7 +30,7 @@ def enum_error_handling(self) -> str:
2930
class BaseModel(PyDanticBaseModel):
3031

3132
class Config:
32-
# extra = "forbid"
33+
extra = Extra.allow
3334
use_enum_values = True
3435
error_msg_templates = {
3536
"type_error.integer": "integer type expected",

src/superannotate/lib/core/validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class BaseValidator(metaclass=ABCMeta):
1414
def __init__(self, data: Any, allow_extra: bool = True):
1515
self.data = data
1616
self._validation_output = None
17-
self._extra = Extra.ignore if allow_extra else Extra.forbid
17+
self._extra = Extra.allow if allow_extra else Extra.forbid
1818

1919
@classmethod
2020
def validate(cls, data: Any, extra=True):

tests/unit/test_validators.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ class TestTypeHandling(TestCase):
112112
"width": 1024,
113113
"height": 683,
114114
"status": "Completed",
115-
"pinned": False,
116-
"isPredicted": None,
117-
"projectId": None,
118-
"annotatorEmail": None,
119-
"qaEmail": None
115+
"pinned": false,
116+
"isPredicted": null,
117+
"projectId": null,
118+
"annotatorEmail": null,
119+
"qaEmail": null
120120
},
121121
"instances": [
122122
{
@@ -131,8 +131,8 @@ class TestTypeHandling(TestCase):
131131
},
132132
"groupId": 0,
133133
"pointLabels": {},
134-
"locked": False,
135-
"visible": False,
134+
"locked": false,
135+
"visible": false,
136136
"attributes": [
137137
{
138138
"id": 117845,
@@ -142,12 +142,12 @@ class TestTypeHandling(TestCase):
142142
}
143143
],
144144
"trackingId": "aaa97f80c9e54a5f2dc2e920fc92e5033d9af45b",
145-
"error": None,
146-
"createdAt": None,
147-
"createdBy": None,
148-
"creationType": None,
149-
"updatedAt": None,
150-
"updatedBy": None,
145+
"error": null,
146+
"createdAt": null,
147+
"createdBy": null,
148+
"creationType": null,
149+
"updatedAt": null,
150+
"updatedBy": null,
151151
"className": "Personal vehicle"
152152
}
153153
]

0 commit comments

Comments
 (0)