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/
@michaelcuneo could you please clarify the following
src/graphql/**/*.js to app/graphql/**/*.jsamplify 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?
Most helpful comment
I updated
.graphqlconfig.ymlfile with newschemaPathandincludedpaths with new path and it seemsmutations.js,queries.js, andsubscriptions.jsgets pushed to the new path defined in config but theschema.jsonappears in the default/src/graphql. After pushing, the.graphqlconfig.ymlgets rewritten with the old(default)schemaPath: src/graphql/schema.jsonI'm using
@aws-amplify/[email protected]on MacOS.