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

Implement expires_at in Domain struct #98

Merged
merged 10 commits into from
Jun 18, 2020
Merged

Conversation

duduribeiro
Copy link
Contributor

We deprecated expires_on attribute in our api and in docs in favor of
expires_at. This commit introduces the new expires_at attribute.

Also updated the fixtures with the new field and removing the old
premium_price from Domain Transfer/Register/Renewal.

We deprecated expires_on attribute in our api and in docs in favor of
expires_at. This commit introduces the new expires_at attribute.

Also updated the fixtures with the new field and removing the old
premium_price from Domain Transfer/Register/Renewal.
@duduribeiro duduribeiro added enhancement New feature, enhancement or code changes, not related to defects ready-for-review Pull requests that are ready to be reviewed by other team members. labels Jun 9, 2020
@duduribeiro duduribeiro requested review from jacegu and DXTimer June 9, 2020 00:50
@duduribeiro duduribeiro self-assigned this Jun 9, 2020
dnsimple/domains.go Outdated Show resolved Hide resolved
@duduribeiro duduribeiro removed the ready-for-review Pull requests that are ready to be reviewed by other team members. label Jun 9, 2020
@duduribeiro duduribeiro removed request for jacegu and DXTimer June 9, 2020 19:52
@duduribeiro duduribeiro marked this pull request as draft June 9, 2020 19:53
@duduribeiro
Copy link
Contributor Author

We are trying to implement the same thing we implemented for the ruby one: dnsimple/dnsimple-ruby#186 (stoping using the expiresOn attribute from the json response, and makes the expiresOn to be set based on the expiresAt value)

I still don't know if this is the best way to set expiresOn attribute in the struct.

What I did:

@duduribeiro duduribeiro marked this pull request as ready for review June 12, 2020 17:10
@duduribeiro duduribeiro added the ready-for-review Pull requests that are ready to be reviewed by other team members. label Jun 12, 2020
@duduribeiro duduribeiro requested a review from DXTimer June 12, 2020 17:11
@duduribeiro
Copy link
Contributor Author

Followed with @onlyhavecans proposed. Leave expires_on parsing the field and leave the deprecation note.

Copy link
Member

@onlyhavecans onlyhavecans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify my position on this ticket that was mentioned in a prior comment; I believe the client should reflect the behavior of the API, not hot-patch the API's behavior.

The original version of this PR was splitting off providing a language-based abstraction of our API behavior and now writing in "magic" behavior only for consumers of this and future version. I believe that if we want our API to return the result of expires_at in the expires_on field as part of deprecation we should do this for everyone who accesses the API by modifying the return of in the API itself, not in select clients.

@aeden aeden removed their request for review June 15, 2020 12:28
Copy link
Contributor

@DXTimer DXTimer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
Feel free to update the changelog as part of this PR, if you are going to release a new version after this change.

t.Fatalf("Domains.ListDomains() returned ID expected to be `%v`, got `%v`", want, got)
}
if want, got := "example-alpha.com", domains[0].Name; want != got {
t.Fatalf("Domains.ListDomains() returned Name expected to be `%v`, got `%v`", want, got)
}

if want, got := "2021-06-05", domains[0].ExpiresOn; want != got {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@onlyhavecans @DXTimer @duduribeiro I see two different attributes referenced in the same spec (aka the message doesn't match the code). Is that on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, my fault!. should be expiresOn.

@weppos
Copy link
Member

weppos commented Jun 17, 2020

I believe the client should reflect the behavior of the API, not hot-patch the API's behavior.

@onlyhavecans this is unfortunately not always possible, unless we provision a new version of the API on every change. Clients are the only way we have right now to reliably enforce/expose deprecations.

@duduribeiro duduribeiro deleted the implement_expires_at branch June 18, 2020 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, enhancement or code changes, not related to defects ready-for-review Pull requests that are ready to be reviewed by other team members.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants