how to put variable into a string as a prefix of function in Graphql?

0

As title, we have a graphql file in amplify, and we have a need to put a variable at the start of lambda function name. e.g. type Query { grantDeviceToken(macs: [String!]!): GrantTokenResponse @function(name: "${site}-appsyncGrantDeviceToken-${env}") } As this example, is it possible to make ${site} as a variable and how do I setup the variable value?

thankshow to put variable into a string as a prefix of function in Graphql? As title, we have a graphql file in amplify, and we have a need to put a variable at the start of lambda function name. e.g.

type Query { grantDeviceToken(macs: [String!]!): GrantTokenResponse @function(name: "{site}-appsyncGrantDeviceToken-${env}") }

As this example, is it possible to make ${site} as a variable and how do I setup the variable value?

thanks

已提問 2 年前檢視次數 213 次
1 個回答
1

Hello, I understand that you would like to set lambda resolver name dynamically using a variable(“site”). Please note that according to the documentation the @function directive allows you to use ${env} to reference the current Amplify CLI environment.

However, I could not see any resources/documentation discussing an out of box approach to create variables which could be accessed in the GraphQL schema as mentioned by you. Having said that, please feel free to raise a feature request with the Amplify service team via the GitHub.

In case I misunderstood the query, please feel free to reach out to us via creating a support case from the support centre dashboard and elaborate your usecase in detail.

AWS
支援工程師
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南