Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string parameters excluded with explode: true #4677

Closed
4 tasks
mhassan1 opened this issue Oct 13, 2022 · 0 comments · Fixed by #4678
Closed
4 tasks

string parameters excluded with explode: true #4677

mhassan1 opened this issue Oct 13, 2022 · 0 comments · Fixed by #4678

Comments

@mhassan1
Copy link
Contributor

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

The following OpenAPI spec fails to include the expected explodedString query string parameter:

parameters:
  - name: explodedString
    in: query
    explode: true
    schema:
      type: string

The issue is related to the combination of explode: true and type: string.

To Reproduce
Steps to reproduce the behavior:

# .meshrc.yml
sources:
  - name: PetStore
    handler:
      openapi:
        baseUrl: https://petstore3.swagger.io/api/v3
        source: https://petstore3.swagger.io/api/v3/openapi.json

Execute this query:

{
  findPetsByStatus(status: available) {
    id
  }
}

See an error response:

{
  "data": {
    "findPetsByStatus": null
  },
  "errors": [
    {
      "message": "Unexpected response",
      "path": [
        "findPetsByStatus"
      ],
      "extensions": {
        "url": "https://petstore3.swagger.io/api/v3/pet/findByStatus?",
        "method": "GET",
        "responseText": "No status provided. Try again?",
        "error": {
          "name": "SyntaxError",
          "message": "Unexpected 'N'",
          "at": 1,
          "text": "No status provided. Try again?"
        }
      }
    }
  ]
}

Notice "url": "https://petstore3.swagger.io/api/v3/pet/findByStatus?" is missing the status=available query string parameter.

If I change explode: true in the PetStore spec to explode: false, the issue no longer reproduces.

Expected behavior

{
  "data": {
    "findPetsByStatus": [
      { "id": 1 }
    ]
  }
}

Environment:

  • OS: MacOS
  • @graphql-mesh/openapi: ^0.33.26
  • NodeJS: 16.17.1

Additional context

  • It seems like explode: true with strings doesn't make much sense, but it also seems like a case we should support
  • I believe this is a regression introduced by Update openapi tests #4369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant