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

Introduce SpeziValidation #21

Merged
merged 13 commits into from
Nov 5, 2023
Merged

Introduce SpeziValidation #21

merged 13 commits into from
Nov 5, 2023

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Nov 3, 2023

Introduce SpeziValidation

♻️ Current situation & Problem

SpeziAccount currently implements a lot of logic around input validation that can easily separated into its own, self-contained target. This PR factors out those validation-based components and moves them into a new target in SpeziViews: SpeziValidation. This includes models to build ValidationRules and views like VerifiableTextField that automatically perform validation on their input (given it's configured in the environment) and display potential validation errors.

Would recommend to visit the nicely structured documentation for a great overview of the different components :)

⚙️ Release Notes

  • Introduce SpeziValidation. A single-step solution to all client-side, input validation.

Breaking Changes

  • The onTapFocus modifiers were replaced by a new, simple to use focusOnTap() modifier that doesn't require passing in a FocusState anymore.

📚 Documentation

Components coming from SpeziAccount were already documented in great detail. This PR created the respective string catalog and structured all new files within a new SPM target.

✅ Testing

Appropriate UI testing was added.

📝 Code of Conduct & Contributing Guidelines

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

Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Merging #21 (8c2a3f8) into main (b27cb60) will increase coverage by 3.97%.
The diff coverage is 79.30%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #21      +/-   ##
==========================================
+ Coverage   73.33%   77.29%   +3.97%     
==========================================
  Files          21       34      +13     
  Lines         686     1061     +375     
==========================================
+ Hits          503      820     +317     
- Misses        183      241      +58     
Files Coverage Δ
Sources/SpeziValidation/ValidationModifier.swift 100.00% <100.00%> (ø)
...tion/ValidationState/CapturedValidationState.swift 100.00% <100.00%> (ø)
...on/ValidationState/ReceiveValidationModifier.swift 100.00% <100.00%> (ø)
.../SpeziValidation/Views/ValidationResultsView.swift 100.00% <100.00%> (ø)
...es/SpeziValidation/Views/VerifiableTextField.swift 93.55% <93.55%> (ø)
...ion/Configuration/ValidationDebounceDuration.swift 50.00% <50.00%> (ø)
...Configuration/ValidationEngine+Configuration.swift 66.67% <66.67%> (ø)
...ation/ValidationState/FailedValidationResult.swift 57.15% <57.15%> (ø)
...rces/SpeziValidation/ValidationRule+Defaults.swift 91.23% <91.23%> (ø)
...ziValidation/ValidationState/ValidationState.swift 70.00% <70.00%> (ø)
... and 4 more

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b27cb60...8c2a3f8. Read the comment docs.

@PSchmiedmayer
Copy link
Member

Nice, great start here @Supereg 🚀

@Supereg Supereg marked this pull request as ready for review November 4, 2023 05:54
@Supereg Supereg requested a review from PSchmiedmayer November 4, 2023 06:02
Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for moving this over to this target and dramatically improving it!

Looks great and ready to be merge from my side. Feel free to tag a new release once the elements are merged.

@Supereg Supereg merged commit f6666dc into main Nov 5, 2023
7 checks passed
@Supereg Supereg deleted the feature/spezi-validation branch November 5, 2023 22:28
Supereg added a commit that referenced this pull request Nov 6, 2023
# Add PersonalInfo and Validation to SPI documentation targets

## ♻️ Current situation & Problem
#20 and #21 introduced additional documentation targets. This PR adds
them to the spi.yml such that the Swift Package Index properly builds
them.


## ⚙️ Release Notes 
* Configured new documentation targets to be exported to SPI.


## 📚 Documentation
--


## ✅ Testing
--

## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
Supereg added a commit to StanfordSpezi/SpeziAccount that referenced this pull request Nov 6, 2023
# Move to SpeziValidation package

## ♻️ Current situation & Problem
Currently, SpeziAccount contains a lot of code that is not specific to
account management. One part is input validation.
StanfordSpezi/SpeziViews#21 introduces the new
`SpeziValidation` library, based on previous code in SpeziAccount. This
PR makes the efforts to move to that new software package and greatly
simplify the `SpeziAccount` code base.


## ⚙️ Release Notes 
* Update to `SpeziValidation`, a new one-stop software package for input
validation


## 📚 Documentation
Documentation was addressed where needed.

_TBA_: Some documentation still requires external links once the
SpeziViews PR is merged.


## ✅ Testing
Tests were adapted where needed. Nothing new was added.


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
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.

2 participants