reconcilerio / dies

immutable, fluent, builders for Kubernetes resources
Apache License 2.0
8 stars 4 forks source link

Generate mutation die helpers for fields #149

Closed scothis closed 3 months ago

scothis commented 3 months ago

Many more common mutation methods are now generated. These methods require additional metadata since they use dies backing a field value within the current die. Typically the required metadata is the name of the field on the current die, and the type for the Die backing the nested field's type. Additional metadata is required for fields backed by slices.

See updates to the README for details.

Where possible, existing mutation methods are updated to use the new code generation. In cases where the generated method name is different, the previous method was deprecated in favor of the new method. Where there is a discrepancy, the new names are more consistent.

Remaining mutation methods are mostly custom one-off methods that will likely never be generated. Adding additional methods in the future will be much easier as all applicable dies will get the new behavior.

Future enhancements can reduce the amount of metadata that the user must provide for each field by looking up type information and existing doc tags about the target field.

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 1.03093% with 96 lines in your changes missing coverage. Please review.

Project coverage is 22.33%. Comparing base (04fcf15) to head (e9958b3).

Files Patch % Lines
apis/meta/v1/typemeta.go 1.09% 90 Missing :warning:
...issionregistration/v1/validatingadmissionpolicy.go 0.00% 1 Missing :warning:
apis/apiserver/flowcontrol/v1beta1/flowschema.go 0.00% 1 Missing :warning:
apis/core/v1/node.go 0.00% 1 Missing :warning:
apis/core/v1/persistantvolume.go 0.00% 1 Missing :warning:
apis/core/v1/service.go 0.00% 1 Missing :warning:
apis/node/v1/runtimeclass.go 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #149 +/- ## =========================================== + Coverage 10.78% 22.33% +11.54% =========================================== Files 74 46 -28 Lines 3283 1236 -2047 =========================================== - Hits 354 276 -78 + Misses 2918 950 -1968 + Partials 11 10 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.