Extend schema
Quramy opened this issue · comments
Yosuke Kurami commented
We need ways to extend server-side schema. For example, with apollo local state , developers write operations such as:
const query = gql`
query LocalQuery {
userForm @client {
name
age
}
}
`;
But for now this plugin reports errors that @client
and userForm
type are not defined in server-side schema.
To suppress this ( or to complete local type fields or directives ), this plugin needs to support to extend server-side schema with client-only schema files.
## local.graphql
directive @client on FIELD
type UserForm {
name: String!
age: Int!
}
extend type Query {
userForm: UserForm!
}
/* tsconfig.json */
"plugins": [
{
"name": "ts-graphql-plugin",
"schema": "./schema.graphql", /* derived from server */
"localSchema": ["./local.graphql"], /* client only schema */
}
]