Amplify-cli: File name pattern for graphql query generation ignored.

Created on 21 Feb 2019  路  11Comments  路  Source: aws-amplify/amplify-cli

Describe the bug

GraphQL compiled files never placed into the directory stated in amplify step by step procedure.

To Reproduce

When I run

amplify api add

Then select GraphQL, create a schema, and finish generating my Schema...

I run,

amplify push

Then it asks if I want to generate the code for the GraphQL API... I say YES.
Chooses my code generation language. ... I say javascript.
Enter the file name pattern of graphql queries, mutations, and subscriptions (src/graphql/*/.js)

I change this to app/graphql/*/.js ... because that's where my code is positioned in my boilerplate.

Amplify ignores this and places it in src/graphql/*/.js outside of my project.

Expected behavior

I expect graphql/* to be placed in app/ not src/

code-gen enhancement

Most helpful comment

I updated .graphqlconfig.yml file with new schemaPath and included paths with new path and it seems mutations.js, queries.js, and subscriptions.js gets pushed to the new path defined in config but the schema.json appears in the default /src/graphql. After pushing, the .graphqlconfig.yml gets rewritten with the old(default) schemaPath: src/graphql/schema.json

I'm using @aws-amplify/[email protected] on MacOS.

All 11 comments

@michaelcuneo could you please clarify the following

  1. How did you change src/graphql/**/*.js to app/graphql/**/*.js
  2. Did you run amplify codegen once again after updating the location?

I changed it during initial creation of the API

Thanks for the assistance.

@michaelcuneo we have the location hard coded when you add/push a new AppSync API. I am going to pick up this a couple of weeks, but you could change the location where the statements gets stored by changing docsFilePath in <project-root>/.graphqlconfig.yml

I updated .graphqlconfig.yml file with new schemaPath and included paths with new path and it seems mutations.js, queries.js, and subscriptions.js gets pushed to the new path defined in config but the schema.json appears in the default /src/graphql. After pushing, the .graphqlconfig.yml gets rewritten with the old(default) schemaPath: src/graphql/schema.json

I'm using @aws-amplify/[email protected] on MacOS.

I've seen this happen quite a bit now & is kind of misleading. Regardless of the file path given when the API is created or updated, it always builds in src/

This is def a problem. would be nice to fix

@cocacrave I have the opposite problem: .graphqlconfig.yml obeys schemaPath, but no matter what i put in includes, it pushes mutations.js, queriers.js and subscriptions.js to src/graphql

I'm using amplify --version 1.6.8 on Ubuntu

Just saw @yuth 's comment -- docsFilePath works!

Still would like this to automatically come from the cli interface though (ideally inherit from the amplify init), rather than having to go back and edit .graphqlconfig.yml

VERY annoying. amp push keeps resetting the schemaPath back to src/graphql/schema.json

docsFilePath is already set to the alternative directory. Amplify push still resets schemaPath.

I have the same issue amplify push overwriting the path to schema.json and setting back to src/graphql/schema.json, is it by design?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ReidWeb picture ReidWeb  路  3Comments

amlcodes picture amlcodes  路  3Comments

mwarger picture mwarger  路  3Comments

MageMasher picture MageMasher  路  3Comments

nicksmithr picture nicksmithr  路  3Comments