Amplify-cli: Mock Api: add route '/resetFakeData' to cleanup mock data

Created on 3 Oct 2020  路  5Comments  路  Source: aws-amplify/amplify-cli

Is your feature request related to a problem? Please describe.
Small issue: when I need to reset the mock data via command line (rm ./amplify/mock-data/dynamodb/fake_us-fake-1.db) I then need to manually restart the mock API server, which is a bit boring.

Describe the solution you'd like
add to the mock API a route '/resetFakeData' (or anything else) which will remove the fake data without having to restart the server.

enhancement mock

Most helpful comment

@anisg would you rather have a command that resets the mock Api server?

All 5 comments

@anisg would you rather have a command that resets the mock Api server?

@ammarkarachi yes that would work too.

another thing that would make sense too is to add a button "Reset Data" in the GraphiQL Explorer.

In the user's perspective, the most intuitive way is to simply tab on a Reset button in GraphiQL.

A Reset Table button that resets/recreates the DynamoDB table might be more helpful than a Reset Data button. I run into a problem with simply resetting the data after changing the content field type from String to Int and it keeps throwing ValidationException error until I reset the table.

 type Object @model {
    id: ID!
    content: String!  #Throws ValidationException errors if changes to Int! after table has been created
}

It would also be helpful to move the ADD NEW row to the top left instead of being at bottom left on the Explorer panel. Considered all the buttons are at top, it is a bit counterproductive to ADD NEW row at the bottom and click run on top. It is a simple fix in code, which is just swapping the two divs block and a line of CSS to fix the border.
GraphiQL

Was this page helpful?
0 / 5 - 0 ratings