Created
August 7, 2019 11:04
-
-
Save gregxsunday/888d67f6e6e2f29bbe92cd811435c72d to your computer and use it in GitHub Desktop.
Revisions
-
gregxsunday created this gist
Aug 7, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ schema = r.json() print("============= [SCHEMA] ===============") print("e.g: \033[92mname\033[0m[\033[94mType\033[0m]: arg (\033[93mType\033[0m!)\n") for types in schema['data']['__schema']['types']: if types['kind'] == "OBJECT": print(types['name']) if not "__" in types['name']: for fields in types['fields']: field_type = "" try: field_type = fields['type']['ofType']['name'] except Exception as e : pass print("\t\033[92m{}\033[0m[\033[94m{}\033[0m]: ".format(fields['name'], field_type), end='') for args in fields['args']: args_name = args.get('name') args_tkind = "" args_ttype = "" try: args_tkind = args['type']['kind'] except: pass try: args_ttype = args['type']['ofType']['name'] except Exception as e: pass print("{} (\033[93m{}\033[0m!), ".format(args_name, args_ttype), end='') print("")