Fix required tag interpretation for map fields#15
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.
This was missed in the previous refactoring (it is not expected here as required tag doesn't have a value)
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