Skip to content

Generated clients redeclare the whole core API #18

Description

@shykes

Part of dagger/dagger#13805

Context

A generated client binds one module. The schema it sees is core plus that module, and it generates Go types for all of it.

Problem

Core is regenerated into every client, about 20,000 lines each. Generating two clients produced two copies that differed by one line.

Size is the smaller half. Each copy declares its own types, so clidev.File and enginedev.File are different Go types describing the same object. Nothing passes between two generated clients, and nothing passes between a generated client and hand-written dagger.io/dagger code. Crossing means a round trip through the object's ID:

id, _ := cli.Binary().ID(ctx)
file := enginedev.Ref[*enginedev.File](engine, enginedev.ID(id))

With one package per module, that cost is paid by every program that binds more than one.

Solution

Do not generate core. Refer to dagger.io/dagger, which the client already depends on:

func (r *EngineDev) Container(...) *dagger.Container

A generated client shrinks to its own module's surface. Core exists once, in the package named for it, and every client interoperates with every other client and with hand-written code.

Activity

  1. changed the title [-]Each generated client contains its own copy of the core API[/-] [+]Generated clients redeclare the whole core API[/+] on Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions