GSI creation with @index doesn't set default value for name
property
#561
Labels
amplify-codegen
Issues on amplify-codegen
bug
Something isn't working
DataStore
model-gen
Issues on datastore model generation
p2
Before opening, please confirm:
How did you install the Amplify CLI?
No response
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
11.0.3
What operating system are you using?
macOS
Amplify Codegen Command
codegen models
Describe the bug
If I annotate a field in my model type with the
@index
directive without supplying a value forname
, the generated MIPR also omits the name field. This causes DataStore to incorrectly treat the key attribute as a primary key, as the presence/absence of thename
field in the MIPR is the only way DataStore can distinguish between PKs and GSIs. Inability to distinguish between these types of keys causes unexpected behavior DataStore.Example:
Generates
Expected behavior
Codegen should default the
name
to the query field generated by the GQL transformer. For example, for the schema above, it would bePostByTitle
orbyTitle
.Reproduction steps
GraphQL schema(s)
Log output
Additional information
No response
The text was updated successfully, but these errors were encountered: