Skip to content

fix(usage): reset dto if provided value is equal to default#421

Merged
jnioche merged 1 commit intoBoavizta:mainfrom
jonperron:fix/418
Nov 7, 2025
Merged

fix(usage): reset dto if provided value is equal to default#421
jnioche merged 1 commit intoBoavizta:mainfrom
jonperron:fix/418

Conversation

@jonperron
Copy link
Copy Markdown
Collaborator

@jonperron jonperron commented Oct 25, 2025

Changelog

  • Add function to reset usage_location to None if value is equal to default
  • Add test

I tested manually the results from the calls with/without location values (when equal to EEE) and the JSON are similar 👍

Fix #418

* Add function to reset usage_location to None if value is equal to default
* Add test
@jonperron jonperron marked this pull request as ready for review October 25, 2025 07:51


def _reset_usage_dto_if_matches_config_defaults(usage_dto: Usage):
"""Reset usage_dto fields to None if they match the config default values."""
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

To the reviewer: I created this new function so this might be extensible to more properties in the future. At the moment, I focused on the usage_location value which is the source of the issue, plus it seemed to me the only value which was not equal to "DEFAULT" in the config file.

Copy link
Copy Markdown
Collaborator

@jnioche jnioche left a comment

Choose a reason for hiding this comment

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

LGTM thanks @jonperron

@jnioche jnioche added this to the 1.3.12 milestone Nov 3, 2025
@jnioche jnioche added the bug Something isn't working label Nov 3, 2025
@jnioche jnioche merged commit e5038d5 into Boavizta:main Nov 7, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloud/instance endpoint returns different values if default location is set explicitly

2 participants