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

Refactor "one or many" typed Hera values #905

Merged
merged 6 commits into from
Dec 21, 2023
Merged

Refactor "one or many" typed Hera values #905

merged 6 commits into from
Dec 21, 2023

Conversation

elliotgunton
Copy link
Collaborator

Pull Request Checklist

Description of PR
Currently, typing a value as a single value of a union or a list of the same union is verbose and becomes less readable. This PR adds an explicit OneOrMany type for us to reuse throughout the mixins, as well as validators that can normalize the value to a list (or as an alternative valid single-value).

The issue also discusses moving the _build_* logic into the root validator - we could do something like that instead of the normalize_to_list functions, but chose to get to this halfway point first.

@elliotgunton elliotgunton added semver:patch A change requiring a patch version bump type:task A general task labels Dec 21, 2023
Signed-off-by: Elliot Gunton <egunton@bloomberg.net>
Signed-off-by: Elliot Gunton <egunton@bloomberg.net>
Signed-off-by: Elliot Gunton <egunton@bloomberg.net>
Signed-off-by: Elliot Gunton <egunton@bloomberg.net>
Signed-off-by: Elliot Gunton <egunton@bloomberg.net>
Copy link

codecov bot commented Dec 21, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (86f2799) 80.3% compared to head (4a1d9aa) 80.3%.

Files Patch % Lines
src/hera/workflows/_mixins.py 93.9% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main    #905   +/-   ##
=====================================
  Coverage   80.3%   80.3%           
=====================================
  Files         49      49           
  Lines       3821    3831   +10     
  Branches     777     779    +2     
=====================================
+ Hits        3069    3079   +10     
  Misses       557     557           
  Partials     195     195           

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

Copy link
Collaborator

@flaviuvadan flaviuvadan left a comment

Choose a reason for hiding this comment

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

🎖️

Signed-off-by: Elliot Gunton <egunton@bloomberg.net>
Copy link
Collaborator

@flaviuvadan flaviuvadan left a comment

Choose a reason for hiding this comment

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

🚀

@elliotgunton elliotgunton merged commit ab3b4ab into main Dec 21, 2023
22 checks passed
@elliotgunton elliotgunton deleted the eg/653 branch December 21, 2023 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:patch A change requiring a patch version bump type:task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standardize the way single item vs list[item] is processed on Hera object fields
2 participants