-
-
Notifications
You must be signed in to change notification settings - Fork 152
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(schema): add dereferencing for SchemaFromType #518
fix(schema): add dereferencing for SchemaFromType #518
Conversation
Warning Rate limit exceeded@danielgtaylor has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 17 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe recent changes enhance schema generation and transformation within the codebase. The Changes
Assessment against linked issues
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- schema.go (1 hunks)
- schema_test.go (4 hunks)
Additional comments not posted (5)
schema.go (1)
650-651
: LGTM! But verify the function usage in the codebase.The addition of
t = deref(t)
ensures that pointer types are correctly dereferenced before further processing, improving robustness.However, ensure that all function calls to
SchemaFromType
handle the dereferenced types correctly.Verification successful
Verification successful!
The addition of
t = deref(t)
ensures that pointer types are correctly dereferenced before further processing, improving robustness. The function calls toSchemaFromType
handle the dereferenced types correctly.
registry.go
: The dereferenced type is managed appropriately after the call toSchemaFromType
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `SchemaFromType` handle the dereferenced types correctly. # Test: Search for the function usage. Expect: Correct handling of dereferenced types. rg --type go -A 5 $'SchemaFromType'Length of output: 2396
Script:
#!/bin/bash # Extract relevant code around the usage of SchemaFromType in registry.go to verify handling of dereferenced types. rg --type go -A 10 -B 10 $'SchemaFromType' registry.goLength of output: 393
schema_test.go (4)
76-77
: Declare the interface implementation.The declaration ensures that
CustomSchemaPtr
implements thehuma.SchemaTransformer
interface.
78-80
: Define theCustomSchemaPtr
struct.The struct
CustomSchemaPtr
contains a single fieldValue
of typestring
, annotated for JSON serialization.
82-85
: Implement theTransformSchema
method.The method
TransformSchema
modifies the schema's description to "custom description" and returns the modified schema.
906-920
: Add a new test case forCustomSchemaPtr
.The test case
schema-transformer-for-ptr
verifies the output of theTransformSchema
method when invoked with an instance ofCustomSchemaPtr
.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #518 +/- ##
=======================================
Coverage 92.83% 92.83%
=======================================
Files 22 22
Lines 3838 3839 +1
=======================================
+ Hits 3563 3564 +1
Misses 230 230
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- schema.go (1 hunks)
- schema_test.go (4 hunks)
Files skipped from review as they are similar to previous changes (2)
- schema.go
- schema_test.go
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.
Thanks!
It fixes #517
Summary by CodeRabbit
New Features
CustomSchemaPtr
, allowing for modified schema descriptions.Tests
CustomSchemaPtr
transformer, ensuring correct schema outputs.