Open
Description
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generate
in the terminal.Please make sure Mesh package versions under
package.json
matches yours.
- 2. A failing test has been provided
- 3. A local solution has been provided
- 4. A pull request is pending review
Describe the bug
When defining responseByStatusCode
with schema for 404 responses, it misses it and throw.
To Reproduce
Steps to reproduce the behavior:
Set config
responseByStatusCode:
200:
responseSchema: ./src/schemas.json#/definitions/goodResponse
400:
responseSchema: ./src/schemas.json#/definitions/errorResponse
404:
responseSchema: ./src/schemas.json#/definitions/errorResponse
200 and 400 works fine, 404 throws error:
GraphQLError: HTTP Error: 404, Could not invoke operation GET /api/
at Object.createGraphQLError (./node_modules/@graphql-tools/utils/cjs/errors.js:9:12)
at field.resolve (./@omnigraph/json-schema/index.js:664:40)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async promiseForObject (./node_modules/@graphql-tools/executor/cjs/execution/promiseForObject.js:14:28)
at async ./node_modules/@graphql-tools/batch-execute/cjs/createBatchingExecutor.js:44:36
at async Promise.all (index 0)
at async DataLoader.batchExecuteLoadFn [as _batchLoadFn] (./node_modules/@graphql-tools/batch-execute/cjs/createBatchingExecutor.js:42:25) {
path: [ 'getExpense' ],
locations: undefined,
extensions: {
http: { status: 404, statusText: 'Not Found', headers: {} },
request: {
url: 'https://api',
method: 'GET'
},
responseJson: { errorCode: 404, errorMessage: 'error message' }
}
}
Expected behavior
To recognize this response :)