Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support withCount in ResponseFromApiResource #620

Closed
gwlortscher opened this issue Feb 20, 2023 · 2 comments
Closed

Support withCount in ResponseFromApiResource #620

gwlortscher opened this issue Feb 20, 2023 · 2 comments
Labels
feature-request help wanted Contributions from the community are encouraged

Comments

@gwlortscher
Copy link

When using the ResponseFromApiResource attribute, it's possible to account for usage of whenLoaded in Eloquent API Resources using the with: argument to eager load relationships. whenLoaded is helpful in preventing N+1 query problems in API Resources.

whenCounted / withCount is similarly helpful in preventing N+1 query problems, but doesn't appear to be supported by Scribe. This means counts won't appear in API docs generated by Scribe.

A good solution could be to support withCount in ResponseFromApiResource?

@shalvah
Copy link
Contributor

shalvah commented Mar 4, 2023

I don't work much with these features, so I wouldn't know. PRs welcome!

@shalvah shalvah added the help wanted Contributions from the community are encouraged label Mar 4, 2023
@thewhaleiam
Copy link

When using the ResponseFromApiResource attribute, it's possible to account for usage of whenLoaded in Eloquent API Resources using the with: argument to eager load relationships. whenLoaded is helpful in preventing N+1 query problems in API Resources.

whenCounted / withCount is similarly helpful in preventing N+1 query problems, but doesn't appear to be supported by Scribe. This means counts won't appear in API docs generated by Scribe.

A good solution could be to support withCount in ResponseFromApiResource?

Was there any progress made on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request help wanted Contributions from the community are encouraged
Projects
None yet
Development

No branches or pull requests

3 participants