From d1ea7c00550e6d6568096e6cc415c909bb0358b1 Mon Sep 17 00:00:00 2001 From: Alex Rothberg Date: Sun, 5 May 2024 18:55:00 -0400 Subject: [PATCH] Support nullable List of nullables. --- graphqldb/adapter.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/graphqldb/adapter.py b/graphqldb/adapter.py index 7004963..4f4f885 100644 --- a/graphqldb/adapter.py +++ b/graphqldb/adapter.py @@ -415,17 +415,24 @@ def __init__( list_type = cast(TypeInfo, list_type) item_container_type = list_type["ofType"] - if item_container_type is None: + item_container_name = list_type["name"] + if item_container_type is not None: + # TODO(cancan101): put this info into type system + item_container_type = cast(TypeInfo, item_container_type) + elif item_container_name is not None: + item_container_type = list_type + else: raise ValueError("Unable to resolve item_container_type") - # TODO(cancan101): put this info into type system - item_container_type = cast(TypeInfo, item_container_type) - node_type = item_container_type["ofType"] - if node_type is None: + node_name = item_container_type["name"] + if node_type is not None: + node_type_name = node_type["name"] + elif node_name is not None: + node_type_name = node_name + else: raise ValueError("Unable to resolve node_type") - node_type_name = node_type["name"] if node_type_name is None: raise ValueError("Unable to resolve node_type_name")