StanfordSpezi / Spezi

Open-source framework for rapid development of modern, interoperable digital health applications.
https://swiftpackageindex.com/StanfordSpezi/Spezi/documentation
MIT License
130 stars 10 forks source link

Enforcement of customizable type constraints for DependencyBuilder #93

Closed philippzagar closed 7 months ago

philippzagar commented 7 months ago

Enforcement of customizable type constraints for DependencyBuilder

:recycle: Current situation & Problem

As of now, the DependencyBuilder aggregates multiple types conforming to Module towards a DependencyCollection. However, the type constraint of the DependencyBuilder currently only enables the enforcement of the Module conformance, not the conformance to other, more specific types that may be useful for implementing a Domain Specific Language.

:gear: Release Notes

:books: Documentation

DocC docs added.

:white_check_mark: Testing

--

:pencil: Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

philippzagar commented 7 months ago

Thanks a lot to @Supereg for helping with the design/implementation!

codecov[bot] commented 7 months ago

Codecov Report

Merging #93 (641a774) into main (092eabc) will increase coverage by 0.08%. The diff coverage is 53.85%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93/graphs/tree.svg?width=650&height=150&src=pr&token=KHU2K1HTAM&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi)](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) ```diff @@ Coverage Diff @@ ## main #93 +/- ## ========================================== + Coverage 91.46% 91.53% +0.08% ========================================== Files 30 31 +1 Lines 655 661 +6 ========================================== + Hits 599 605 +6 Misses 56 56 ``` | [Files](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) | Coverage Δ | | |---|---|---| | [Sources/Spezi/Dependencies/DependencyBuilder.swift](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aS9EZXBlbmRlbmNpZXMvRGVwZW5kZW5jeUJ1aWxkZXIuc3dpZnQ=) | `100.00% <ø> (+52.18%)` | :arrow_up: | | [...rces/Spezi/Dependencies/DependencyCollection.swift](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aS9EZXBlbmRlbmNpZXMvRGVwZW5kZW5jeUNvbGxlY3Rpb24uc3dpZnQ=) | `97.30% <100.00%> (+0.24%)` | :arrow_up: | | [...Spezi/Dependencies/DependencyPropertyWrapper.swift](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aS9EZXBlbmRlbmNpZXMvRGVwZW5kZW5jeVByb3BlcnR5V3JhcHBlci5zd2lmdA==) | `90.75% <100.00%> (+0.55%)` | :arrow_up: | | [Sources/Spezi/Module/ModuleBuilder.swift](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aS9Nb2R1bGUvTW9kdWxlQnVpbGRlci5zd2lmdA==) | `100.00% <ø> (ø)` | | | [...ezi/Dependencies/DependencyCollectionBuilder.swift](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aS9EZXBlbmRlbmNpZXMvRGVwZW5kZW5jeUNvbGxlY3Rpb25CdWlsZGVyLnN3aWZ0) | `40.00% <40.00%> (ø)` | | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). Last update [092eabc...641a774](https://app.codecov.io/gh/StanfordSpezi/Spezi/pull/93?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi).
philippzagar commented 7 months ago

Thanks a lot to @Supereg for helping with the design/implementation!

Thanks for the review, didn't expect it so quickly as I wanted to write some additional test cases :D

philippzagar commented 7 months ago

@PSchmiedmayer Please merge the PR, small testing check is failing as the result builder default protocol implementation leads to a few patch coverage misses.