If you want it to be graphql specs compatible then this isn't possible ...
From specs execution it must contain a document [with query/mutation]:
A request for execution consists of a few pieces of information:
- The schema to use, typically solely provided by the GraphQL service.
- A Document which must contain GraphQL OperationDefinition and may contain FragmentDefinition.
- ...
From 'Executing Requests' request ...
To execute a request, the executor must have a parsed Document and a selected operation name to run if the document defines multiple operations, otherwise the document is expected to only contain a single operation.
... then one of possible response is an error response, e.g.
{"errors":[{"message":"GraphQL Request must include at least one of those two parameters: "query" or "queryId"","extensions":{"category":"request"}}],"extensions":{"debug":[]}}
... if you don't care ...
about strict graphql specs ... and taking assumption that probably nobody needs[/will use seriously possibly error] this response (not tools required introspection) ... you can return even html (not json) 'hello, read docs' content.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…