Skip to content

Commit

Permalink
removed useless functions, ensured we use pointers on chaining functions
Browse files Browse the repository at this point in the history
  • Loading branch information
James Humphries committed Sep 28, 2021
1 parent 0f01b19 commit 055d494
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
2 changes: 1 addition & 1 deletion genericproblem.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type GenericProblem struct {
Instance string `json:"instance,omitempty"` // A URI reference that identifies the specific ocurrence. Does not need to derefrence to something
}

func (problem GenericProblem) WithType(t string) GenericProblem {
func (problem *GenericProblem) WithType(t string) *GenericProblem {
problem.Type = t
return problem
}
Expand Down
22 changes: 1 addition & 21 deletions validationproblem.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type ValidationProblem struct {
ValidationErrors []ValidationError `json:"validationerrors,omitempty"` // a list of the validation errors that occurred
}

func (problem ValidationProblem) WithType(t string) ValidationProblem {
func (problem *ValidationProblem) WithType(t string) *ValidationProblem {
problem.Type = t
return problem
}
Expand All @@ -45,26 +45,6 @@ func (problem *ValidationProblem) WithInstance(instance string) *ValidationProbl
return problem
}

func (problem *ValidationProblem) ProblemType() string {
return problem.Type
}

func (problem *ValidationProblem) ProblemTitle() string {
return problem.Title
}

func (problem *ValidationProblem) ProblemStatus() int {
return problem.Status
}

func (problem *ValidationProblem) ProblemDetail() string {
return problem.Detail
}

func (problem *ValidationProblem) ProblemInstance() string {
return problem.Instance
}

func FromValidationErrors(validationErrors validator.ValidationErrors) ValidationProblem {
var errs []ValidationError

Expand Down

0 comments on commit 055d494

Please sign in to comment.