Skip to content

Commit decb804

Browse files
authored
Add an example query to the DisableIntrospection docs (#3898)
1 parent 279a31d commit decb804

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/extensions/disable-introspection.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,37 @@ schema = strawberry.Schema(
3535
## API reference:
3636

3737
_No arguments_
38+
39+
## Example query:
40+
41+
Running any query including the introspection field `__schema` will result in an
42+
error. Consider the following query, for example:
43+
44+
```graphql
45+
query {
46+
__schema {
47+
__typename
48+
}
49+
}
50+
```
51+
52+
Running it against the schema with the `DisableIntrospection` extension enabled
53+
will result in an error response indicating that introspection has been
54+
disabled:
55+
56+
```json
57+
{
58+
"data": null,
59+
"errors": [
60+
{
61+
"message": "GraphQL introspection has been disabled, but the requested query contained the field '__schema'.",
62+
"locations": [
63+
{
64+
"line": 2,
65+
"column": 3
66+
}
67+
]
68+
}
69+
]
70+
}
71+
```

0 commit comments

Comments
 (0)