Repository navigation
Conversation
When the schema has Query.formatIdentifiers, TypeScript client codegen names identifiers with the names the engine formats instead of guessing with toPascalCase: - methods, args and opts keys: CAMEL / UPPERCASE (shortSHA, withGPU) - Opts types and enum converter prefixes: PASCAL / UPPERCASE (ClientHTTPOpts) - enum members: PASCAL / CAPITALIZED, the closest match to what the generator has always written (Tcp, ObjectKind) Only TypeScript identifiers change. Field names in select, arg keys, input object fields and enum values stay as the schema has them: required args are keyed by their schema name, and renamed opts keys are mapped back to it before the call. Type names are left alone, since the runtime looks generated classes up by GraphQL type name; in views with formatIdentifiers they are canonical already, which a test checks. Renamed methods, Opts types and opts keys keep their old names as deprecated aliases. Without formatIdentifiers, every name falls back to the legacy converters, so older schemas generate byte-identical code. Signed-off-by: Alex Suraci <[email protected]>
Methods, args, opts keys and Opts types whose names the engine formats differently now use those names, with the old ones kept as deprecated aliases: shortSHA (shortSha), parentSHAs, filterURI, withoutURI, callID, pushURL and asSDKName opts keys, ClientHTTPOpts (ClientHttpOpts), ClientSSHFSVolumeOpts, ArtifactURIOpts, WorkspaceWith(out)SDKOpts. Nothing changes on the wire, and no enum member changes. Signed-off-by: Alex Suraci <[email protected]>
Calls through a module's own interfaces are built by the runtime, which used the TypeScript names of the interface's functions and arguments and predicted the interface's type name. From engine version v1.0.0 the engine names module declarations with its naming rules, so for names with acronyms the two disagree (getUrl is getURL) and the call relies on the legacy-spelling aliases at best. Both runtime paths now ask the engine before invoking anything, when the module declares interfaces: resolveSchemaNames formats the names with Query.formatIdentifiers, in one batch per casing, and namespaces each interface the way the engine does, comparing words. The static entrypoint (generated by cmd/codegen) and the Executor of the dynamic entrypoint use the result for selections, argument keys and node(id:) type names. The identifier API only exists from v1.0.0, the version the naming rules start at, and the runtime's session is served at the module's engine version, so the field being in the session schema is the gate. Older modules keep the names the runtime always used. The module introspection JSON emitter still predicts names with strcase. It isn't wired in and runs without an engine connection, so it only gets a note for whoever wires it. Signed-off-by: Alex Suraci <[email protected]>
This was referenced Oct 14, 2026
Contributor
Author
|
🤖 Closing: the in-repo SDKs are now legacy. This work will be redone as a PR against github.com/dagger/typescript-sdk ( |
vito
added a commit
to dagger/typescript-sdk
that referenced
this pull request
Oct 22, 2026
When the schema has Query.formatIdentifiers (views from v1.0.0-beta.21, the same views whose module declarations the engine names with engine/naming), methods, args and opts keys are CAMEL/UPPERCASE, Opts types and enum converters PASCAL/UPPERCASE, and enum members PASCAL/CAPITALIZED. Only TS identifiers change: selections, argument keys, input object fields, enum values and type names go over the wire as the schema has them, renamed opts keys are mapped back before the call, and required args are keyed by their schema name. Every renamed identifier keeps its old spelling as a deprecated alias: methods, top-level module functions, Opts types, opts keys and enum members. Schemas without the field keep the legacy converters, so they generate byte-identical code (the existing goldens are unchanged). Ported from dagger/dagger#14674. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/typescript-sdk
that referenced
this pull request
Oct 22, 2026
From v1.0.0-beta.21 the engine names a module's declarations with its naming rules, so HttpFetcher.getUrl(comUrl) in module pond is PondHTTPFetcher.getURL(comURL:). The static entrypoint and the dispatcher selected the TS names and predicted the type as <Module><Iface>, which no longer exist in the schema. The gate is the module's own schema, now passed to `codegen entrypoint` (--introspection-json-path): it is served at the module's engine version, and has Query.formatIdentifiers exactly when the engine names the module with engine/naming. The names are then computed at generation time with the vendored rules (core.Namer's FieldName and NamespaceObject), rather than asked of the engine at call time as dagger/dagger#14674 does: the generated file carries answers, and no runtime query depends on which view the dispatcher's session is served at. Older modules render byte-identical entrypoints. Signed-off-by: Alex Suraci <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 5b/N of the stack splitting #14501 (identifier casing): the TypeScript SDK. Plan: #14501 (comment)
Refs #13668
Stacked on #14673 (5a, Go codegen + the shared
cmd/codegeninfra).What changes for TypeScript
Client codegen (
cmd/codegen/generator/typescript). When the schema it generates from hasQuery.formatIdentifiers, the generator names TypeScript identifiers with the names the engine formats (introspection.LoadFormattedNames, from 5a) instead of guessing withtoPascalCase:shortSha(),filterUri()shortSHA(),filterURI()withToolResult(callId, …)withToolResult(callID, …){ pushUrl },{ asSdkName }{ pushURL },{ asSDKName }ClientHttpOpts,ClientSshfsVolumeOptsClientHTTPOpts,ClientSSHFSVolumeOptsNetworkProtocol.TcpNetworkProtocol.Tcp(unchanged)select, argument keys, input object fields and enum values go over the wire exactly as the schema has them: required args are keyed by their schema name (callId: callID), and renamed opts keys are mapped back before the call (pushUrl: opts?.pushURL ?? opts?.pushUrl).formatIdentifiersthey're already canonical, whichTestCoreTypeNamesAreCanonicalchecks against the live engine.shortSha: GitCommit["shortSHA"] = (...args) => this.shortSHA(...args)), Opts type aliases (export type ClientHttpOpts = ClientHTTPOpts) and old opts keys (pushUrl?: string,@deprecated).formatIdentifiers(older engines, pre-v1 views), every name goes through the legacy converters, so older schemas generate byte-identical code.Runtime (
sdk/typescript/src/module/naming.ts, executor, static entrypoint templates). Calls the runtime builds through a module's own interfaces used the TypeScript names of the interface's functions/args and predicted the interface type name (${module}${iface}). From v1.0.0 the engine names module declarations with its rules (#14669), sogetUrl(comUrl)onHttpFetcherisPondHTTPFetcher.getURL(comURL:). Both entrypoint paths now ask the engine first, only when the module declares interfaces:resolveSchemaNamesformats the names withQuery.formatIdentifiers(one batch per casing) and namespaces each interface the way the engine does. The gate is the field being in the runtime's session schema, which is served at the module's engine version; older modules keep the names they always had.Regenerated
sdk/typescript/src/api/client.gen.ts: the renames above, all with deprecated aliases, nothing on the wire.Breaking changes for TypeScript SDK users
Source compatibility is kept by the deprecated aliases; what's left for maintainers to decide on:
shortSha(),parentShas(),filterUri(),withoutUri(),callId(), thepushUrl/asSdkNameopts keys or the*HttpOpts/*SshfsVolumeOpts/*UriOpts/*SdkOptstype names now gets@deprecatedhints (and lint errors under@typescript-eslint/no-deprecated). How long the aliases live is an open decision (proposed: through 1.0).callId→callID) only matter to code reading them reflectively; they're positional.daggerCli→daggerCLI,MyModHttpclient→MyModHTTPClient). Go has deprecated aliases for those (core: name modules with engine/naming from v1.0.0-beta.21 #14669/codegen: name Go identifiers via formatIdentifiers #14673); TypeScript doesn't, so TS module code callingdag.daggerCli()breaks when the dependency is regenerated. The engine still accepts the old spelling over the wire; only the generated TS binding is missing. Worth deciding whether TS needs the Go-style legacy wrappers before release.Open decision: TypeScript enum member style
Enum members use PASCAL / CAPITALIZED (
Tcp,ObjectKind,GitHubRepo,PerSession), the closest match to what the generator has always written, so no core enum member changes. The alternative, PASCAL / UPPERCASE, would rename every member containing an acronym or term (Tcp→TCP,Ipv6→IPv6), with deprecated duplicates needed to keep them compatible. Calling it out so it can be confirmed.Not in it
callID,pushURL,shortSHA, …,FunctionCachePolicyvalues) and the TS generator's "old schema names" table (introspection/renamed.go,LegacyFieldName/LegacyArgName): PR 6.engineVersionbump: not needed for TypeScript. Thetypescript-sdkruntime module (sdk/typescript/runtime/dagger-module.toml, Go) stays at v0.21.9, as in the final tree of Centralize identifier casing in the engine and SDKs #14501; the name formatting happens in the TS library, inside the user module's own session.codegen introspect --names-out): TS codegen always runs with an engine connection, so it formats names directly.introspection_json.ts) still predicts names with strcase. It isn't wired in yet; it gets a comment for whoever wires it.Testing
go test ./cmd/codegen/...(naming funcs withinternal/testnames, fallback, rendered client with/without engine names, entrypointSchemaNameswiring,TestCoreTypeNamesAreCanonicalagainst the engine),go vettypescript-client/lint-typescript,typescript-client/test-nodejs-lts(incl. the newnaming.spec.ts),typescript-client/client-library/stale,typescript-client/format/stale,typescript-sdk/generate/staleTestModuleNaming/TestTypeScriptInterfaceAcronyms: a v1 TS module calls through its own interface (HttpFetcher.withHttpPrefix(...).getUrl(comUrl)) implemented by another TS module; the trace shows the runtime resolving the names viaformatIdentifiersand callingImpl.withHTTPPrefix(httpPrefix:)/Impl.getURL(comURL:). (The legacy-spelling aliases from core: name modules with engine/naming from v1.0.0-beta.21 #14669 would also accept the old names, so this checks correctness rather than catching a hard failure.)TestInterface/TestIface(Basic|Call)/typescript(pre-v1 and latest fixtures)TestTypescriptsuite andTestCLI.