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

[graphiql] GraphiQL Explorer Plugin generates incorrect order_by syntax #3857

Open
1 task done
Varun-Choudhary opened this issue Jan 23, 2025 · 0 comments
Open
1 task done

Comments

@Varun-Choudhary
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The GraphiQL Explorer plugin is generating incorrect syntax for order_by arguments. When using the Explorer UI to add ordering fields, it generates an object syntax instead of the required array of objects syntax.

When using the Explorer to add ordering fields, it generates queries like this:

query MyQuery {
  billing(
    order_by: {billingDate: Asc, billingId: Asc, customerId: Asc, paymentStatus: Asc}
  ) {
    billingId
    billingDate
  }
}

It throws an error -

  "data": null,
  "errors": [
    {
      "message": "order_by expects a list of input objects with exactly one key-value pair per input object. Please split the input object with multiple key-value pairs into a list of single key-value pair objects."
    }
  ]
}

Expected Behavior

The query should be generated with an array of objects syntax like this:

  billing(
    order_by: [{billingDate: Asc}, {billingId: Asc}, {customerId: Asc}, {paymentStatus: Asc}]
  ) {
    billingId
    billingDate
  }
}

Steps To Reproduce

  1. Open GraphiQL Explorer
  2. Select a query field that supports ordering
  3. Add multiple order_by fields through the Explorer UI
  4. Observe the generated query syntax

Environment

  • GraphiQL Version: 3.2.0
  • graphiql/plugin-explorer: 2.0..0
  • OS:
  • Browser:
  • Bundler:
  • react Version: 0.21.0
  • graphql Version:

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant