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

🐛 Fix Color serialization in Pydantic v2 #6821

Conversation

giancarloromeo
Copy link
Contributor

@giancarloromeo giancarloromeo commented Nov 25, 2024

What do these changes do?

Fix a serialization issue with Color fields in Pydantic v2.

In Web Server logs:

  File "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_webserver/projects/_crud_handlers.py", line 223, in list_projects

    text=page.model_dump_json(**RESPONSE_MODEL_POLICY),

         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/scu/.venv/lib/python3.11/site-packages/pydantic/main.py", line 441, in model_dump_json

    return self.__pydantic_serializer__.to_json(

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'pydantic_extra_types.color.Color'>

Related issue/s

How to test

Dev-ops checklist

@giancarloromeo giancarloromeo self-assigned this Nov 25, 2024
@giancarloromeo giancarloromeo added the a:webserver issue related to the webserver service label Nov 25, 2024
@giancarloromeo giancarloromeo added this to the Event Horizon milestone Nov 25, 2024
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.48%. Comparing base (532c977) to head (b92dd2b).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6821      +/-   ##
==========================================
+ Coverage   88.03%   89.48%   +1.44%     
==========================================
  Files        1550     1252     -298     
  Lines       61749    53016    -8733     
  Branches     2164      940    -1224     
==========================================
- Hits        54363    47442    -6921     
+ Misses       7057     5439    -1618     
+ Partials      329      135     -194     
Flag Coverage Δ
integrationtests 64.79% <ø> (+11.45%) ⬆️
unittests 87.06% <100.00%> (+0.77%) ⬆️
Components Coverage Δ
api ∅ <ø> (∅)
pkg_aws_library ∅ <ø> (∅)
pkg_dask_task_models_library ∅ <ø> (∅)
pkg_models_library 91.16% <100.00%> (+<0.01%) ⬆️
pkg_notifications_library ∅ <ø> (∅)
pkg_postgres_database ∅ <ø> (∅)
pkg_service_integration 70.00% <ø> (ø)
pkg_service_library ∅ <ø> (∅)
pkg_settings_library ∅ <ø> (∅)
pkg_simcore_sdk 85.36% <ø> (ø)
agent 97.00% <ø> (ø)
api_server 89.72% <ø> (ø)
autoscaling 95.21% <ø> (ø)
catalog 90.57% <ø> (ø)
clusters_keeper 98.73% <ø> (ø)
dask_sidecar 91.26% <ø> (ø)
datcore_adapter 93.17% <ø> (ø)
director 76.40% <ø> (ø)
director_v2 91.04% <ø> (+0.01%) ⬆️
dynamic_scheduler 96.59% <ø> (ø)
dynamic_sidecar 89.75% <ø> (ø)
efs_guardian 90.12% <ø> (ø)
invitations 93.44% <ø> (ø)
osparc_gateway_server 85.49% <ø> (ø)
payments 92.76% <ø> (ø)
resource_usage_tracker 90.79% <ø> (ø)
storage 89.66% <ø> (ø)
webclient ∅ <ø> (∅)
webserver 88.66% <ø> (+1.14%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 532c977...b92dd2b. Read the comment docs.

---- 🚨 Try these New Features:

@giancarloromeo giancarloromeo marked this pull request as ready for review November 25, 2024 10:36
@giancarloromeo giancarloromeo requested a review from GitHK November 25, 2024 10:37
Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

@giancarloromeo giancarloromeo enabled auto-merge (squash) November 25, 2024 11:24
Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Copy link

sonarcloud bot commented Nov 25, 2024

@giancarloromeo giancarloromeo merged commit 9870a85 into ITISFoundation:master Nov 25, 2024
90 checks passed
@giancarloromeo giancarloromeo deleted the fix-color-field-serialization branch November 26, 2024 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:webserver issue related to the webserver service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants