Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetRealm has serialization error when realm is an empty string #470

Closed
Dmarcotrigiano opened this issue Apr 18, 2024 · 0 comments · Fixed by #471
Closed

GetRealm has serialization error when realm is an empty string #470

Dmarcotrigiano opened this issue Apr 18, 2024 · 0 comments · Fixed by #471

Comments

@Dmarcotrigiano
Copy link
Contributor

Describe the bug
A missing realm is an appropriate call to the API, it will retrieve all realms. The serialization of that fails due to the type expecting a non-empty string, and the API should only return one value.

To Reproduce
Steps to reproduce the behavior:

  1. Create a bootstrap function that creates a default realm using environment variables.
  2. Do not populate the environment variable for realm.
  3. Before creating the default realm, check if the default realm exists.
  4. See response serialization error: could not get realm: json: cannot unmarshal array into Go value of type gocloak.RealmRepresentation

Expected behavior
Malformed request error.

Additional context
I have a bunch of environment variables and missed the guard for realm, burned a lot of time trying to figure out why the serialization wasn't working, until I saw that the call for GetRealms was the same but realm was an empty string.

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

Successfully merging a pull request may close this issue.

1 participant