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

Enable defaults for specific type, allow providing default values for type when absent in constructor #558

Merged
merged 9 commits into from
Jun 27, 2024

Conversation

MateuszKubuszok
Copy link
Member

@MateuszKubuszok MateuszKubuszok commented Jun 26, 2024

TODO:

  • define trait DefaultValue[A]
    • provide summoning in internals
  • define flag DefaultValueOfType[A]
    • parse config in internals
    • allow setting it with DLS
  • use flag and type class in ProductToPoduct rule
  • provide DefaultValue for UnknownFieldSet
  • tests
    • defaultValueOfType[A] tests
    • DefaultValue[A] tests
    • DefaultValue[UnknownFieldSet] tests
  • docs
    • providing custom default values (when constructor is missing them)
    • Protobufs and UnknownFieldSet
    • Scaladoc

@MateuszKubuszok MateuszKubuszok linked an issue Jun 26, 2024 that may be closed by this pull request
Copy link

codecov bot commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 10 lines in your changes missing coverage. Please review.

Project coverage is 87.71%. Comparing base (e0a48a2) to head (7bfd263).

Files Patch % Lines
...ey/internal/compiletime/ChimneyTypesPlatform.scala 50.00% 5 Missing ⚠️
...io/scalaland/chimney/dsl/TransformerFlagsDsl.scala 50.00% 2 Missing ⚠️
...ey/protobufs/ProtobufsDefaultValuesImplicits.scala 0.00% 1 Missing ⚠️
...ey/internal/compiletime/ChimneyTypesPlatform.scala 90.00% 1 Missing ⚠️
...rmSealedHierarchyToSealedHierarchyRuleModule.scala 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #558      +/-   ##
==========================================
- Coverage   87.84%   87.71%   -0.14%     
==========================================
  Files         148      149       +1     
  Lines        5741     5826      +85     
  Branches      466      475       +9     
==========================================
+ Hits         5043     5110      +67     
- Misses        698      716      +18     

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

@MateuszKubuszok MateuszKubuszok marked this pull request as ready for review June 27, 2024 09:37
@MateuszKubuszok MateuszKubuszok force-pushed the improve-default-values branch 2 times, most recently from 2bb8a04 to 8cfa691 Compare June 27, 2024 09:45
@MateuszKubuszok MateuszKubuszok merged commit 606b60b into master Jun 27, 2024
22 of 24 checks passed
@MateuszKubuszok MateuszKubuszok deleted the improve-default-values branch June 27, 2024 09:56
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.

Provide fallback value for a particular type
1 participant