Skip to content

[bug]: cannot unmarshal response with user data #769

Closed
algolia/api-clients-automation
#4702
@greg0ire

Description

@greg0ire

Description

When I perform a search, and that search triggers a query rule that has a userData consequence, the SDK crashes.

I believe that's because although userData in the rule is an object, userData in the response is an array, probably in case several query rules trigger.

As a consequence, this looks wrong:

UserData map[string]any `json:"userData,omitempty"`

I think it should be []map[string]any.

Client

Search

Version

4.13.0

Relevant log output

"userData": [
            {
              "id": 2,
              "slug": "brand-2"
            }
          ],
…


`cannot decode result: failed to unmarshal response body: failed to unmarshal SearchResponse: json: cannot unmarshal array into Go struct field _SearchResponse.userData of type map[string]interface {}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions