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

Revert DNSRecord.Proxied type into bool and remove omitempty tag #962

Closed
wants to merge 4 commits into from

Conversation

zeithrold
Copy link

@zeithrold zeithrold commented Jun 29, 2022

Description

Here are some reasons that motivated me to do this commitments.

Previously pointer type causes difficulty to approach to the API

Current version require a pointer to assign boolean value into DNSRecord.Proxied. So to assign a truthy value, instead of true, I must use &[]bool{true}[0] or any other equal item, which is a strange view in code written in golang.

Clearer is better

In this pull request I removed omitempty tag and added default tag. The reason is proxied attribute in CloudFlare DNS API (Client Payload) is either required or optional but default is falsy. I supposed that it might be a better solution to make DNSRecord.Proxied explicit in order to call functions more clearly.

BTW

Has your change been tested?

Yes, via given GitHub Actions workflows.

Types of changes

What sort of change does your code introduce/modify?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • This change is using publicly documented (api.cloudflare.com or developers.cloudflare.com) and stable APIs.

@zeithrold zeithrold requested a review from jacobbednarz as a code owner June 29, 2022 18:00
@jacobbednarz
Copy link
Member

thanks for the PR however, i'm afriad we won't be accepting it. dependent systems, such as the Terraform provider, rely on this to send a payload explicitly without the proxied value when setting the TTL.

So to assign a truthy value, instead of true, I must use &[]bool{true}[0] or any other equal item, which is a strange view in code written in golang.

check out the type conversion helpers we ship with the library; they help with the syntax issues you're having.

@zeithrold
Copy link
Author

Thank you for your reply! But I might think that it's necessary to remind that in document.

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.

2 participants