File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 44[ ![ Code Quality] ( https://github.com/BeatsuDev/GraphQLRequests/actions/workflows/code_quality.yml/badge.svg )] ( https://github.com/BeatsuDev/GraphQLRequests/actions/workflows/code_quality.yml )
55[ ![ codecov] ( https://codecov.io/gh/BeatsuDev/GraphQLRequests/branch/main/graph/badge.svg?token=FBQKU5OEWT )] ( https://codecov.io/gh/BeatsuDev/GraphQLRequests )
66
7- Define GraphQL types in Python as classes, then use them to automatically build queries. Or even simpler;
7+ Define GraphQL types in Python as classes or pydantic classes , then use them to automatically build queries. Or even simpler;
88gqlrequests will automatically build the classes for you given the api endpoint by using introspection! (Now that's awesome).
99You no longer need to define your requests as multiline strings (hence no strings attached).
1010
@@ -67,6 +67,16 @@ print(characters_query.build())
6767# length
6868# }
6969# }
70+
71+ from pydantic import BaseModel
72+
73+ class ExampleModel (BaseModel ):
74+ age: int
75+ name: str
76+
77+ ExampleQueryBuilder = gqlrequests.from_pydantic(ExampleModel)
78+
79+ print (ExampleQueryBuilder().build())
7080```
7181
7282## Edge cases
You can’t perform that action at this time.
0 commit comments