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
#4408 Request to allow setting Accept in operationHeader
#4419 Allow user to set Accept header from schema.
The fix introduces a side effect which generates schema with JSON types if accept header is set. The desire outcome is to allow accept
header in operationHeader as such "application/json;v=2" without impacting the generated schema.graphql. It is the convention in the company to invoke the right version of the API.
Here is an article about using Accept header to indicate version of the web API: https://dotnettutorials.net/lesson/web-api-versioning-using-accept-header.
To Reproduce
Steps to reproduce the behavior:
- Using examples/openapi-orbit:
sources:
- name: Orbit
handler:
openapi:
source: https://app.orbit.love/api-docs/v1/swagger.json
operationHeaders:
accept: application/json;v=2
- run
npm run build
- inspect .mesh/schema.graphql
Expected behavior
- The value of operationHeaders including accept header should be retained and set as header when invoking underlying API.
- The generated schema should not have JSON type for all fields when Accept header is set as application/json;v=33.
Environment:
- OS: MacOS Monterey
"@graphql-mesh/cli": "^0.78.2"
"@graphql-mesh/openapi": "^0.33.7"
"@graphql": "^16.6.0"
- NodeJS: 16.30.0
Additional context