-
-
Notifications
You must be signed in to change notification settings - Fork 150
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: issue with default field values that can override payload field values #597
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -627,14 +627,17 @@ | |||||
assert.Equal(t, 5, input.Body.Count) | ||||||
assert.Equal(t, []string{"foo", "bar"}, input.Body.Tags) | ||||||
assert.Equal(t, []int{1, 2, 3}, input.Body.Numbers) | ||||||
assert.Equal(t, len(input.Body.Items), 2) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Use On line 630, it's more expressive to use Apply this diff: - assert.Equal(t, len(input.Body.Items), 2)
+ assert.Len(t, input.Body.Items, 2) 📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: Build & Test (1.22)
|
||||||
assert.Equal(t, 1, input.Body.Items[0].ID) | ||||||
assert.True(t, input.Body.Items[0].Verified) | ||||||
assert.Equal(t, 1, input.Body.Items[1].ID) | ||||||
assert.False(t, input.Body.Items[1].Verified) | ||||||
return nil, nil | ||||||
}) | ||||||
}, | ||||||
Method: http.MethodPut, | ||||||
URL: "/body", | ||||||
Body: `{"items": [{"id": 1}]}`, | ||||||
Body: `{"items": [{"id": 1}, {"id": 1, "verified": false}]}`, | ||||||
}, | ||||||
{ | ||||||
Name: "request-body-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 seems kind of inefficient and I'm wondering if there are any edge cases where it would inadvertently overwrite something... 🤔
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.
Here I propose a different way to fix this.