-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
fix: allow setting request description and still gen schema #587
Conversation
WalkthroughThe pull request introduces changes to the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #587 +/- ##
==========================================
- Coverage 92.80% 92.80% -0.01%
==========================================
Files 22 22
Lines 3904 3903 -1
==========================================
- Hits 3623 3622 -1
Misses 236 236
Partials 45 45 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 2
Outside diff range and nitpick comments (1)
huma.go (1)
585-585
: Improve test coverage for content type handlingThe static analysis tool indicates that line 585 is not covered by tests. This line handles custom content types specified in the field tag.
To improve test coverage, consider adding a test case that includes a field with a custom content type tag. Would you like me to provide an example test case or open a GitHub issue to track this task?
Tools
GitHub Check: codecov/patch
[warning] 585-585: huma.go#L585
Added line #L585 was not covered by tests
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- huma.go (2 hunks)
- huma_test.go (1 hunks)
Additional context used
GitHub Check: codecov/patch
huma.go
[warning] 585-585: huma.go#L585
Added line #L585 was not covered by tests
Additional comments not posted (2)
huma.go (1)
595-597
: LGTM: Proper initialization of Content mapThe initialization of the
Content
map is correctly implemented. It ensures that the map is created if it doesn't exist, preventing potential nil pointer dereferences later in the code.huma_test.go (1)
547-582
: LGTM! The new test case aligns well with the PR objectives.This test case effectively verifies the ability to set a description for the request body while still generating the schema. It covers the following key aspects:
- Setting up a request body with a description.
- Verifying the correct handling of the input body.
- Checking the generated OpenAPI schema for the presence of the description, required flag, and correct content type.
This addition helps ensure that the changes meet the requirements outlined in issue #563.
This PR makes the request body generation code align with the response body code, where missing fields are auto-generated, enabling you to provide partial information like the request body description when desired.
Fixes #563.
Summary by CodeRabbit
New Features
Tests