You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class ViewableContent(Schema):
name: str
description: str = None
class MySchema(ViewableContent):
other: str # If I don't add a new field the problem does not arise
When I run my application the following error is raised:
File "/home/user/mnp/applications/neuroglass-research/backend/neuroglass_research/api/__init__.py", line 4, in <module>
from .studies import router as studies_router
File "/home/user/mnp/applications/neuroglass-research/backend/neuroglass_research/api/studies.py", line 69, in <module>
def update_study(request: HttpRequest, study_id: int, payload: PatchDict[UpdateStudyPayload]):
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/home/user/miniconda3/envs/mnp/lib/python3.12/site-packages/ninja/patch_dict.py", line 45, in __getitem__
new_cls = create_patch_schema(schema_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/miniconda3/envs/mnp/lib/python3.12/site-packages/ninja/patch_dict.py", line 29, in create_patch_schema
t = schema_cls.__annotations__[f]
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
KeyError: 'name'
Versions:
Python version: 3.12
Django version: 5.1.2
Django-Ninja version: 1.3.0
Pydantic version: 2.9.2
The text was updated successfully, but these errors were encountered:
Describe the bug
I have a schema hierarchy such as:
Then add a router like the following:
When I run my application the following error is raised:
Versions:
The text was updated successfully, but these errors were encountered: