Replies: 2 comments 3 replies
-
|
I wonder if The server will have access to the list of persisted documents anyway so this would be easier to implement vs dumping the whole registry to a json blob and serializing that onto the page or whatever you might otherwise do to implement |
Beta Was this translation helpful? Give feedback.
-
|
I would start with a client-side plugin contract first, then standardize server discovery separately. For GraphiQL, a type PersistedDocument = {
id: string
name?: string
operationName?: string
operationType?: "query" | "mutation" | "subscription"
document: string
tags?: string[]
stats?: {
calls?: number
lastUsedAt?: string
errorRate?: number
p95Ms?: number
}
}
type DocumentRegistryPluginOptions = {
getDocuments: () => Promise<PersistedDocument[]>
}That lets teams wire it to whatever registry they already have without requiring a new GraphQL spec decision up front. For automatic discovery, I would be cautious about introspection. Persisted documents are operational/application artifacts, not really schema metadata. They may also contain private operation names, internal fields, or traffic data that should not be exposed anywhere introspection is enabled. A dedicated endpoint or well-known metadata document feels cleaner: with auth required by default. The plugin could then support both: documentRegistryPlugin({
getDocuments,
})
documentRegistryPlugin({
endpoint: "/.well-known/graphql/persisted-documents",
})For the field/type decoration use case, the plugin can parse the returned documents and build usage counts locally against the current schema. If optional traffic stats are supplied per document, GraphiQL could surface both static usage and runtime usage without making those concepts part of introspection itself. So my vote would be:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Thoughts on standardizing a plugin that can be used to display persisted documents?
and then fields/types can be decorated with how many times they're used
bonus points for an indicator to show traffic usage per document (if you're able to supply that data)
We could define a simple callback interface for the user to define a
getDocuments()callback method to return the manifest in a standardized format.cc @benjie for persisted documents chatter.
(I searched "persisted documents" for prior discussion/issues on this topic in this repo and couldn't find anything, apologies if this has already been discussed elsewhere.)
Beta Was this translation helpful? Give feedback.
All reactions