go-travis icon indicating copy to clipboard operation
go-travis copied to clipboard

Cannot unmarshal object into Go struct field Request.branch_name of type string

Open dvasilen opened this issue 3 years ago • 0 comments

To replicate: Requests.FindByRepoId API call

opt := &travis.RequestOption{Include: []string{"request.repository"}}
request, res, err := client.Requests.FindByRepoId(context.Background(), 123, 456, opt)

Error

json: cannot unmarshal object into Go struct field Request.branch_name of type string

Go lang structure

type Request struct {
	// Name of the branch requested to be built
	BranchName *string `json:"branch_name,omitempty"`
...

Actual response

"branch_name": {
    "@type": "branch",
    "@href": "/api/repo/123/branch/master",
    "@representation": "minimal",
    "name": "master"
  },

dvasilen avatar Apr 20 '21 17:04 dvasilen