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

Generated dart client doesn't contain custom query/mutation

Open nam-truong-le opened this issue 1 year ago • 0 comments

Describe the feature you'd like to request

Custom queries and mutations should be generated.

Describe the solution you'd like

Custom queries and mutations should be generated.

Describe alternatives you've considered

N/A

Additional context

Currently, according to the doc we have to manually construct the query and parse the response like this:


const graphQLDocument = '''
  query Echo(\$content: String!) {
    echo(content: \$content) {
      content
      executionDuration
    }
  }
''';


final echoRequest = GraphQLRequest<String>(
  document: graphQLDocument,
  variables: <String, String>{"content": "Hello world!!!"},
);


final response =
    await Amplify.API.query(request: echoRequest).response;
safePrint(response);


Map<String, dynamic> jsonMap = json.decode(response.data!);
EchoResponse echoResponse = EchoResponse.fromJson(jsonMap);
safePrint(echoResponse.echo.content);

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

  • [ ] 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • [ ] ⚠️ This feature might incur a breaking change

nam-truong-le avatar Oct 27 '24 07:10 nam-truong-le