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

@resolve produces incorrect query in fusion graph when the field name differs from the query name #6579

Closed
1 task done
ktrauberman opened this issue Oct 6, 2023 · 3 comments

Comments

@ktrauberman
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Product

Hot Chocolate

Describe the bug

I have a subgraph "A" that has a query widgetById(widgetId: ID!): Widget! and another subgraph "B" that has a type with a widgetId field type Thing { widgetId: ID! }. I want to extend this type with a field widgetName that is resolved from the Widget.name field.

I added this to schema.extensions.graphql in subgraph "A"

extend type Thing
{
    widgetName(widgetId: ID! @require(field: "widgetId")): String @resolve(select: "widgetById(widgetId: $widgetId) { name }")
}

which produces this in the fusion graph:

  widgetName: String
    @source(subgraph: "SubgraphA")
    @variable(subgraph: "SubgraphB", name: "Thing_widgetId", select: "widgetId")
    @resolver(subgraph: "SubgraphA", select: "{ widgetName(widgetId: $Thing_widgetId) }", arguments: [ { name: "Thing_widgetId", type: "ID!" } ])

and when I try to query that field, I get an error:

    {
      "message": "The field `widgetName` does not exist on the type `Query`.",
      "locations": [
        {
          "line": 1,
          "column": 46
        }
      ],
      "extensions": {
        "type": "Query",
        "field": "widgetName",
        "responseName": "widgetName",
        "specifiedBy": "http://spec.graphql.org/October2021/#sec-Field-Selections-on-Objects-Interfaces-and-Unions-Types"
      }
    }

I would expect the fusion graph to produce the query that I'm passing into the @resolve directive.

Steps to reproduce

Relevant log output

No response

Additional Context?

No response

Version

13.6.0-preview.23

@michaelstaib
Copy link
Member

resolve is not yet supported..... so no bug here.

@ktrauberman
Copy link
Author

resolve is not yet supported..... so no bug here.

Alright. What is the proper way to do what I'm attempting then? There's no documentation for fusion so I'm fumbling around in the dark here.

@ktrauberman
Copy link
Author

Will this PR add the proper features to do what I'm trying to do here?

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

No branches or pull requests

2 participants