Open joedevgee opened 2 years ago
I'd like to bump this. As the current multi-env suggestion or even mono-repo structure does not seem to be working on latest CLI.
suing aws to pull the schema.json is a valid solution, however, even after doing so, it still says it requires a backend file to generate the types and statements for me.
Hey @joedevgee and @BryceAMcDaniel :wave: are you seeing a case where running amplify pull
and choosing not to modify the backend is generating the models in src/models
? Similar to how amplify codegen models
behaves?
To the second point, as you both have noted we will be required to download the schema before running amplify codegen types/statements
. For that I will mark this as a feature request 🙂
Hi @josefaidt,
I am not seeing a case where a simple pull command generates models. The only item in src
for me is aws-exports.js
as I expect.
After trying different methods, I was able to get what I needed and my steps are listed below.
amplify pull
choosing not to modify backend.aws appsync get-introspection-schema --api-id=**** --format=JSON ./schema.json
amplify add codegen
My confusion came from needing to amplify add codegen
.
However, I still feel as if introspection should occur without the need for step 2 (aws appsync get-introspection) as this would always ensure schema is uptodate with each codegen.
Hey @BryceAMcDaniel thank you for that clarification! I was also seeing that, and amplify codegen models
will run off the annotated schema file rather than the built schema or introspection file.
However, I still feel as if introspection should occur without the need for step 2 (aws appsync get-introspection) as this would always ensure schema is uptodate with each codegen.
I agree with you, it would be a better experience if we are not required to first download something using another CLI and instead the file came along with the choice to not modify the backend.
Page:
/cli/teams/multi-frontend
Feedback:
Running
amplify pull
does not generate graphql typesBackground: My amplify backend and my frontend(react native) lives under two different repos
In my frontend repo, I chose not to modify backend in
amplify pull
. The command will generate a models folder in my src, which includes typescript types from the published graphql models. However, the command will skip generating all the graphql queries/mutations types.I can always manually download schema.json and do a codegen but that seems unnecessary. What is the recommended approach when we have multiple frontends and the cli won't generate graphql types