Generated custom query for @key directive, doesn't return custom non-model types within data model #553
Closed
3 tasks done
Labels
bug
Something isn't working
p2
transferred
Issue has been transferred from another Amplify repository
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
GraphQL API
Amplify Categories
api
Environment information
Describe the bug
When creating a secondary index using @key directive on a model to generate a new query (not by id) in graphql-api.ts, the resulting query does not return attributes that are custom types and only returns the primitives (or array of primitive) attributes.
Expected behavior
While the get and list methods generated for my data model correctly return the custom types, I would expect the generated queries when querying on a secondary index (via @key) to also return custom types associated within a data model, but they do not.
When running the query in the queries section of the AWS AppSync UI tool (which I got to via the GraphQL API section of the amplify admin UI tool), I am able to get the custom types returned there from my custom query (when specifically asking for them to be returned in the query explorer).
Reproduction steps
This then updates graphql-api.ts but the generated query is missing the custom types.
Code Snippet
The generated code is:
While the getQuery does contain the custom values and is the following:
Log output
aws-exports.js
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: