Skip to content
This repository has been archived by the owner on Dec 28, 2020. It is now read-only.

Nested fields and expand in REST API #11

Open
yii-bot opened this issue Apr 5, 2018 · 3 comments
Open

Nested fields and expand in REST API #11

yii-bot opened this issue Apr 5, 2018 · 3 comments
Labels
status:ready for adoption Feel free to implement this issue. type:feature New feature
Milestone

Comments

@yii-bot
Copy link

yii-bot commented Apr 5, 2018

This issue has originally been reported by @ghost at yiisoft/yii2#8061.
Moved here by @samdark.


Facebook Graph API also uses fields and expand query parameters in REST APIs. Now Yii2 supports same but upto 1 level. Can we do nested fields like Facebook, for example:

GET graph.facebook.com/me?fields=albums.limit(5){name, photos.limit(2){name, picture, tags.limit(2)}},posts.limit(5)

In above example, my albums are limits to 5 only and again in each album only name and photos fields will be fetched with max 2 photos per album with again photos nested to give max 2 tags per photo. Along with albums, it will also give max 5 posts of the user.

Now limit(n) would be advance feature but I think nested expand is something easy to implement and really necessary feature to have.

PS: On separate note if you plan to support nested limit, you can also look into offset and sort on nested elements.

@mitrm

This comment has been minimized.

@lubobill1990

This comment has been minimized.

@samdark samdark added type:feature New feature status:ready for adoption Feel free to implement this issue. labels Sep 8, 2020
@samdark
Copy link
Member

samdark commented Sep 8, 2020

Great to have this as a feature.

@samdark samdark added this to the 1.0.0 milestone Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:ready for adoption Feel free to implement this issue. type:feature New feature
Projects
None yet
Development

No branches or pull requests

4 participants