FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
graphql-server/tests/schema.py at python3.12 · graphql-python/graphql-server · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
graphql-python
/
graphql-server
Public
Notifications
You must be signed in to change notification settings
Fork
70
Star
134
Code
Issues
5
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
graphql-server
/
tests
/
schema.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
45 lines (35 loc) · 1.13 KB
Breadcrumbs
graphql-server
/
tests
/
schema.py
Copy path
File metadata and controls
45 lines (35 loc) · 1.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from
graphql
import
(
GraphQLArgument
,
GraphQLField
,
GraphQLNonNull
,
GraphQLObjectType
,
GraphQLSchema
,
GraphQLString
,
)
def
resolve_thrower
(
*
_args
):
raise
Exception
(
"Throws!"
)
def
resolve_request
(
_obj
,
info
):
return
info
.
context
.
get
(
"q"
)
def
resolve_context
(
_obj
,
info
):
return
str
(
info
.
context
)
QueryRootType
=
GraphQLObjectType
(
name
=
"QueryRoot"
,
fields
=
{
"thrower"
:
GraphQLField
(
GraphQLNonNull
(
GraphQLString
),
resolve
=
resolve_thrower
),
"request"
:
GraphQLField
(
GraphQLNonNull
(
GraphQLString
),
resolve
=
resolve_request
),
"context"
:
GraphQLField
(
GraphQLNonNull
(
GraphQLString
),
resolve
=
resolve_context
),
"test"
:
GraphQLField
(
type_
=
GraphQLString
,
args
=
{
"who"
:
GraphQLArgument
(
GraphQLString
)},
resolve
=
lambda
obj
,
info
,
who
=
"World"
:
"Hello %s"
%
who
,
),
},
)
MutationRootType
=
GraphQLObjectType
(
name
=
"MutationRoot"
,
fields
=
{
"writeTest"
:
GraphQLField
(
type_
=
QueryRootType
,
resolve
=
lambda
*
_
:
QueryRootType
)
},
)
schema
=
GraphQLSchema
(
QueryRootType
,
MutationRootType
)
invalid_schema
=
GraphQLSchema
()
Back
|
FazBrowse Home
|
New Git URL