Skip to content

Commit 7ae9e70

Browse files
Dragomir-Ivanovsmyrman
authored andcommitted
Fix field hook for HTTP PUT
Always calls `OnUpdate` field hook on HTTP PUT for existing documents.
1 parent 552d179 commit 7ae9e70

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Below is an overview over recent breaking changes, starting from an arbitrary po
8989
- `filter` parameters will be validated for type match only, instead of type & constrains.
9090
- PR #228: `Reference` projection fields will be validated against referenced resource schema.
9191
- PR #230: `Connection` projection fields will be validated against connected resource schema.
92+
- PR #241: Always call `OnUpdate` field hook on HTTP PUT for existing documents.
9293

9394
From the next release and onwards (0.2), this list will summarize breaking changes done to master since the last release.
9495

schema/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func (s Schema) Prepare(ctx context.Context, payload map[string]interface{}, ori
188188
// Call the OnInit or OnUpdate depending on the presence of the original doc and the
189189
// state of the replace argument.
190190
var hook func(ctx context.Context, value interface{}) interface{}
191-
if original == nil || replace {
191+
if original == nil {
192192
hook = def.OnInit
193193
} else {
194194
hook = def.OnUpdate

0 commit comments

Comments
 (0)