Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

How do I _force_ a field to be returned  #604

@jruts

Description

@jruts

Hi,

I am currently experimenting with this library but I ran into an issue/question that I need some help with to get a better understanding.

I want to present the question with a simple example.

Here is a graphql query snippet that is connected to a neo4j database

{
  Product{
     name
   }
}

It's fairly simple, get me all names of the products in neo4j with the Product label, and that works.

Here is where it gets tricky

{
  Product{
    name
    description
  }
}

The description is something I need to fetch from another source, so I am writing a custom resolver for that, which is not an issue. The issue is that it depends on the product_no field of the product in neo4j.
I can easily just add this field into the query and receive it, and it will be available in the resolver to get the description from the other source.

The question here is: is there a way to always get certain query fields back even without specifying them into the query?
In this case I always want the product_no to be returned in the resolver, even if I don't want to return it to the person who is not querying for it.

I hope that made some sense and thank you for reading through it!

Activity

michaeldgraham

michaeldgraham commented on May 2, 2021

@michaeldgraham
Collaborator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      How do I _force_ a field to be returned · Issue #604 · neo4j-graphql/neo4j-graphql-js