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

Be able to make GraphQLRequest.list that only include certain attributes #3882

Open
concavegit opened this issue Sep 22, 2024 · 2 comments
Open
Labels
api Issues related to the API category feature-request Request a new feature

Comments

@concavegit
Copy link

Is your feature request related to a problem? Please describe.

I am trying to create a query that lists just the owners of each item in a schema, like this:

let request = GraphQLRequest<MyModel>.list(MyModel.self)

I was trying to find a way to only include the owner using includes, like this

let request = GraphQLRequest<MyModel>.list(MyModel.self, includes: { myModel -> myModel.owner })

but from the documentation and type errors, includes is just to include relations and not attributes.

Being able to query by fields is important because some fields may not be readable by all users. The only way to make a list query in this case would be to only query fields that the user does have access to.

Describe the solution you'd like

I'd like something like GraphQLRequest<MyModel>.list(MyModel.self, attributes: [my_list_of_attributes]), or more realistically attributes: ModelPath -> [FieldPath].

Describe alternatives you've considered

I am guessing this is technically possible by using a lower level function using ModelBasedGraphQLDocumentBuilder. If that is the solution you recommend, could you provide some documentation for it?

Is the feature request related to any of the existing Amplify categories?

No response

Additional context

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Sep 22, 2024
@phantumcode phantumcode added the feature-request Request a new feature label Sep 23, 2024
Copy link
Contributor

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

@phantumcode phantumcode added the api Issues related to the API category label Sep 23, 2024
@phantumcode
Copy link
Contributor

Thank you for posting the feature request. Our team would take a look and post updates here.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 23, 2024
@mattcreaser mattcreaser removed the pending-triage Issue is pending triage label Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues related to the API category feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

3 participants