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

Fixes #2911: Nested query parameters shouldn't cause errors. #3635

Merged
merged 3 commits into from
Aug 3, 2022
Merged

Fixes #2911: Nested query parameters shouldn't cause errors. #3635

merged 3 commits into from
Aug 3, 2022

Conversation

JasonKong-Quantium
Copy link
Contributor

@JasonKong-Quantium JasonKong-Quantium commented Feb 23, 2022

Description

This closes #2911: When translating from OpenAPI calls to GraphQL, nested query objects aren't correctly set - it will only accept primitive objects, which is especially problematic when you don't control the underlying OpenAPI specification. (e.g. using a third party service).

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Screenshots/Sandbox (if appropriate/relevant):

N/A

How Has This Been Tested?

  • A new test (nested_objects.test.ts) has been added that breaks without the associated changes in the OpenAPI resolver_builder.ts

Test Environment:

  • OS: Windows 10 running VSCode dev container: mcr.microsoft.com/vscode/devcontainers/javascript-node:0-16-bullseye
  • @graphql-mesh/...:
  • NodeJS: 16

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests and linter rules pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

N/A

@changeset-bot
Copy link

changeset-bot bot commented Feb 23, 2022

🦋 Changeset detected

Latest commit: c322e84

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@graphql-mesh/openapi Patch
@graphql-mesh/container Patch
javascript-wiki Patch
typescript-location-weather-example Patch
openapi-stackexchange Patch
openapi-stripe Patch
openapi-subscriptions Patch
openapi-youtrack Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Feb 23, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/theguild/graphql-mesh/7XgP2wcF8LDdZdqizhNiRJ4j3zFj
✅ Preview: https://graphql-mesh-git-fork-jasonkong-quantium-fix-ne-974375-theguild.vercel.app

urlObject.searchParams.set(paramName, val);
}
}
urlObject.search = qs.stringify(query);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overwrites existing values

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe?

Suggested change
urlObject.search = qs.stringify(query);
Object.assign(urlObject.search, qs.stringify(query));

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

search is not an object, it is a string.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof, right!

@vercel
Copy link

vercel bot commented Aug 3, 2022

@ardatan is attempting to deploy a commit to the The Guild Team on Vercel.

A member of the Team first needs to authorize it.

@ardatan ardatan merged commit 42e19c5 into ardatan:master Aug 3, 2022
@Urigo Urigo mentioned this pull request Aug 11, 2022
55 tasks
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 this pull request may close these issues.

Cannot convert object to primitive value
3 participants