FusionAuth / go-client

FusionAuth Go Client Library!
https://fusionauth.io/
Apache License 2.0
29 stars 32 forks source link

Create a User Registration (for an existing user) #49

Closed lauchste closed 3 years ago

lauchste commented 3 years ago

"Create a User Registration (for an existing user)"

Doesnt seem to work, because of https://stackoverflow.com/questions/33447334/golang-json-marshal-how-to-omit-empty-nested-struct (a User Object is always passed, even if its ommitted, causing your Client to want to create a new User)

Could you maybe change Domain.go line 2691 into a User-Pointer, like so? type RegistrationRequest struct { GenerateAuthenticationToken bool json:"generateAuthenticationToken" Registration UserRegistration json:"registration,omitempty" SendSetPasswordEmail bool json:"sendSetPasswordEmail" SkipRegistrationVerification bool json:"skipRegistrationVerification" SkipVerification bool json:"skipVerification" User *User json:"user,omitempty" }

Then it works.

mooreds commented 3 years ago

Hiya,

Welcome to the FusionAuth community @lauchste, thanks for opening an issue!

We've had this on the list to change that to a pointer, but haven't had the time to test it and didn't want to ship untested code.

However, we happily accept PRs. These client libraries are built using https://github.com/fusionauth/fusionauth-client-builder but I haven't worked through how to change the type of User to *User.

This feels like a duplicate of https://github.com/FusionAuth/go-client/issues/48 . Is that correct? If so, there are some workarounds on that issue too.

lauchste commented 3 years ago

Yes, it's a duplicate. For now I'm using the workaround described there.