Amplify-cli: amplify codgen keeps changing schema.json even though nothing has changed

Created on 25 Sep 2018  路  4Comments  路  Source: aws-amplify/amplify-cli

Describe the bug
Running amplify codegen repeatedly with no actual changes in AppSync UI makes schema.json constantly change.

To Reproduce
Run amplify codegen multiple times without changing anything in the appsync console.

Expected behavior
If there is no change in graphql schema / resolvers then there should be no change in local schema.json or anything else.

Screenshots

Screenshots of the diffs of schema.json after each amplify codegen.

dry-eye-frontend vim git difftool 235x73 2018-09-25 09-16-31
dry-eye-frontend vim git difftool 235x73 2018-09-25 09-17-09
dry-eye-frontend vim git difftool 235x73 2018-09-25 09-19-24

Desktop (please complete the following information):

  • OS: OSX

Additional context
It seems it's just flipping stuff back and forth. If src/graphql/schema.json is expected to be commit in git then this is annoying.

dependency-issue enhancement

Most helpful comment

Internally, there could be a step to sort the JSON keys like https://github.com/substack/json-stable-stringify so that each run would create a consistently ordered schema.

All 4 comments

@hisham We download the schema from the AppSync service each time you run the codegen command and since the schema is a JSON object, there isn't a way to order it. What you could do is that you could use the -nodownload flag along with the codegen command which won't download the new schema.json file each time you run a codegen command.

I see. Ok thanks for the info. I'll try that.

Internally, there could be a step to sort the JSON keys like https://github.com/substack/json-stable-stringify so that each run would create a consistently ordered schema.

@hisham I beleve this issue if fixed. Please let me know if you still see this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davo301 picture davo301  路  3Comments

ReidWeb picture ReidWeb  路  3Comments

zjullion picture zjullion  路  3Comments

rehos picture rehos  路  3Comments

adriatikgashi picture adriatikgashi  路  3Comments