Closed
Description
It is often useful to associate additional metadata with the schema. I suggest directives similar to those in GraphQL documents to be added to the schema definition language for this purpose.
The most common usecases for them are probably descriptions and deprecation reasons. But like normal GraphQL directives, they also provide an extension point for adding other metadata, such as additonal information about a connection as shown in this example.
interface Node
@doc(description: "Object with an ID")
{
id: ID!
}
interface Connection {
nodes: [Node]
}
type Story implements Node
@doc(description: "Story in the feed")
{
id: ID!
author: User
editor: User
}
type User implements Node
@doc(description: "Story in the feed")
{
id: ID!
name: String
stories: Connection @through(field: "author", ofType: "Story")
username: String @deprecated(reason: "Use name instead")
}
type Query {
story(id: ID!): Story
user(id: ID!): User
}
We are experimenting with generating GraphQL.js schemas from the schema definition language and this syntax would provide a nice way add metadata to the types for that purpose.
I have implemented a proof of concept of this syntax in the schema parser, so I can also open a PR, if this is a good idea.
Metadata
Metadata
Assignees
Labels
No labels