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

v2.7.13 #222

Merged
merged 1 commit into from
Oct 18, 2023
Merged

v2.7.13 #222

merged 1 commit into from
Oct 18, 2023

Conversation

ponbiki
Copy link
Contributor

@ponbiki ponbiki commented Oct 12, 2023

Removes omitempty from tags

@tlkamp
Copy link

tlkamp commented Oct 13, 2023

@ponbiki hello, the removal of omitempty introduced a breaking change to terraform-provider-ns1 when it was removed from blocked tags.

Find the attached issue comment: ns1-terraform/terraform-provider-ns1#304 (comment)

I think this PR will introduce the same issue, but now for tags.

@tlkamp
Copy link

tlkamp commented Oct 13, 2023

The omitempty needed removed from both unfor

@ponbiki Looks like your message was incomplete. Why do they both need removed? Are tags and blocked_tags now required fields of the API? The documentation does not seem to indicate that.

https://ns1.com/api?docId=2185

The removal of the omitempty struct tag is causing your client to send the blocked_tags field to the API even when it has no content now where it was not sent before, resulting in the error I reported:

Error: POST https://api.nsone.net/v1/zones/MYZONE/MYRECORD/A: 400 tags and blocked_tags must be updated together

I believe I'm getting this error because the client is sending an empty list for blocked_tags but the tags field is not present because it is empty and this PR has not been merged.

You'll note that I'm able to get past the error if I specify valid values for tags and blocked_tags in the provider, indicating that the client works fine with the omitempty struct tag present.

@ponbiki
Copy link
Contributor Author

ponbiki commented Oct 13, 2023

The omitempty needed removed from both unfor

@ponbiki Looks like your message was incomplete. Why do they both need removed? Are tags and blocked_tags now required fields of the API? The documentation does not seem to indicate that.

https://ns1.com/api?docId=2185

The removal of the omitempty struct tag is causing your client to send the blocked_tags field to the API even when it has no content now where it was not sent before, resulting in the error I reported:

Error: POST https://api.nsone.net/v1/zones/MYZONE/MYRECORD/A: 400 tags and blocked_tags must be updated together

I believe I'm getting this error because the client is sending an empty list for blocked_tags but the tags field is not present because it is empty and this PR has not been merged.

You'll note that I'm able to get past the error if I specify valid values for tags and blocked_tags in the provider, indicating that the client works fine with the omitempty struct tag present.

My apologies for the unintended comment post. The NS1 API requires that if tags or blocked_tags is POSTed, then the other must also always be POSTed even if said value is NULL/{}/[]. The omitempty was meant to be removed from both tags and blocked_tags as it was causing the same 400 error to be raised from the API you are seeing (which is because blocked_tags: NULL is being sent without corresponding tags.
Edit: This was not a limitation of the original tags design for the self-hosted product (which I believe is documented above). The tag behavior is slightly different in the managed product.

@ponbiki ponbiki merged commit 3520e92 into v2 Oct 18, 2023
5 checks passed
@ponbiki ponbiki deleted the INBOX-2663/empty_tags_not_passed branch October 25, 2023 16:37
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 this pull request may close these issues.

3 participants