Closed selected-pixel-jameson closed 2 years ago
Looks like this is being done when calling transformResponse
. I'm not sure if this is intentional and or why Strapi API's are not doing this.
Ok. I think I see what is happening here. It looks like you have another project https://github.com/ComfortablyCoding/strapi-plugin-transformer
Which is allowing you to set the responses to be transformed, which I like. However I think that the same option should be included in this repo.
So I implemented the plugin-transformer. However, that doesn't really solve the problem because that still returned the data wrapper in nested relationships. Where as this response removes the data wrapper as well. So there are still differences between API responses.
Hello @selected-pixel-jameson , thanks for the report. The transform function I am using is from strapi core not from my transformer plugin.
You are indeed correct in that the response format is incorrect at the moment. I have found what I believe to be the issue and will push a fix.
This will be fixed in the next release.
If I pass 'populate' values into the query for relational values or component lists the values that come back do not have the same structure as the 'findOne' endpoint.
For example if I call `/api/:model/:id?populate[0]=owner I get the following structure
If I make the same request using the
slugify/slug
endpoint I get the following:Notice how the data and attributes fields are missing on the owner when using the
slugify/slug
endpoint? This will cause the need to create a completely separate response models on the client side for this endpoint vs. the standardfindOne
endpoint.