Graphql-tools: cacheControl hints only propagated on root fields when using schema stitching

Created on 26 Nov 2017  Â·  6Comments  Â·  Source: ardatan/graphql-tools

Using makeExecutableSchema shows cacheControl hints on all fields, using mergeSchemas only shows cacheControl hints on root fields:
https://launchpad.graphql.com/r9lmrp989n correctly shows (with cacheControl enabled):

"cacheControl": {
      "version": 1,
      "hints": [
        {
          "path": [
            "myTest"
          ],
          "maxAge": 120
        },
        {
          "path": [
            "myTest",
            0,
            "title"
          ],
          "maxAge": 60
        },
        {
          "path": [
            "myTest",
            0,
            "description"
          ],
          "scope": "PRIVATE"
        }
      ]
    }

Now using mergeSchemas instead of makeExecutableSchema gives:

"cacheControl": {
      "version": 1,
      "hints": [
        {
          "path": [
            "myTest"
          ],
          "maxAge": 0
        }
      ]
    }
enhancement schema stitching

Most helpful comment

I just tested locally on v2.17.0 and the cache hints were propagated appropriately.

All 6 comments

@stubailo I am interesting in helping contribute to this. I saw a lot of issues that are similar to this (a combo of directives + stitching), and I am wondering if there is any active work being done?

Do we already know where the gaps exist? Thanks! 😄

I think I solved the reason causing this issue in PR #569. Can you confirm that recreating astNode property solves your issue?

@BassT I'll test it using your PR and report back.

I just tested locally on v2.17.0 and the cache hints were propagated appropriately.

I realized that in v2.17.0 cache hints are only working for GraphQL types. I submitted PR #580, which also makes cache hints work for fields (and therefore queries).

Going to work on passing through dynamic cache hints as well as part of #890

@mfix22 if you're still interested let's talk soon!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tonyxiao picture tonyxiao  Â·  4Comments

alfaproject picture alfaproject  Â·  4Comments

Adherentman picture Adherentman  Â·  4Comments

confuser picture confuser  Â·  4Comments

udisun picture udisun  Â·  3Comments