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

Zero values of UpdateDNSRecordParams should keep the comments #1371

Closed
2 tasks done
favonia opened this issue Aug 19, 2023 · 1 comment · Fixed by #1393
Closed
2 tasks done

Zero values of UpdateDNSRecordParams should keep the comments #1371

favonia opened this issue Aug 19, 2023 · 1 comment · Fixed by #1393
Milestone

Comments

@favonia
Copy link
Contributor

favonia commented Aug 19, 2023

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the library and it is still present.

cloudflare-go version

0.75

Go environment

N/A

Expected output

Previously, the Go interface will keep the original comments because of omitempty. It's not ideal because there's no easy way to clear comments, where an empty string will keep the original comment because omitempty will omit empty strings. The API has since then changed to clear comments when an empty string is used, and the Go library was updated, but then one cannot easily keep the current comments. I believe the expected behavior of Update with zero values is to keep everything, and using strings cannot distinguish the two important cases: (1) keep the current comment and (2) clear the current comment.

Suggested solution: use *string for the Comment field and add back omitempty.

Actual output

See above

Code demonstrating the issue

// This will clear the comments
c.UpdateDNSRecord(ctx, ZoneIdentifier(zone), UpdateDNSRecordParams{
		ID:      id,
		Content: ip,
	}
)

Steps to reproduce

See above

References

@github-actions
Copy link
Contributor

This functionality has been released in v0.77.0.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant