netlify / gotrue

An SWT based API for managing users and issuing SWT tokens.
https://www.gotrueapi.org
MIT License
3.82k stars 283 forks source link

Merge instance update params with existing instance #258

Closed vbrown608 closed 4 years ago

vbrown608 commented 4 years ago

- Summary When we update an Identity instance from Netlify's API, we first get the identity instance from gotrue, then merge in any updates, and finally send the merged instance back to gotrue to replace the original.

This is problematic because gotrue no longer serializes the instance's SMTP password field (https://github.com/netlify/gotrue/pull/227).

This PR changes the instance update handler to merge the existing instance configuration with the request parameters. Fields can be explicitly unset by including the field's zero value (eg an empty string) in the json request body instead of omitting the key.

- Test plan Added test that show

- Description for the changelog Allow partial update of Instance fields in the Instance update handler.

- A picture of a cute animal (not mandatory but encouraged) snowcat