amplify-swift icon indicating copy to clipboard operation
amplify-swift copied to clipboard

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

Open concavegit opened this issue 1 year ago • 2 comments

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

concavegit avatar Sep 22 '24 01:09 concavegit

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!

github-actions[bot] avatar Sep 23 '24 14:09 github-actions[bot]

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

phantumcode avatar Sep 23 '24 14:09 phantumcode