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 connection service serialization wrongly including 'name' parameter #120

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

dlax
Copy link
Member

@dlax dlax commented Feb 23, 2024

Fix #118

@codecov-commenter
Copy link

codecov-commenter commented Feb 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.48%. Comparing base (a431f15) to head (6a656a7).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #120   +/-   ##
=======================================
  Coverage   97.47%   97.48%           
=======================================
  Files          10       10           
  Lines        1190     1191    +1     
=======================================
+ Hits         1160     1161    +1     
  Misses         30       30           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

The Service class overwrite __setattr__ to invoke __setitem__ so the statement
'self.name = name' in Service.__init__() will actually add the 'name' key to
the Service (which is a dict). Then, as serialization invokes .items() to get
service parameters, the 'name' field is written whereas is should not.

We invoke __setattr__() from super() in order to avoid that and also declare
the 'name' attribute in the class in order to keep type checking working.
@dlax dlax requested a review from pgiraud February 23, 2024 08:33
@dlax dlax merged commit 6a656a7 into master Mar 4, 2024
10 checks passed
@dlax dlax deleted the issue-118 branch March 4, 2024 08:57
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.

Service produces syntax error in service file
2 participants