parrot icon indicating copy to clipboard operation
parrot copied to clipboard

Add Partial Success (Data & Error) to graphql response

Open PageTMcEneaney opened this issue 1 year ago • 2 comments

Similar to https://github.com/americanexpress/parrot/issues/100 we'd like to add an enhancement to Parrot responses.

At the moment, there is no option to add both data and error objects outside of the body. We'd like to add to support partial success graphql responses. See example. I want to make sure this is compatible with the parrot-friendly formatting of the scenarios so I think we should update the scenarios file to use or add a second example app

{
  "data": {
    "getInt": 12,
    "getString": null
  },
  "errors": [
    {
      "message": "Failed to get string!"
      // ...additional fields...
    }
  ]
}

Here is my WIP forked repo & branch

Note: to test this locally I needed to link parrot-friendly to the local version with “parrot-friendly”: “file:../../packages/parrot-friendly”,, if the parrot-friendly changes need to be approved & merged first I can remove the friendly-pirate-app changes and include those in a separate followup PR

PageTMcEneaney avatar May 31 '23 23:05 PageTMcEneaney

Thanks for opening your first issue. Pull requests are always welcome!

github-actions[bot] avatar May 31 '23 23:05 github-actions[bot]

The main changes are in packages/parrot-friendly/src/Mock.js & the test file. The other changes are adding a second example app friendly-pirate-app which is optional but seemed cleaner than overwriting the original scenario syntax

PageTMcEneaney avatar May 31 '23 23:05 PageTMcEneaney