Fix include-code macro
This commit is contained in:
committed by
Rossen Stoyanchev
parent
9a4b72935d
commit
29fb3293f2
@@ -16,7 +16,7 @@ asciidoc:
|
||||
attribute-missing: 'warn'
|
||||
chomp: 'all'
|
||||
docs-site: https://docs.spring.io
|
||||
import-java: 'example$docs-src/main/java/org/springframework/graphql/docs'
|
||||
include-java: 'example$docs-src/main/java/org/springframework/graphql/docs'
|
||||
github-tag: main
|
||||
github-repo: spring-projects/spring-graphql
|
||||
github-raw: https://raw.githubusercontent.com/{github-repo}/{github-tag}
|
||||
|
||||
@@ -37,7 +37,7 @@ This is all done automatically for you if you are building a Spring Boot applica
|
||||
If your application is "manually" registering data fetchers, some types are not discoverable as a result.
|
||||
You should then register them with Spring Framework's `@RegisterReflectionForBinding`:
|
||||
|
||||
include-code:GraphQlConfiguration[]
|
||||
include-code::GraphQlConfiguration[]
|
||||
<1> This application declares a `RuntimeWiringConfigurer` that "manually" adds a `DataFetcher`
|
||||
<2> Through this `DataFetcher`, the `BookRepository` will expose a `Book` type
|
||||
<3> `@RegisterReflectionForBinding` will register the relevant hints for the `Book` type and all types exposed as fields
|
||||
@@ -50,7 +50,7 @@ The `AotProcessor` strategy described in the section above cannot be used as a r
|
||||
For client support, Spring for GraphQL embeds the {github-main-branch}/spring-graphql/src/main/resources/META-INF/native-image/org.springframework.graphql/spring-graphql[relevant reachability metadata for the client infrastructure].
|
||||
When it comes to Java types used by the application, applications should use a similar strategy as "manual" data fetchers using `@RegisterReflectionForBinding`:
|
||||
|
||||
include-code:ProjectService[]
|
||||
include-code::ProjectService[]
|
||||
<1> In a Native image, we need to ensure that reflection can be performed on `Project` at runtime
|
||||
<2> `@RegisterReflectionForBinding` will register the relevant hints for the `Project` type and all types exposed as fields
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ Alternatively, you can integrate the JavaScript build in your project as a separ
|
||||
|
||||
Once a GraphiQL build is available on the classpath, you can expose it as an endpoint with the {spring-framework-ref-docs}/web/webmvc-functional.html#webmvc-fn-router-functions[functional web frameworks].
|
||||
|
||||
include-code:GraphiQlConfiguration[]
|
||||
include-code::GraphiQlConfiguration[]
|
||||
<1> Load the GraphiQL page from the classpath (here, we are using the version shipped with Spring for GraphQL)
|
||||
<2> Configure a web handler for processing HTTP requests; you can implement a custom `HandlerFunction` depending on your use case
|
||||
<3> Finally, map the handler to a specific HTTP endpoint
|
||||
|
||||
@@ -105,7 +105,7 @@ handled as `request-stream`.
|
||||
`GraphQlRSocketHandler` can be used a delegate from an `@Controller` that is mapped to
|
||||
the route for GraphQL requests. For example:
|
||||
|
||||
include-code:GraphQlRSocketController[]
|
||||
include-code::GraphQlRSocketController[]
|
||||
|
||||
|
||||
|
||||
@@ -132,13 +132,13 @@ incoming requests and do one of the following:
|
||||
|
||||
For example, an interceptor can pass an HTTP request header to a `DataFetcher`:
|
||||
|
||||
include-code:RequestHeaderInterceptor[]
|
||||
include-code::RequestHeaderInterceptor[]
|
||||
<1> Interceptor adds HTTP request header value into GraphQLContext
|
||||
<2> Data controller method accesses the value
|
||||
|
||||
Reversely, an interceptor can access values added to the `GraphQLContext` by a controller:
|
||||
|
||||
include-code:ResponseHeaderInterceptor[]
|
||||
include-code::ResponseHeaderInterceptor[]
|
||||
<1> Controller adds value to the `GraphQLContext`
|
||||
<2> Interceptor uses the value to add an HTTP response header
|
||||
|
||||
@@ -146,7 +146,7 @@ include-code:ResponseHeaderInterceptor[]
|
||||
request validation errors that are raised before execution begins and which cannot be
|
||||
handled with a `DataFetcherExceptionResolver`:
|
||||
|
||||
include-code:RequestErrorInterceptor[]
|
||||
include-code::RequestErrorInterceptor[]
|
||||
<1> Return the same if `ExecutionResult` has a "data" key with non-null value
|
||||
<2> Check and transform the GraphQL errors
|
||||
<3> Update the `ExecutionResult` with the modified errors
|
||||
|
||||
Reference in New Issue
Block a user