Skip to content

Remove client stubs generation from SDKs #3103

@shykes

Description

@shykes

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions