Skip to content
This repository was archived by the owner on Feb 16, 2022. It is now read-only.

Can not remove all clients from a connection #241

Closed
mvanderlee opened this issue Oct 13, 2021 · 1 comment
Closed

Can not remove all clients from a connection #241

mvanderlee opened this issue Oct 13, 2021 · 1 comment

Comments

@mvanderlee
Copy link

mvanderlee commented Oct 13, 2021

Description

Setting c.EnabledClients to an empty list causes it to be omitted from the actual update request and thus the field is not actually updated.

This is because omitempty omits empty slices as well. As found in EnabledClients []interface{} json:"enabled_clients,omitempty".
This appears to be related to golang/go#22480

I'm not familiar with GoLang, but maybe there is a way to omit nil in the MarshalJSON function in connection.py?

Package Version

v5.19.2

Affected Resources

  • management.Connection

Sample Code

c := &management.Connection{
  EnabledClients = []interface{}
}
err = api.Connection.Update(connId, c, management.Context(ctx))

Expected Behavior

Should set EnabledClients to an empty list. i.e.: disable the connection for all clients

Actual Behavior

EnabledClients update is ignored, or if it's the only property set, the request actually fails.

Output

Error: 400 Bad Request: Payload validation error: 'Too few properties defined (0), minimum 1'

References

golang/go#22480

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@sergiught
Copy link
Collaborator

Closed and cloned this issue to auth0/go-auth0#19

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants