INNER CODE UNIT · Python
to_json
gsmith257-cyber/GraphCrawler · clairvoyance/graphql.py:93
def to_json(self):
schema = {"data": {"__schema": self._schema}}
for t in self.types.values():
schema["data"]["__schema"]["types"].append(t.to_json())
output = json.dumps(schema, indent=4, sort_keys=True)
return output
def get_path_from_root(self, name: str) -> List[str]:
logging.debug(f"Entered get_path_from_root({name})")
path_from_root = []
if name not in self.types:
raise Exception(f"Type '{name}' not in schema!")
roots = [
self._schema["queryType"]["name"] if self._schema["queryType"] else "",