Skip to content

[v1] Undesired output from PR #4419 #4460

@cwlim

Description

@cwlim

Issue workflow progress

Progress of the issue based on the Contributor Workflow

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:

  1. 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
  1. run npm run build
  2. inspect .mesh/schema.graphql

Expected behavior

  1. The value of operationHeaders including accept header should be retained and set as header when invoking underlying API.
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions