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

Use dedicated PathElement for values provided manually #655

Merged
merged 3 commits into from
Dec 30, 2024

Conversation

MateuszKubuszok
Copy link
Member

@MateuszKubuszok MateuszKubuszok commented Dec 30, 2024

When using:

  • withFieldConstPartial
  • withFieldCompured (in PartialTransformer)
  • withFieldComputedPartial

we were just prepending to the Path the PathElement.Accessor with the name of the currently handled target field. But the Path is designed to handle path from source value. In nested data this results in a chain of fields where the prefix comes from source type and the last field from the target type. It makes no sense.

This PR introduces a dedicated PathElement for storing errors from provided values, which may not have source or their source may be unrelated to the currently used From expression.

Copy link

codecov bot commented Dec 30, 2024

Codecov Report

Attention: Patch coverage is 94.33962% with 3 lines in your changes missing coverage. Please review.

Project coverage is 85.94%. Comparing base (d5a6588) to head (e17d86b).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...er/rules/TransformProductToProductRuleModule.scala 94.11% 2 Missing ⚠️
...ala/io/scalaland/chimney/partial/PathElement.scala 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #655      +/-   ##
==========================================
+ Coverage   85.82%   85.94%   +0.12%     
==========================================
  Files         160      160              
  Lines        6715     6680      -35     
  Branches      560      559       -1     
==========================================
- Hits         5763     5741      -22     
+ Misses        952      939      -13     

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

@MateuszKubuszok MateuszKubuszok merged commit eac4add into master Dec 30, 2024
24 checks passed
@MateuszKubuszok MateuszKubuszok deleted the error-path-for-const-values branch December 30, 2024 16:53
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