StanfordSpezi / SpeziScheduler

Scheduler Module for the Stanford Spezi Ecosystem
https://swiftpackageindex.com/StanfordSpezi/SpeziScheduler/documentation/
MIT License
4 stars 3 forks source link

Customize encoders and decoders for UserStorage Properties #50

Closed Supereg closed 4 weeks ago

Supereg commented 4 weeks ago

Customize encoders and decoders for UserStorage Properties

:recycle: Current situation & Problem

SpeziScheduler uses the property list encoders and decoders by default for UserStorage properties for an efficient encoded representation. Certain types don't quite work well with the property list encoder. For example FHIRs ModelR4 seem to be heavily tailored towards a JSON representation and fail to decode when using property lists. Therefore, this PR adds the ability to customize the encoder and decoder used with a Property.

:gear: Release Notes

:books: Documentation

Documentation was supplied.

:white_check_mark: Testing

Additional unit testing verifies the updated macro generation.

:pencil: Code of Conduct & Contributing Guidelines

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

codecov[bot] commented 4 weeks ago

Codecov Report

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

Project coverage is 70.76%. Comparing base (7ba1ed8) to head (80dab24). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...es/SpeziScheduler/UserInfo/UserStorageCoding.swift 57.15% 3 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50/graphs/tree.svg?width=650&height=150&src=pr&token=0VQNE0E1Wp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi)](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) ```diff @@ Coverage Diff @@ ## main #50 +/- ## ========================================== + Coverage 70.60% 70.76% +0.16% ========================================== Files 40 41 +1 Lines 2697 2722 +25 ========================================== + Hits 1904 1926 +22 - Misses 793 796 +3 ``` | [Files with missing lines](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi) | Coverage Δ | | |---|---|---| | [Sources/SpeziScheduler/Task/Outcome.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50?src=pr&el=tree&filepath=Sources%2FSpeziScheduler%2FTask%2FOutcome.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlci9UYXNrL091dGNvbWUuc3dpZnQ=) | `20.52% <ø> (ø)` | | | [Sources/SpeziScheduler/Task/Task.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50?src=pr&el=tree&filepath=Sources%2FSpeziScheduler%2FTask%2FTask.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlci9UYXNrL1Rhc2suc3dpZnQ=) | `68.61% <ø> (ø)` | | | [Sources/SpeziScheduler/UserInfo/UserInfoKey.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50?src=pr&el=tree&filepath=Sources%2FSpeziScheduler%2FUserInfo%2FUserInfoKey.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlci9Vc2VySW5mby9Vc2VySW5mb0tleS5zd2lmdA==) | `0.00% <ø> (ø)` | | | [...rces/SpeziScheduler/UserInfo/UserInfoStorage.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50?src=pr&el=tree&filepath=Sources%2FSpeziScheduler%2FUserInfo%2FUserInfoStorage.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlci9Vc2VySW5mby9Vc2VySW5mb1N0b3JhZ2Uuc3dpZnQ=) | `65.00% <100.00%> (+0.60%)` | :arrow_up: | | [...s/SpeziSchedulerMacros/UserStorageEntryMacro.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50?src=pr&el=tree&filepath=Sources%2FSpeziSchedulerMacros%2FUserStorageEntryMacro.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlck1hY3Jvcy9Vc2VyU3RvcmFnZUVudHJ5TWFjcm8uc3dpZnQ=) | `92.09% <100.00%> (+1.11%)` | :arrow_up: | | [...es/SpeziScheduler/UserInfo/UserStorageCoding.swift](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50?src=pr&el=tree&filepath=Sources%2FSpeziScheduler%2FUserInfo%2FUserStorageCoding.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi#diff-U291cmNlcy9TcGV6aVNjaGVkdWxlci9Vc2VySW5mby9Vc2VyU3RvcmFnZUNvZGluZy5zd2lmdA==) | `57.15% <57.15%> (ø)` | | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50?dropdown=coverage&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/SpeziScheduler/pull/50?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordSpezi). Last update [7ba1ed8...80dab24](https://app.codecov.io/gh/StanfordSpezi/SpeziScheduler/pull/50?dropdown=coverage&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).