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(backend): optional settings #3825

Merged
merged 10 commits into from
Dec 4, 2024
Merged

Conversation

AntonioVentilii
Copy link
Collaborator

@AntonioVentilii AntonioVentilii commented Dec 3, 2024

Motivation

In PR #3770 , i introduced the field settings in the UserProfile structure. I made it defaulting to avoid missing data in profiles created before the change.

However this caused issues with deserialization: the decoding was failing because data were missing obviously.

I had a few options:

  1. migrate old data to the new struct --> not an option, not necessary, and a lot of effort/risk for something this small
  2. deserialize UserProfile differently from the rest --> not worth it since the deserialization should not be affected by how a specific structure changes; furthermore, we DO want to raise errors if the deserialization fails, and not provide a certain default
  3. use optionality --> For The Win

Changes

  • Change the settings files to be optional
  • Adapt consequent structures
  • Remove Default trait

Tests

Current tests worked as intended.

@AntonioVentilii AntonioVentilii marked this pull request as ready for review December 4, 2024 10:36
@AntonioVentilii AntonioVentilii requested a review from a team as a code owner December 4, 2024 10:36
@AntonioVentilii AntonioVentilii enabled auto-merge (squash) December 4, 2024 12:37
@AntonioVentilii AntonioVentilii merged commit a90862b into main Dec 4, 2024
26 checks passed
@AntonioVentilii AntonioVentilii deleted the fix(backend)/optional-settings branch December 4, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants