-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
feat: dependent required tag #303
feat: dependent required tag #303
Conversation
@danielgtaylor do you think we should write a |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #303 +/- ##
==========================================
+ Coverage 95.08% 95.11% +0.03%
==========================================
Files 19 19
Lines 2744 2765 +21
==========================================
+ Hits 2609 2630 +21
Misses 98 98
Partials 37 37 ☔ View full report in Codecov by Sentry. |
5f7566c
to
c8be1f9
Compare
@danielgtaylor While making this pull request, there was a One thing to notice: I did not validate if the dependents fields exist, but I could add this validation and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great work! Thank you 👍
I think it would be good to panic if there is a typo or the wrong field name is provided, so I'll hold off merging unless you want to do that in another PR.
Oh, and one last thing, you'll want to modify https://github.com/danielgtaylor/huma/blob/main/docs/mkdocs.yml#L54-L59 so your new how-to doc shows up in the menu properly! |
@danielgtaylor done! added the panic for non existing fields and updated the docs! |
This pull request adds the ability to define some fields to be required only when other fields are present with the struct tag
dependentRequired
.Resolves issue #296