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

Create new error abstraction for field validation #239

Merged
merged 29 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
62fbec9
NewName should be optional
Integralist Nov 20, 2020
c8266eb
create generic error type
Integralist Nov 20, 2020
4767b38
update service validation
Integralist Nov 20, 2020
3d1412b
service version 'comment' is required
Integralist Nov 20, 2020
f5da772
clarify in README use of pointers for mandatory fields on list operat…
Integralist Dec 8, 2020
4d6ee69
remove unnecessary TLS prefix
Integralist Dec 8, 2020
fdbcd02
when updating a dict item, the value should be required not optional
Integralist Dec 9, 2020
d21907d
indicate both fields are required
Integralist Dec 18, 2020
5fce681
capture domain update 'optional field' error in a test
Integralist Dec 18, 2020
b5061f2
start moving errors over to new field error type
Integralist Dec 18, 2020
ec17c1f
fix honeycomb to use new error field
Integralist Dec 18, 2020
d9fafa8
fix resources to use new error field validation
Integralist Dec 18, 2020
4354cee
refactor method name on FieldError
Integralist Dec 21, 2020
91865f8
tweak docstring for FieldError#Error
Integralist Dec 21, 2020
ed2e228
revert a possibly unnecessary change
Integralist Dec 21, 2020
8b2351a
update README (v2 and v3 links)
Integralist Jan 4, 2021
5bf8b58
update go.mod to v3
Integralist Jan 4, 2021
d8c505c
revert to sentinel errors
Integralist Jan 5, 2021
962ab15
remove note
Integralist Jan 5, 2021
33c924a
revert errors.Is
Integralist Jan 5, 2021
75af790
fix managed logging code as rebase cleared a new error sentinel
Integralist Jan 19, 2021
2a4023d
update README to reflect merged breaking changes
Integralist Jan 19, 2021
ad53703
fix bad rebase
Integralist Jan 19, 2021
8b02ccc
revert change to DitionaryUpdate ItemValue (we'll move to separate PR)
Integralist Jan 19, 2021
d7870fa
revert change to NewName being optional (we'll move to separate PR)
Integralist Jan 19, 2021
72e149f
Avoid hardcoded strings for validating errors
Integralist Jan 19, 2021
ce9a8a1
revert change to TLS Configuration and Domain (we'll move to separate…
Integralist Jan 19, 2021
7b9ef85
revert change from Service to ServiceID (we'll move to separate PR)
Integralist Jan 19, 2021
dc644df
revert change from ID to ServiceID (we'll move to separate PR)
Integralist Jan 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revert change to NewName being optional (we'll move to separate PR)
  • Loading branch information
Integralist committed Jan 19, 2021
commit d7870faa884fef325618ea89531b2e78cf91f152
6 changes: 1 addition & 5 deletions fastly/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ type UpdateDomainInput struct {
Name string

// NewName is the updated name of the domain
NewName *string `form:"name,omitempty"`
NewName string `form:"name"`

// Comment is a personal, freeform descriptive note.
Comment *string `form:"comment,omitempty"`
Expand All @@ -172,10 +172,6 @@ func (c *Client) UpdateDomain(i *UpdateDomainInput) (*Domain, error) {
return nil, ErrMissingName
}

if i.NewName == nil && i.Comment == nil {
return nil, ErrMissingOptionalNameComment
}

path := fmt.Sprintf("/service/%s/version/%d/domain/%s", i.ServiceID, i.ServiceVersion, url.PathEscape(i.Name))
resp, err := c.PutForm(path, i, nil)
if err != nil {
Expand Down
11 changes: 1 addition & 10 deletions fastly/domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestClient_Domains(t *testing.T) {
ServiceID: testServiceID,
ServiceVersion: tv.Number,
Name: "integ-test.go-fastly.com",
NewName: String("new-integ-test.go-fastly.com"),
NewName: "new-integ-test.go-fastly.com",
})
})
if err != nil {
Expand Down Expand Up @@ -203,15 +203,6 @@ func TestClient_UpdateDomain_validation(t *testing.T) {
if err != ErrMissingName {
t.Errorf("bad error: %s", err)
}

_, err = testClient.UpdateDomain(&UpdateDomainInput{
ServiceID: "foo",
ServiceVersion: 1,
Name: "bar",
})
if err != ErrMissingOptionalNameComment {
t.Errorf("bad error: %s", err)
}
}

func TestClient_DeleteDomain_validation(t *testing.T) {
Expand Down