You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,8 +150,38 @@ pytest
150
150
151
151
### Codegen from the GraphQL schema
152
152
153
+
We use code generation to create Python client code from our GraphQL schema. This involves two tools:
154
+
155
+
1.[**ariadne-codegen**](https://github.com/mirumee/ariadne-codegen): Generates typed Python GraphQL client code from GraphQL files
156
+
2.[**gqlg**](https://github.com/timqian/gql-generator): Automatically generates comprehensive GraphQL queries for all queries and mutations defined in the schema
157
+
158
+
The code generation process:
159
+
160
+
1. The GraphQL schema is manually taken from the [Openhexa Monorepo](https://github.com/BLSQ/openhexa-app/blob/main/frontend/schema.generated.graphql) and saved in [`openhexa/cli/graphql/schema.generated.graphql`](https://github.com/BLSQ/openhexa-sdk-python/blob/main/openhexa/cli/graphql/schema.generated.graphql)
161
+
2.`gqlg` generates all possible queries/mutations from the schema with a depth limit of 3
162
+
3.`ariadne-codegen` uses both the schema and queries to generate typed Python client code
Both tools run automatically via pre-commit hooks and CI/CD when GraphQL files are modified.
174
+
175
+
You can add new queries or mutations in the [`openhexa/cli/graphql/queries/queries.graphql`](https://github.com/BLSQ/openhexa-sdk-python/blob/main/openhexa/cli/graphql/queries.graphql) directory, and they will be picked up by the code generation process.
176
+
177
+
Example of usage of the result :
178
+
```python
179
+
from openhexa.cli.api import OpenHexaClient, CreateWebappInput, AddToFavoritesInput
0 commit comments