-
Notifications
You must be signed in to change notification settings - Fork 14
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: remove exclude_defaults #229
Conversation
@djs0109 unfortunetaly, I cannot see, where the pipeline fails. Please, let me know, what the problem is :) |
try: | ||
res = self.post( | ||
url=url, | ||
headers=headers, | ||
data=subscription.model_dump_json(exclude={'id'}, | ||
exclude_unset=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the exclude_unset
is also removed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djs0109 its because if it was excluded. The default values if not explitly set would be removed as well. Hence, the user would expect the default value will be sent to the plattform.
headers = self.headers.copy() | ||
try: | ||
res = self.post( | ||
url=url, | ||
headers=headers, | ||
json=entity.model_dump(exclude_unset=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the exclude_unset
is also removed here?
try: | ||
res = self.post( | ||
url=url, | ||
headers=headers, | ||
data=registration.model_dump_json(exclude={'id'}, | ||
exclude_unset=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the exclude_unset
is also removed here?
headers=headers, | ||
params=params, | ||
data=query.model_dump_json(exclude_unset=True, | ||
exclude_none=True), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exclude_unset
@@ -96,9 +96,8 @@ def post_groups(self, | |||
url = urljoin(self.base_url, 'iot/services') | |||
headers = self.headers | |||
data = {'services': [group.model_dump(exclude={'service', 'subservice'}, | |||
exclude_none=True, | |||
exclude_unset=True) for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exclude_unset
@@ -115,9 +115,7 @@ def post_notification(self, notification: Message): | |||
headers = self.headers.copy() | |||
data = [] | |||
for entity in notification.data: | |||
data.append(entity.model_dump(exclude_unset=True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exclude_unset
@tstorek I just marked all the places where the |
@djs0109 I explained above why I think that it is better to also exclude unset. This only means taht all basic filip models must use None as default, if they should not be sent by default. Sound reasonable? Do the tests work now? |
@tstorek It sounds reasonable. But for the consistency, do you think it is better to remove all |
@djs0109 i removed them wherever it was safe at the first glance. Probably for consistency it would be good to remove them all. Please, feel free to check. :) thank you |
@tstorek I remove all |
# Conflicts: # filip/clients/ngsi_v2/cb.py
closes #228