mongodb / go-client-mongodb-atlas

Go Client for MongoDB Atlas
https://www.mongodb.com/docs/atlas/reference/api-resources-spec/
Apache License 2.0
79 stars 34 forks source link

fix: Removed omitempty from tags in ServerlessUpdateRequestParams #509

Closed cveticm closed 1 year ago

cveticm commented 1 year ago

This will allow for operators to remove all tags from Serverless Instances as tags will not be omitted when sending an empty array of tags.

Description

Please include a summary of the fix/feature/change, including any relevant motivation and context.

Link to any related issue(s):

Type of change:

Required Checklist:

Further comments

This is a minor change to allow AKO to remove all tags from a Serverless Instance

matt-condon commented 1 year ago

I think omitempty is very confusing in golang in relation to arrays (pointer values in general) Since we have array of pointers omitEmpty acts only on array itself - not on pointers: https://go.dev/play/p/N64Ggd7Gdth

@wtrocki This approach is a convention across this client, so I think we're fine to go with this for consistency (also any other approach would likely introduce a breaking change)

wtrocki commented 1 year ago

@wtrocki This approach is a convention across this client

I understand that. Trick is that removing ommitempty has no impact unless (breaking) suggestion by @gssbzn is applied.

https://go.dev/play/p/RKmHl4b0X6p