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

Amplify Studio visual data modeling dosn't support @directive

Open da45 opened this issue 2 years ago • 11 comments

Is this related to a new or existing framework?

React Native

Is this related to a new or existing API?

GraphQL API

Is this related to another service?

No response

Describe the feature you'd like to request

can't add @directives like @default, @index, @auth rules, I can't also specify "sort keys"

Describe the solution you'd like

support all aws amplify directives

Describe alternatives you've considered

Edit manually

Additional context

No response

Is this something that you'd be interested in working on?

  • [ ] 👋 I may be able to implement this feature request
  • [ ] ⚠️ This feature might incur a breaking change

da45 avatar Aug 05 '22 19:08 da45

Hope to see studio mature enough to be able to work on advanced features.

da45 avatar Sep 09 '22 07:09 da45

I came up against this bug today, specifically as detailed in #630, #681, and #678. After building and deploying in the visual editor for a month, I added a new model, tried to deploy, and now it is saying the @index directive is unsupported and I am blocked from visual editing. Two questions that don't add up: 1) Why was it working and now it is not?, 2) Why would the visual editor create a directive that is not supported?

KingsleyStephens avatar Jan 13 '23 00:01 KingsleyStephens

Actually I figured out my problem as stated above. I was getting the the @index directive is unsupported error as when I added the new model and added a one-to-one relationship to it from an existing model, the existing model corrupted in the editor. The existing model already had a one-to-many relationship to another model. I got an error in the editor that the one-to-many relationship was entered twice and when I looked on the model I could see the duplicate entry - obviously a bug in the editor. I deleted one, which I thought left the original but it turns out the entry in the schema code had been completely deleted while leaving the index directive dangling on the model that it should have had the relationship with. By fixing up the broken one-to-many relationship in the schema by hand and redeploying I now have access to the visual editor again.

KingsleyStephens avatar Jan 13 '23 02:01 KingsleyStephens

+1 on this. Watching for @index to be supported in the visual editor. Its confusing to be encouraged to use relationship directives like @has_one but then to also be denied the visual editor after adding it

ashrocket avatar Feb 18 '23 19:02 ashrocket

I am having this issue

When I wrote : type Mutation { createPaymentIntent(amount: Float!): PaymentIntent! @function(name: "CreatePaymentIntent-${env}") }

type PaymentIntent { clientSecret: String! }

In my schema.graphQL file and then run amplify push . My visual studio just block and I am unable to use that. Please Help! Screenshot (333)

Rushabhsinora avatar Mar 15 '23 04:03 Rushabhsinora

This is kind of frustrating because we’ve now been using Amplify Studio on a few different data models. On each one, we start using visual editor but then so quickly have one directive or another (usually @function or @index) that we have to go back to just editing the text file outside of studio. We love the visual editor but until it supports the directives it’s just not very useful.

neilhunt1 avatar Mar 15 '23 17:03 neilhunt1

This is absolutely awful. I would expect that if you create a model using the Visual Editor to be able to continue editing it with the Visual Editor.

Consider this user flow: Creates model with Visual Editor -> Adds relationship with Visual Editor -> Deploys models with Visual Editor -> Visual Editor is now disabled due to having relationships in the model.

You have created a horrible user experience intentionally and damaged their opinions of Amplify as a product.

cash-cash avatar May 05 '23 01:05 cash-cash

The visual editor is very fragile here - I edited a data model in the UI, copied the schema out but didn't save in the UI because it keeps failing to deploy, ran an amplify pull to get latest, updated the local schema with the copied schema, pushed successfully, then Studio UI complains about the @index directive. When can we expect a fix for this please?

DougalW avatar Aug 18 '23 02:08 DougalW

The visual editor is very fragile here - I edited a data model in the UI, copied the schema out but didn't save in the UI because it keeps failing to deploy, ran an amplify pull to get latest, updated the local schema with the copied schema, pushed successfully, then Studio UI complains about the @Index directive. When can we expect a fix for this please?

Having the same problem :(

bariqnet avatar Aug 21 '23 08:08 bariqnet

Update on this issue - I reproduced the issue by changing a 1:n relationship to m:n. The UI successfully showed the change and so I copied the schema from the UI tab, edited my local copy, then deployed the change from the amplify cli with a --force directive. The new version complied successfully and deployment showed as successful. Once I opened the UI it complained about @index again. I then parsed through the schema.graphql file, checking all directives matched correctly and found that there was one orphaned @index directive corresponding to the old 1:n relationship. So it seems this bug is caused by the UI incorrectly parsing and accounting for the change in cardinality relationships i.e. when I changed 1:n to m:n AmplifyUI created the new relationship and didn't remove the old one.

DougalW avatar Aug 21 '23 10:08 DougalW

Would be great if Amplify Studio would not disable itself entirely if an unsupported type (e.g. Mutation) is used... Of course, best would be if it would support it...

p24-max avatar Sep 26 '23 05:09 p24-max