Skip to content

model cleanup#2129

Open
hramrach wants to merge 8 commits into
openSUSE:masterfrom
hramrach:model-optional
Open

model cleanup#2129
hramrach wants to merge 8 commits into
openSUSE:masterfrom
hramrach:model-optional

Conversation

@hramrach
Copy link
Copy Markdown
Contributor

  • only produce one JSON format, there is no use for the bespoke format that is not reproducible with other tools
  • abolish NotSetClass

The field is not optional, and requires a default to be able to
correctly instantiate the model without additional parameters.
This is fairly impractical, and there is no real reason.
The NotSet object is not a singleton, it is required to check the class.
The default for users and groups is None which is not useful in any way.
The Optional constructor is union with None.

As a result optional fields are set to None when not present.

Ignore them in dict().
There is no user that requires this bespoke format
As NotSet and None is used interchangeably 'for usability' NotSet can as
well be abolished, it only makes the code more confusing.

There is no representation of None in XML, and no protocol that uses
JSON requires a null value, there is no use for NotSet separate from
None.

If an actual NotSet value separate from None is needed it should be
implemented correctly, so that it is usable without substituting with
None.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 33.92%. Comparing base (5c240dc) to head (0112c62).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2129      +/-   ##
==========================================
- Coverage   33.94%   33.92%   -0.03%     
==========================================
  Files         199      199              
  Lines       27035    27025      -10     
==========================================
- Hits         9177     9167      -10     
  Misses      17858    17858              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant