Open paras-jindal opened 2 years ago
hi @paras-jindal, you need to provide the full backtrace and if possible a way to reproduce it, otherwise I'm clueless.
also share your setup, in particular the versions, including graphql-core.
i am so sorry for the inconvinience , i should have quoted my error along with these things okay so.. graphql-core version ==3.1.6 sgqlc version ==15.0 so i used the terminal command
user@host$ python3 -m sgqlc.introspection \ --exclude-deprecated \ --exclude-description \ -H "Authorization: bearer ${GH_TOKEN}" \ https://api.github.com/graphql \ github_schema.json user@host$ sgqlc-codegen schema github_schema.json github_schema.py
to generate the mentioned files and it worked perfectly fine, then i generated a schema.gql file and tried to create operations.py file but its throwing error
for kind, name, code in visit(gql, visitor):
TypeError: cannot unpack non-iterable DirectiveDefinitionNode object
i tried to change verison,but still not working
could you try to run https://github.com/profusion/sgqlc/tree/master/examples/github?
./update-schema.sh
./update-operations.sh
I just tested with Git and it works properly (it will download an updated github_schema.json/py, but other than that the script works as expected. Worth checking with recent git (instead of 15.0), there are some fixes... I just checked and they shouldn't impact, but maybe that's the case.
hey, i am new to all these the coding stuff , can you please elaborate step by step what i need to try in the above mentioned instructions
plus now i am trying it again then its throwing a different error
'GraphQLToPython' object has no attribute 'enter_leave_map' I already updated the sgqlc as well as graphql-core packages but no luck
Just clone this repository, then cd examples/github
and execute both scripts. They should work.
If they don't, then go to the repository root folder and execute pipenv install --dev
, then pipenv shell
. If you don't have pipenv, take a look at https://pipenv.pypa.io/en/latest/. Once you're inside pipenv shell
, go to examples/github
and execute that again, this will use the local repository (instead of the system-wide version).
NOTE: if you don't want to use a GitHub Authorization token, just export NO_DOWNLOAD=1
before executing the commands.
i just followed the mentioned steps and iw as able to do o in environment which i am using without pipenv as well as in pipenv , but the format of schema.gql i got is different then the .gql file in github repository i think the mistake is in .gql file , can you tell me how to generate it from either node backend server or from python backend server
which .gql
you mean? In that folder we have a github_schema.json which is the result of the introspection (you can see this in the update-schema.sh
script https://github.com/profusion/sgqlc/blob/master/examples/github/update-schema.sh#L10-L15). I guess you mean this one, but it's a JSON file, not .gql
. You may use a GraphQL parser (as in graphql-core
or the reference https://graphql.org/graphql-js/language/#parse), then you can use an introspection on that schema... but many tools do that conversion for you. This may guide you: https://www.apollographql.com/blog/backend/schema-design/three-ways-to-represent-your-graphql-schema/
Then we have sample_operations.gql, this is manually written and represent the query/mutation you'd send to the server.
thanks , let me try this and get back to you once i get my answer
while using the code generator to generate operations file i am receiving this particular error