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
> if you don't have your own Python module, it's possible to use relative path by having the `procotols.py` in the same directory as your script/transform/generator
104
+
105
+
## Generating Pydantic models from GraphQL queries
106
+
107
+
When working with GraphQL queries, you can generate type-safe Pydantic models that correspond to your query return types. This provides excellent type safety and IDE support for your GraphQL operations.
108
+
109
+
### Why use generated return types?
110
+
111
+
Generated Pydantic models from GraphQL queries offer several important benefits:
112
+
113
+
-**Type Safety**: Catch type errors at development time instead of runtime
114
+
-**IDE Support**: Get autocomplete, type hints, and better IntelliSense in your IDE
115
+
-**Documentation**: Generated models serve as living documentation of your GraphQL API
116
+
-**Validation**: Automatic validation of query responses against the expected schema
117
+
118
+
### Generating return types
119
+
120
+
Use the `infrahubctl graphql generate-return-types` command to create Pydantic models from your GraphQL queries:
121
+
122
+
```shell
123
+
# Generate models for queries in current directory
0 commit comments