📣 Note: This functionality will be available soon.
📖 Note: Learn how to send some custom output in the response, in guide Hooking into Proactive feedback (guide coming soon)
Use the top-level entry
extensions to send data concerning deprecations, warnings, logs, notices and traces in the response to the query.
Any resolver (for fields and directives) can log any piece of information. This is useful to inform the user about some upcoming change to the schema through a notice, provide the developer with performance analysis through tracing, and others.
Deprecations are returned in the same query involving deprecated fields, and not only when doing introspection.
Warning are issues which can be considered non-blocking, i.e. they enhance the query but do not break it. While in standard GraphQL they would be considered errors, the GraphQL API for WordPress takes a more lenient approach towards them, by ignoring their execution only, and not the whole query.
For instance, passing parameter
limit with the wrong type will not stop execution of the query, it will just ignore this parameter (hence, the response will bring more results that are needed, but that's not a breaking issue) and provide an appropriate
Similarly, passing fields arguments which have not been added to the schema is considered a warning, and not an error.
Execute this query twice within 10 seconds, to observe a log entry indicating that the field is being retrieved from the cache:
This query traces how much time the field takes to resolve:
Example to be provided via extension plugin "Schema Feedback" (WIP).