INNER CODE UNIT · Python
convert_path_to_document
gsmith257-cyber/GraphCrawler · clairvoyance/graphql.py:139
def convert_path_to_document(self, path: List[str]) -> str:
logging.debug(f"Entered convert_path_to_document({path})")
doc = "FUZZ"
while len(path) > 1:
doc = f"{path.pop()} {{ {doc} }}"
if path[0] == self._schema["queryType"]["name"]:
doc = f"query {{ {doc} }}"
elif path[0] == self._schema["mutationType"]["name"]:
doc = f"mutation {{ {doc} }}"
elif path[0] == self._schema["subscriptionType"]["name"]:
doc = f"subscription {{ {doc} }}"
else:
raise Exception("Unknown operation type")
return doc