nukosuke / go-zendesk

Zendesk API client library for Go
https://pkg.go.dev/github.com/nukosuke/go-zendesk/zendesk
MIT License
62 stars 81 forks source link

json: cannot unmarshal array into Go struct field MacroAction.macros.actions.value #253

Open Code-Hex opened 1 year ago

Code-Hex commented 1 year ago

I got an error message when I send a request to /macros.json . I did the investigation, this error happened when the API responded like the below.

"actions": [
        {
          "field": "side_conversation_ticket",
          "value": [
            "こんにちは",
            "<p>■テストです。</p>",
            "SupportAssignable:support_assignable/group/5291292944015",
            "text/html"
          ]
        }
]
nukosuke commented 1 year ago

@Code-Hex

Thank you for your report.

The reason is that the Value field of MacroAction struct is fixed to string type. https://github.com/nukosuke/go-zendesk/blob/790f26d3638907a7e699a5f02757a190c9c48903/zendesk/macro.go#L27-L30

We should make it interface{} to handle []string.