Problem
The cloak DX is currently very rough. One particularly rough area is the client stub generation, because it causes duplication of effort. For each action implemented in Go or Typescript, the developer must write 2 different but redundant graphql schemas: one for the server-side implementation (new field and its parameters), one for the client-side implementation (new query with same parameters).
For example see the netlify go extension:
Server-side (schema.graphql):
extend type Query {
netlify: Netlify!
}
type Netlify {
deploy(
contents: FSID!
subdir: String
siteName: String
token: SecretID!
): Deploy!
}
type Deploy {
url: String!
deployURL: String!
logsURL: String
}
Client-side (operations.graphql):
query Deploy(
$contents: FSID!
$subdir: String
$siteName: String
$token: SecretID!
) {
netlify {
deploy(
contents: $contents
subdir: $subdir
siteName: $siteName
token: $token
) {
url
deployURL
}
}
}
The only purpose of the client-side file is to allow client-side stub generation.
Solution
As a stopgap, remove client stub generation entirely, while leaving the possibility of bringing it later, as an optional add-on layer.
The benefits of this stopgap are:
- Having to write manual graphql queries is a better DX than having to write redundant schema files with confusing filenames
- Less complex SDK implementation, easier to understand and change
- Better knowledge sharing across languages: if a typescript dev found the perfect graphql query to solve a particular problem, it can be reused as-is by go or python developers.
Problem
The cloak DX is currently very rough. One particularly rough area is the client stub generation, because it causes duplication of effort. For each action implemented in Go or Typescript, the developer must write 2 different but redundant graphql schemas: one for the server-side implementation (new field and its parameters), one for the client-side implementation (new query with same parameters).
For example see the netlify go extension:
Server-side (
schema.graphql):Client-side (
operations.graphql):The only purpose of the client-side file is to allow client-side stub generation.
Solution
As a stopgap, remove client stub generation entirely, while leaving the possibility of bringing it later, as an optional add-on layer.
The benefits of this stopgap are: