From f44116c169029b136b6dece9da441fc6861b6235 Mon Sep 17 00:00:00 2001 From: Christian Kurz Date: Mon, 2 Aug 2021 15:21:47 +0200 Subject: [PATCH] include union content in type map --- graphql/schema.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/graphql/schema.lua b/graphql/schema.lua index a03093e..38ec3aa 100644 --- a/graphql/schema.lua +++ b/graphql/schema.lua @@ -50,6 +50,12 @@ function schema:generateTypeMap(node) node.fields = type(node.fields) == 'function' and node.fields() or node.fields self.typeMap[node.name] = node + if node.__type == 'Union' and node.types then + for _, type in ipairs(node.types) do + self:generateTypeMap(type) + end + end + if node.__type == 'Object' and node.interfaces then for _, interface in ipairs(node.interfaces) do self:generateTypeMap(interface) @@ -120,3 +126,4 @@ function schema:getPossibleTypes(abstractType) end return schema +