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

handle nested object in sourceArgs map #5730

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

EmrysMyrddin
Copy link
Collaborator

@EmrysMyrddin EmrysMyrddin commented Jul 25, 2023

Description

Allows to use nested objects in the sourceArgs argument of additionalResolvers or @resolveTo directive.

Fixes #5729

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Tested using the example getting started repo.

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

@changeset-bot
Copy link

changeset-bot bot commented Jul 25, 2023

🦋 Changeset detected

Latest commit: 7f79610

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

This PR includes changesets to release 1 package
Name Type
@graphql-mesh/utils 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

@github-actions
Copy link
Contributor

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-mesh/apollo-link 0.95.4-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-cfw-kv 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-file 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-localforage 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/cache-redis 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/cli 0.85.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/config 0.96.5-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/graphql 0.94.7-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/grpc 0.94.10-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/json-schema 0.94.9-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/mongoose 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/mysql 0.94.7-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/neo4j 0.94.10-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/odata 0.94.7-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/openapi 0.94.10-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/postgraphile 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/raml 0.94.9-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/soap 0.94.9-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/thrift 0.94.7-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/tuql 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/http 0.95.4-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/jit-executor 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
json-machete 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@omnigraph/json-schema 0.94.9-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@omnigraph/openapi 0.94.10-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@omnigraph/raml 0.94.9-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@omnigraph/soap 0.94.9-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-bare 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-federation 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/merger-stitching 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-deduplicate-request 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-hive 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http-cache 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http-details-extensions 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-http2 0.94.8-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-live-query 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-mock 0.94.7-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-newrelic 0.94.8-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-operation-field-permissions 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-prometheus 0.94.8-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-rate-limit 0.94.7-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-response-cache 0.94.8-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-serialize-headers 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-snapshot 0.94.7-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-statsd 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/runtime 0.95.4-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/store 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-cache 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-encapsulate 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-extend 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-federation 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-filter-schema 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-hive 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-hoist-field 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-naming-convention 0.94.7-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-prefix 0.94.7-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-prune 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-rate-limit 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-rename 0.94.7-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-replace-field 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-resolvers-composition 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-transfer-schema 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/transform-type-merging 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/types 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/urql-exchange 0.95.4-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎
@graphql-mesh/utils 0.94.6-alpha-20230725135900-7f7961089 npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Contributor

💻 Website Preview

The latest changes are available as preview in: https://4c4cafdf.graphql-mesh.pages.dev

@EmrysMyrddin EmrysMyrddin requested a review from ardatan July 25, 2023 14:15
@@ -321,148 +319,18 @@ export function resolveAdditionalResolvers(

return resolvers;
} else {
const baseOptions: any = {};
Copy link
Owner

Choose a reason for hiding this comment

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

Why do we remove this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The code seems to be duplicated (I have checked with a diff tool to be sure 😛) so I have replaced the duplication by a function call. I can revert if you think it is relevant to have a duplication here.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh ok ok :D

@ardatan ardatan merged commit d1310cd into master Jul 25, 2023
@EmrysMyrddin EmrysMyrddin deleted the fix/5729-resolve-to-directive-nested-args branch July 26, 2023 10:27
@Urigo
Copy link
Collaborator

Urigo commented Jul 27, 2023

should there be a test added that covers that bug?

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.

@resolveTo directive can't handle nested object in sourceArgs
3 participants