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

Defaults values #29

Closed
oassuncao opened this issue Jun 30, 2022 · 8 comments
Closed

Defaults values #29

oassuncao opened this issue Jun 30, 2022 · 8 comments

Comments

@oassuncao
Copy link

I'm trying to disable a targetservers, but the parameter is not sent to Google API because we are using omitempty

This problem could happen with many other types (int, boolean, string, etc)

	IsEnabled   bool     `json:"isEnabled,omitempty"`

IsEnabled bool `json:"isEnabled,omitempty"`

srinandan added a commit that referenced this issue Jun 30, 2022
@srinandan
Copy link
Collaborator

I have created a fix for this issue and can create a preview release with the fix.

@oassuncao
Copy link
Author

I guess the fix will not work properly, the JSON struct continues with omitempty. I guess this problem is occurring in other endpoints

I can test the preview release

@srinandan
Copy link
Collaborator

I don't think the omitempty in the struct matters. The method is called from here. The default value is true. Therefore a value is always passed (nil is never sent).

Secondly, for the API itself, not sending enabled is the same as true. See here for reference.

The bug was that I was only sending something when true and nothing when false, therefore you couldn't disable it. But now I always send true/false, so you should be able to control it.

@srinandan
Copy link
Collaborator

Please try this version - v1.110-beta.1

@oassuncao
Copy link
Author

I tested the new version, but the problem continues

srinandan added a commit that referenced this issue Jul 1, 2022
@srinandan
Copy link
Collaborator

My apologies, you are correct. That did not fix the problem. I have fixed the problem in the new version and also looked at other places that may require this change (and no other struct was affected).

Here is the new release. Thank you for you patience and tests.

@oassuncao
Copy link
Author

Now, it's working properly

Do you know when will release the stable and latest version?

@srinandan
Copy link
Collaborator

I have a release once a month. The next release is around the 25rd of July.

srinandan added a commit that referenced this issue Jul 29, 2022
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

No branches or pull requests

2 participants