Skip to content

Commit 444ce07

Browse files
mandiwisebenjie
andauthored
Apply suggestions from code review
Co-authored-by: Benjie <[email protected]>
1 parent c8327cf commit 444ce07

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/pages/learn/introspection.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<p className="learn-subtitle">Learn how to query information about a GraphQL schema</p>
44

5-
It's often useful to ask a GraphQL schema for information about what operations it supports. GraphQL allows us to do so using the [introspection system](https://spec.graphql.org/draft/#sec-Introspection).
5+
It's often useful to ask a GraphQL schema for information about what features it supports. GraphQL allows us to do so using the [introspection system](https://spec.graphql.org/draft/#sec-Introspection).
66

77
Introspection queries are special kinds of queries that allow you to learn about a GraphQL API's schema, and they also help power GraphQL development tools. On this page, we'll learn how to run different queries to learn more about an underlying schema's types, fields, and descriptions.
88

@@ -160,20 +160,20 @@ As demonstrated above, we can access the documentation about the type system usi
160160

161161
This has just scratched the surface of the introspection system; we can query for Enum type values, what Interface types another type implements, and more. We can even introspect on the introspection system itself.
162162

163-
To see an example of a specification-compliant GraphQL query introspection system implemented in code, you can view the [introspection.ts](https://github.com/graphql/graphql-js/blob/main/src/type/introspection.ts) file in GraphQL.js repository.
163+
To see an example of a specification-compliant GraphQL query introspection system implemented in code, you can view [src/type/introspection.ts](https://github.com/graphql/graphql-js/blob/e9b6b626f6f6aa379bb8f8c48df40d0c02a26082/src/type/introspection.ts) in the reference implementation.
164164

165165
## Introspection in production
166166

167-
Introspection is a useful feature of GraphQL, especially for client developers. However, for private GraphQL APIs, it may be undesirable to expose sensitive information about the schema publicly via the `__schema` field in a production environment.
167+
Introspection is a useful feature of GraphQL, especially for client developers and tooling. However, for APIs intended only for your own applications, it’s typically not needed in production—required operations are usually baked into these applications at build time, making runtime introspection unnecessary.
168168

169-
In those cases, it may be preferable to disable introspection in production environments as a part of a broader API security strategy that could also include authentication and authorization, depth-limiting, query cost analysis, and more.
169+
Disabling introspection in production is common in order to reduce the API’s attack surface. This is often part of a broader API security strategy, which may also include authentication and authorization, operation safe-listing (or a range of alternative protections, such as depth-limiting, breadth-limiting, alias limits, cycle rejection, cost analysis, etc.), execution timeouts, and more.
170170

171171
## Next steps
172172

173173
To recap what we've learned about introspection:
174174

175175
- Type names can be queried in a field selection set for an Object, Interface, or Union type using the `__typename` meta-field
176176
- Information about the elements of a GraphQL schema can be queried using the `__schema` field on the `query` root operation type
177-
- Introspection is often disabled in production environments for private APIs
177+
- Introspection is often disabled in production environments
178178

179179
Now that you've explored the GraphQL type system, how to query data from an API, and what the lifecycle of a request looks like, head over to the [Best Practices](/learn/best-practices/) section to learn more about running GraphQL in production.

0 commit comments

Comments
 (0)