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
Describe the bug
The metadata-service rig endpoint is broken for older rig JSONS because the serialize_modalities function does not handle when the modality is a dict object (from older models).
Expected behavior
Have the serializer be able to handle different types. Create a unit test that replicates the behavior
Screenshots
File "/app/src/aind_metadata_service/response_handler.py", line 160, in map_to_json_response
response = self._map_data_response(validate=validate)
File "/app/src/aind_metadata_service/response_handler.py", line 104, in _map_data_response
json.loads(aind_model.model_dump_json())
File "/usr/local/lib/python3.10/site-packages/pydantic/main.py", line 415, in model_dump_json
return self.pydantic_serializer.to_json(
pydantic_core._pydantic_core.PydanticSerializationError: Error serializing to JSON: PydanticSerializationError: Error calling function serialize_modalities: AttributeError: 'dict' object has no attribute 'name'
Desktop (please complete the following information):
OS: [e.g. iOS]
Browser [e.g. chrome, safari]
Version [e.g. 22]
Smartphone (please complete the following information):
Device: [e.g. iPhone6]
OS: [e.g. iOS8.1]
Browser [e.g. stock browser, safari]
Version [e.g. 22]
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
mekhlakapoor
changed the title
Modalities serializer in Rig cannot handle older schema versions
Modalities serializer in Rig breaks for older versions
Oct 21, 2024
mekhlakapoor
changed the title
Modalities serializer in Rig breaks for older versions
Modalities serializer unable to serialize models made from jsons
Oct 21, 2024
Describe the bug
The metadata-service rig endpoint is broken for older rig JSONS because the serialize_modalities function does not handle when the modality is a dict object (from older models).
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Have the serializer be able to handle different types. Create a unit test that replicates the behavior
Screenshots
File "/app/src/aind_metadata_service/response_handler.py", line 160, in map_to_json_response
response = self._map_data_response(validate=validate)
File "/app/src/aind_metadata_service/response_handler.py", line 104, in _map_data_response
json.loads(aind_model.model_dump_json())
File "/usr/local/lib/python3.10/site-packages/pydantic/main.py", line 415, in model_dump_json
return self.pydantic_serializer.to_json(
pydantic_core._pydantic_core.PydanticSerializationError: Error serializing to JSON: PydanticSerializationError: Error calling function
serialize_modalities
: AttributeError: 'dict' object has no attribute 'name'Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: