graphql2python is a tool that generates python code out of your GraphQL schema. If you are using python as GraphQL client you can to generate GraphQL queries and pydantic data-model with graphql2python.
graphql2python has the following tools for your python GraphQL client:
- python classes for generate of GraphQL queries;
- the function for generation of pydantic data-model by your GraphQL schema;
- ... (in future releases);
The special example for gql users here.
Install with pip
pip install graphql2python
Create the following file
# graphql2python.yaml schema: ./schema.graphql output: ./model.py
and run the following command
graphql2python render --config ./graphql2python.yaml
See the documentation for all the possibilities ( while it is docs/source/
).