Replies: 2 comments 5 replies
-
Hello! This is exactly what Ariadne Codegen does. It takes schema, GraphQL queries and generates fully typed client class you import in your code to run queries. |
Beta Was this translation helpful? Give feedback.
1 reply
-
You need to change your query to accept variable: query MyQuery($plate: String!) {
getCar(plate_number: $plate) {
addresses
brand
mongoObjId
}
} Then generated client will have a |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm looking for a method to dynamically generate Python functions that correspond to the queries and mutations defined in a GraphQL schema. After obtaining the schema, I want a system that can automatically create these functions, so I can simply import the generated code into my Python project and call the functions with the necessary parameters.
The ideal solution would facilitate seamless interactions with the GraphQL API by abstracting the request construction process. It would allow for changes in the schema without the need for manual updates to the function definitions in the client code.
I haved tried ariadnegraphql code generator but I had to specify a query like this:
query MyQuery {
getCar(plate_number: "14-77-ER") {
addresses
brand
mongoObjId
}
}
and it created an Client for this query with fix params.
Any advice on how I can better leverage the capabilities of Ariadne would be awesome!
Beta Was this translation helpful? Give feedback.
All reactions