-
-
Notifications
You must be signed in to change notification settings - Fork 157
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): proper minLength, maxLength in generated schemas. #513
fix(schema): proper minLength, maxLength in generated schemas. #513
Conversation
WalkthroughThe 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 (2 hunks)
Additional comments not posted (7)
schema.go (2)
558-560
: Conditional assignment forminLength
looks good.The conditional assignment ensures that
minLength
is only set if the tag is present, which aligns with the intended behavior.
562-564
: Conditional assignment formaxLength
looks good.The conditional assignment ensures that
maxLength
is only set if the tag is present, which aligns with the intended behavior.schema_test.go (5)
76-77
: New typeTypedStringWithCustomLength
looks good.The type definition is straightforward and prepares for the custom schema method.
78-85
: Custom schema method forTypedStringWithCustomLength
looks good.The method correctly defines a schema with
minLength
andmaxLength
constraints.
860-880
: Test case forfield-custom-length-string-in-slice
looks good.The test case correctly validates the schema generation for a slice of
TypedStringWithCustomLength
withminLength
andmaxLength
constraints.
882-898
: Test case forfield-custom-length-string
looks good.The test case correctly validates the schema generation for a field of
TypedStringWithCustomLength
withminLength
andmaxLength
constraints.
900-916
: Test case forfield-ptr-to-custom-length-string
looks good.The test case correctly validates the schema generation for a pointer to
TypedStringWithCustomLength
withminLength
andmaxLength
constraints.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #513 +/- ##
=======================================
Coverage 92.83% 92.83%
=======================================
Files 22 22
Lines 3838 3840 +2
=======================================
+ Hits 3563 3565 +2
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
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.
Nice find, thanks for the fix 👍
It fixes #512
Summary by CodeRabbit
New Features
Tests