Skip to content

Commit

Permalink
fix: allow ForceSendFields to work for map types (#2670)
Browse files Browse the repository at this point in the history
The way we generate map types today is map[string]T, where T is a non-pointer type. This means the pointer receiver version of MarshalJSON does not fulfill the Marshaler interface. This is turn means that MarshalJSON is not called in these cases so ForceSendFields overrides do not work. To fix this we can switch the impl to a value receiver which fulfills both value and pointer types. This is not a breaking change for the API, but there is a slight behaviour change if someone was calling MarshalJSON directly. Nil *T's that call MarshalJSON directly will now panic instead of returning JSON `null`. This seems like unlikely usage and worth breaking to fix a bug in common usage.

Internal Bug: 349580049
  • Loading branch information
codyoss authored Jul 8, 2024
1 parent 5cdcbe0 commit 40b5113
Show file tree
Hide file tree
Showing 477 changed files with 71,072 additions and 70,834 deletions.
8 changes: 4 additions & 4 deletions abusiveexperiencereport/v1/abusiveexperiencereport-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions acceleratedmobilepageurl/v1/acceleratedmobilepageurl-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 24 additions & 24 deletions accessapproval/v1/accessapproval-gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 40b5113

Please sign in to comment.