-
Notifications
You must be signed in to change notification settings - Fork 2
Fix required tag interpretation for map fields #15
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
Conversation
By default map fields are considered nullable. With 'required', they are not nullable but can be empty. But the current implementation enforced 'required' maps to be non-empty.
WalkthroughThe changes remove specific validation checks for the "required" tag in both the primary validation logic and its tests. Specifically, in Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Validation Caller
participant Validator as zod.go Validator
participant TestSuite as zod_test.go Tests
Caller->>Validator: Request field validation ("required" tag)
Validator->>Validator: Process validation tags (switch-case)
Note right of Validator: "required" branch removed
Validator->>Caller: Return default validation result
TestSuite->>Validator: Execute schema validations (Map & MetadataLength)
Validator->>TestSuite: Return simplified validation outcomes
Possibly related PRs
Suggested reviewers
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🔇 Additional comments (2)
✨ Finishing Touches
🪧 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 (
|
| } else { | ||
| if valValue != "" { | ||
| switch valName { | ||
| case "required": |
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.
This was missed in the previous refactoring (it is not expected here as required tag doesn't have a value)
satvik007
left a comment
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 @hi-rai
Not sure how I got it wrong in the very beginning.
By default map fields are considered nullable. With 'required', they are not nullable but can be empty. But the current implementation enforced 'required' maps to be non-empty.
Summary by CodeRabbit