Skip to content

Fuzzy return data is in a different structure to strapi rest query data #167

@gregg-cbs

Description

@gregg-cbs

Hi,

There is inconsistencies in your data response vs strapi rest api data response which is creating an anti-pattern.

When populating on fuzzy search we get back results like this:

[
  {
    "id": 4,
    "name": "YurMart",
    "banner": { // populated field
      "id": 79,
      "url": "https://ik.imagekit.io/cbs/ticketland/dev/crowd.jpg_FCCgK-CSL.png",
      "type": "image"
    }
  }
]

But in strapi rest api the root and populated results are nested in "data" and "attributes" properties:

[
  {
    "id": 4,
    "attributes": {  // nested in attributes
      "name": "YurMart",
      "banner": { // rest api populated field
        "data": {
          "id": 79,
          "attributes": {
            "url": "https://ik.imagekit.io/cbs/ticketland/dev/crowd.jpg_FCCgK-CSL.png",
            "type": "image"
          }
        }
      }
    }
  }
]

I tried to ditch the initial strapi rest api query for fuzzy search just to return some initial data for page load but you cannot use fuzzy search without passing a search query.

What do you recommend?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions