Repository navigation
core: add ModuleSource.naming for SDK codegen - #14996
Merged
Merged
Conversation
vito
added a commit
that referenced
this pull request
Oct 30, 2026
Fill in the PR number of the ModuleSource.naming and load<X>FromID fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/go-sdk
that referenced
this pull request
Oct 30, 2026
The engine now answers the names it gives a module's own declarations: ModuleSource.naming (dagger/dagger#14996). The interface bindings take the schema names of the module's interfaces and their functions from typeNames and fieldNames, and the dispatcher and Dang entrypoint take the main object from mainObject, each asked with a direct, cached call when first needed. A failed answer fails generation. The engine answers by the rules of the version it names the module by, strcase before the cut, so the SDK no longer predicts any of them: moduleNamer's strcase and word-prefix mirrors, the Connector.ModuleNames gate and the --module-version plumbing are gone. go-sdk.dang passes module-codegen the ID of the final entrypoint module source in a file (--module-source-id-file), and module-codegen looks it up with node(id:); the source answers before its entrypoint is generated. The codegen execs no longer pass experimentalPrivilegedNesting: v1 views nest by default. The Connector refuses an engine before v1.0.0-beta.22, the release taken to carry the API. A test validates every query the identifiers package sends against #14996's schema (identifiers/testdata/engine.graphqls). Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/typescript-sdk
that referenced
this pull request
Oct 30, 2026
The generated entrypoints call a module through its own interfaces, and pick which object of an entrypoint module carries the constructor, by names the engine assigns. They spelled those names in ways the engine doesn't, which broke such modules on every engine: - function and argument names were sent as declared, so a call through getURL selected a field the engine names getUrl; - interfaces were namespaced as the scanner's PascalCase of the module's name followed by the interface's, which keeps an acronym run the engine may not and repeats a prefix it drops (PondHttpClient in module pond became PondPondHttpClient); - the main object was matched pascalized against the scanner's name, so a class named like this SDK's templates name it (K8sTools for k8s-tools) got no constructor. The generators now ask the engine instead of predicting: ModuleSource.naming (dagger/dagger#14996) answers by the rules of the version the engine names the module by, strcase before the identifier-casing cut and its naming rules from it, so no rule is mirrored here. The SDK writes the ID of the module source the engine loads to /module-source.id and runs the generators as nested clients; they read the names their typedef declares in one node(id:) query, ask directly for any name they look up that wasn't in it, and fail generation on a failed answer. When the engine takes no object for the main one, the object that pascalizes like the scanner's module name keeps the constructor, as before. Asking from codegen rather than from dang keeps the typedef parsed in one place: dang would need JSON.decode into Map, which no dang release has, and a names file matching what the templates look up. Generating a module therefore needs v1.0.0-beta.22, the release serving the API. The output only changes where the old names were wrong; the existing goldens are unchanged. Signed-off-by: Alex Suraci <[email protected]>
This was referenced Oct 30, 2026
vito
added a commit
to dagger/go-sdk
that referenced
this pull request
Oct 31, 2026
engine-e2e's default engine and engine-dev move from v1.0.0-beta.18 to dagger/dagger naming/module-source-naming 017633c (dagger/dagger#14996), the first engine that runs the SDK at its floor. Two things it surfaced: - The entrypoint contract checked the generated entrypoint against the bindings' schema, the targeted release's. The entrypoint is served at its own source's view, which can spell an enum's members differently (FunctionCachePolicy.Never before the cut, NEVER after). It's now checked against the entrypoint source's schema. - dang-sdk at the nested lock's 207f22c doesn't load on this engine (cannot use JSON! as Dagger.JSON!); its main, 14ba9d3, does. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 2, 2026
Fill in the PR number of the ModuleSource.naming and load<X>FromID fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 2, 2026
Follow the identifier casing cut to v1.0.0-beta.25 in the #14996 changelog fragments: the legacy naming fixes apply to modules before it. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/module-source-naming
branch
from
November 2, 2026 15:58
9e25570 to
c8f0ab8
Compare
vito
added a commit
that referenced
this pull request
Nov 2, 2026
Describe Query.naming and ModuleNaming's version, name and originalName in the identifier casing design, and update the changelog fragments of #14891 and #14996 for the consolidated API. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/go-sdk
that referenced
this pull request
Nov 2, 2026
dagger/dagger#14996 replaced Query.formatIdentifiers(version:) with Query.naming(version:), whose Naming formats the names. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 4, 2026
Fill in the PR number of the ModuleSource.naming and load<X>FromID fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 4, 2026
Follow the identifier casing cut to v1.0.0-beta.25 in the #14996 changelog fragments: the legacy naming fixes apply to modules before it. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/module-source-naming
branch
from
November 4, 2026 16:30
f921c4d to
b38b965
Compare
vito
added a commit
that referenced
this pull request
Nov 4, 2026
Describe Query.naming and ModuleNaming's version, name and originalName in the identifier casing design, and update the changelog fragments of #14891 and #14996 for the consolidated API. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/go-sdk
that referenced
this pull request
Nov 4, 2026
The engine now answers the names it gives a module's own declarations: ModuleSource.naming (dagger/dagger#14996). The interface bindings take the schema names of the module's interfaces and their functions from typeNames and fieldNames, and the dispatcher and Dang entrypoint take the main object from mainObject, each asked with a direct, cached call when first needed. A failed answer fails generation. The engine answers by the rules of the version it names the module by, strcase before the cut, so the SDK no longer predicts any of them: moduleNamer's strcase and word-prefix mirrors, the Connector.ModuleNames gate and the --module-version plumbing are gone. go-sdk.dang passes module-codegen the ID of the final entrypoint module source in a file (--module-source-id-file), and module-codegen looks it up with node(id:); the source answers before its entrypoint is generated. The codegen execs no longer pass experimentalPrivilegedNesting: v1 views nest by default. The Connector refuses an engine before v1.0.0-beta.22, the release taken to carry the API. A test validates every query the identifiers package sends against #14996's schema (identifiers/testdata/engine.graphqls). Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/go-sdk
that referenced
this pull request
Nov 4, 2026
engine-e2e's default engine and engine-dev move from v1.0.0-beta.18 to dagger/dagger naming/module-source-naming 017633c (dagger/dagger#14996), the first engine that runs the SDK at its floor. Two things it surfaced: - The entrypoint contract checked the generated entrypoint against the bindings' schema, the targeted release's. The entrypoint is served at its own source's view, which can spell an enum's members differently (FunctionCachePolicy.Never before the cut, NEVER after). It's now checked against the entrypoint source's schema. - dang-sdk at the nested lock's 207f22c doesn't load on this engine (cannot use JSON! as Dagger.JSON!); its main, 14ba9d3, does. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
to dagger/go-sdk
that referenced
this pull request
Nov 4, 2026
dagger/dagger#14996 replaced Query.formatIdentifiers(version:) with Query.naming(version:), whose Naming formats the names. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 4, 2026
Fill in the PR number of the ModuleSource.naming and load<X>FromID fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/module-source-naming
branch
from
November 4, 2026 18:59
b38b965 to
8a88bee
Compare
vito
added a commit
that referenced
this pull request
Nov 4, 2026
Follow the identifier casing cut to v1.0.0-beta.25 in the #14996 changelog fragments: the legacy naming fixes apply to modules before it. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 4, 2026
Describe Query.naming and ModuleNaming's version, name and originalName in the identifier casing design, and update the changelog fragments of #14891 and #14996 for the consolidated API. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 4, 2026
Fill in the PR number of the ModuleSource.naming and load<X>FromID fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/module-source-naming
branch
from
November 4, 2026 19:06
8a88bee to
6d5f9c8
Compare
Describe mainObject's acceptance of the module's schema name, scope the Fixed changelog entry to the SDKs it fixes (the in-repo Go codegen still picks its main struct by the old comparison), note in the Breaking entry that legacy objects spelled the doubly normalized way no longer implement such interfaces, and name both exceptions where the design and IdentifierNamingVersion promise legacy names byte for byte. Signed-off-by: Alex Suraci <[email protected]>
Carry mainObject's note on main objects spelled as the module's schema name into the API reference and the in-repo SDK clients. Signed-off-by: Alex Suraci <[email protected]>
Follow the identifier casing cut to v1.0.0-beta.25 in the #14996 changelog fragments: the legacy naming fixes apply to modules before it. Signed-off-by: Alex Suraci <[email protected]>
Replace Query.identifier, Query.formatIdentifiers and Query.namingDictionary with Query.naming(version): Naming!, which answers for one engine version, normalized as a module's declared version is (capped at the engine's own). Naming has identifier, formatIdentifiers, dictionary and module(name, originalName), which returns the ModuleNaming of a module that version names. ModuleNaming now reports the version, name and original name it answers for, so naming(version: m.version).module(name: m.name, originalName: m.originalName) answers exactly as m does. The original name is needed: a module loaded under an alias namespaces its types under the alias but strips the prefix, and finds its main object, by its original name. formatIdentifiers keeps its dictionary selection: dictionaries are base-version granular and never newer than the engine, so normalizing the version doesn't change which one a version gets. Signed-off-by: Alex Suraci <[email protected]>
Regenerate the API reference schema and pages, and the in-repo SDK clients, for Query.naming and Naming, and ModuleNaming's version, name and originalName. Signed-off-by: Alex Suraci <[email protected]>
Move the identifier tests to Query.naming, and check that Query.naming's module answers like ModuleSource.naming for modules before and at the cut, one versioned by its dang.toml, and CurrentModule.naming in a dependency loaded under two aliases. Signed-off-by: Alex Suraci <[email protected]>
Describe Query.naming and ModuleNaming's version, name and originalName in the identifier casing design, and update the changelog fragments of #14891 and #14996 for the consolidated API. Signed-off-by: Alex Suraci <[email protected]>
Query.identifier, Query.formatIdentifiers and Query.namingDictionary shipped, as experimental, in v1.0.0-beta.20, so their removal in favor of Query.naming gets a Breaking fragment. Signed-off-by: Alex Suraci <[email protected]>
Describe legacy naming exceptions against the new casing cut, since beta.25 shipped without the stack. Signed-off-by: Alex Suraci <[email protected]>
Replace synthetic ModuleSource and CurrentModule resolver tests with real pre-entrypoint sources and runtime integrations. Preserve algorithm, ordering, error, persistence and schema-shape coverage. Exercise explicit empty original names and ID round trips, primitive version normalization, and the distinction between future naming versions and unsupported module source versions. Require CurrentModule.naming to resolve the caller's source instead of silently falling back to an implementation-scoped source on lookup errors; that fallback can select another dependency alias. Keep the recorded source argument for replay. Strengthen both alias assertions and the main-type schema-name expectations. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Fill in the PR number of the ModuleSource.naming and load<X>FromID fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/module-source-naming
branch
from
November 5, 2026 16:28
4ecc216 to
4132c63
Compare
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Follow the identifier casing cut to v1.0.0-beta.25 in the #14996 changelog fragments: the legacy naming fixes apply to modules before it. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Describe Query.naming and ModuleNaming's version, name and originalName in the identifier casing design, and update the changelog fragments of #14891 and #14996 for the consolidated API. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Fill in the PR number of the ModuleSource.naming and load<X>FromID fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Follow the identifier casing cut to v1.0.0-beta.25 in the #14996 changelog fragments: the legacy naming fixes apply to modules before it. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/module-source-naming
branch
from
November 5, 2026 17:38
4132c63 to
59606c4
Compare
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Describe Query.naming and ModuleNaming's version, name and originalName in the identifier casing design, and update the changelog fragments of #14891 and #14996 for the consolidated API. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Fill in the PR number of the ModuleSource.naming and load<X>FromID fragments. Signed-off-by: Alex Suraci <[email protected]>
vito
force-pushed
the
naming/module-source-naming
branch
from
November 5, 2026 20:09
59606c4 to
8d9c79a
Compare
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Follow the identifier casing cut to v1.0.0-beta.25 in the #14996 changelog fragments: the legacy naming fixes apply to modules before it. Signed-off-by: Alex Suraci <[email protected]>
vito
added a commit
that referenced
this pull request
Nov 5, 2026
Describe Query.naming and ModuleNaming's version, name and originalName in the identifier casing design, and update the changelog fragments of #14891 and #14996 for the consolidated API. Signed-off-by: Alex Suraci <[email protected]>
vito
marked this pull request as ready for review
November 5, 2026 20:09
grouville
approved these changes
Nov 5, 2026
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.
Refs #13668
SDK codegen must know a module's schema names before loading it: the entrypoint that registers its declarations has not been generated yet. This adds engine-owned naming APIs so SDKs can use the same rules as module loading instead of maintaining client-side copies of
core.Namer.The casing cut is v1.0.0-beta.26. Module declaration names follow the module's effective engine version, not the caller's core API view. SDK adoption requires an engine containing these APIs.
The API
Namingnormalizes the requested version withengine.ModuleAPIViewVersion, including capping a future version at the engine's own. For a loadable module source, passing its reportedversion,nameandoriginalNametonaming(...).module(...)reproduces itsModuleNaming. This does not bypass source loading's minimum-engine check: adagger.jsonrequiring a newer engine is still rejected before its naming can be queried.identifier,formatIdentifiersanddictionaryusenaming.DictionaryFor(version). Module declaration naming uses the correspondingNamer, including legacy strcase before the cut.moduletakes an optionaloriginalNamebecause namespacing needs it (Namer.NamespaceObject(name, moduleName, moduleOriginalName)). A module loaded under a dependency alias namespaces its types under the alias, but strips a type's prefix by its original name and finds its main object by it too. For example,SharedThinginsharedloaded asalias-oneisAliasOneThing, butAliasOneSharedThingif the original name were the alias. Without the argument,originalNamedefaults toname, which is right for every module that isn't aliased.ModuleSource.namingandCurrentModule.namingare bound to the module as before.Compatibility
The experimental root fields
Query.identifier,Query.formatIdentifiersandQuery.namingDictionary(shipped in beta.20) are removed on every view, without aliases. Their replacements arenaming { identifier(name:) },naming(version:) { formatIdentifiers(names:, casing:, acronyms:) }andnaming { dictionary }.Primitive identifier parsing/formatting uses the version's naming dictionary, including before the cut.
ModuleNaming, separately, reproduces legacy strcase declaration names for pre-cut modules.Module declaration names
Lists preserve input order. The implementation shares
Namerwith module loading:typeNamesnamespaces objects, interfaces and enums using the final and original module names.fieldNamesnames functions, interface functions, object fields and arguments.enumMemberNamesnames enum members, preserving names already in GraphQL enum-member style.mainObjectreturns the first normalized or exact schema-name match. Under the new rules, it can also select a unique flattened-name match; absent or ambiguous matches return null. Both module loading and this API useNamer.DeclaredNameIndex.The source API needs only its name, original name and effective engine version—not
asModuleor a generated entrypoint. It is available on every v1 view so pre-cut SDK modules can call it for newer modules.CurrentModule.namingModule runtimes can query their own declaration names without carrying a
ModuleSource(for example, to construct an interface inline fragment).CurrentModuleis implementation-scoped and can be shared by two dependency aliases. Itsnamingfield therefore records the caller's actual module source as an internal argument, keeping both answers and cache identity alias-specific.TestCurrentModuleNamingAliasesexercises two aliases in one session.Breaking fix: pre-cut interface members normalize once
Interfaces previously normalized already-normalized function and argument names a second time. Legacy strcase is not idempotent:
e2eTestbecomese2ETest, thene2Etest. Objects normalized once, so a module's own object could fail to implement its interface.Interfaces now install their typedef names unchanged, matching objects and
fieldNames. This changes affected pre-cut interface spellings; an object matching only the former, doubly-normalized spelling no longer implements that interface. Post-cut names are unchanged.TestInterfaceNameNormalizationchecks both sides of the cut.Fixed: pre-cut main objects spelled as their schema name
For
k8s-tools, legacytypeNamesreturnsK8STools. Normalizing that again producedK8Stools, so main-object lookup rejected the API's own answer and namespacing could duplicate the prefix.The shared lookup now accepts an exact schema-name declaration as well as existing normalized matches. Legacy namespacing gives it the module's final name. Post-cut behavior is unchanged.
TestMainTypeSchemaNameloads real modules with these declarations before and at the cut.This does not change the in-repo Go SDK codegen's separate, legacy main-struct selection.
Scope limit: external name overrides
ModuleSource.naminguses the source's name and original name. An external override supplied only when loading it withasModuleis not visible to the source. Generated code that fixes names at generation time cannot automatically adapt to every later workspace rename.Dependency aliases are covered separately by
originalNameand the caller-specific source used byCurrentModule.naming. End-to-end behavior of code-generated SDK modules under workspace-only renames remains unverified here; this PR does not claim to solve it.Validation
Conventional
core/integrationcoverage:TestNamingBeforeEntrypoint: real sources without an SDK or generated entrypoint, queried by pre-/post-cut callers; source/primitive equivalence, default original name, empty lists, main-object results and validation. Future-version manifests are rejected at source loading rather than silently capped.TestModuleSourceNamingMatchesSchema: compares API answers with real registered object/interface/enum/member names, then queries both source and current-module naming inside the module, before and at the cut.TestCurrentModuleNamingAliases: two aliases in one session retain distinct namespaces and original-name handling.CurrentModule.namingnow propagates caller/source lookup errors rather than silently using the implementation-scoped receiver's source.TestNamingDangToml: effective version fromdang.tomlcontrols naming.TestInterfaceNameNormalizationandTestMainTypeSchemaName: real legacy interface and main-object behavior on both sides of the cut.TestIdentifier: primitive parsing/formatting/dictionary/version behavior and API availability.TestModuleIdentitydistinguishes omitted from explicitly emptyoriginalNameand checks publicnode(id:)round trips.At cleanup commit
4ecc216:./coreand./core/schemanaming tests: passed with-vet=off, 10-minute test timeout.go vet -lostcancel=false ./core ./core/schema: passed; the pre-existinglostcancelwarnings remain excluded.Removed redundant
TestModuleNamingRules,TestModuleSourceNamingResolves,TestCurrentModuleNamingandTestNamingModuleMatchesModuleSource. Retained distinct algorithm, ordering, ambiguity, namespacing, typedef-equivalence, error, persistence, identity-normalization, schema-availability/shape and nullable-version-input coverage. No full-suite or released-SDK smoke claim.API changes
go -C hack/sdl-diff run . c7dd6e602e731e793522f5c977d168715f8614aa:docs/docs-graphql/schema.graphqls 4ecc2168ed5efba06dbf9ef58b23bf45de83dc61:docs/docs-graphql/schema.graphqlsDetailed diff
extend type CurrentModule { + """ + The names the engine gives this module's own declarations: the same as its + source's ModuleSource.naming, for module runtimes, which have no ModuleSource. + + It answers for the module under its own name (ModuleSource.moduleName), by the + naming rules of the version the module is named by. A workspace or toolchain + that loads the module under another name namespaces its types under that name + instead, which this doesn't reflect. + """ + naming: ModuleNaming! @experimental(reason: "Identifier casing APIs are likely to change.") } +""" +The names the engine gives a module's own declarations, by the naming rules of the version the module is named by. + +Every list-taking field answers in input order. +""" +type ModuleNaming implements Node { + """ + The schema names of enum members this module declares, in input order: SCREAMING_SNAKE_CASE. + + A name already written in GraphQL's enum member convention (HTTP2, P_256) is + kept as it is. With the engine's identifier naming rules, Arm64 is ARM64 and + GitHub is GITHUB; with the legacy strcase rules, Arm64 is ARM_64. + + Errors on a name the module's naming rules can't parse (non-ASCII, no letters + or digits, or over 256 bytes). The legacy rules name anything. + """ + enumMemberNames( + """ + The enum member names as the module's source declares them. + """ + names: [String!]! + ): [String!]! + """ + The schema names of functions, object fields and function arguments this + module declares, including interface functions and their arguments, in input + order. + + With the engine's identifier naming rules, acronyms are written like words: + getURL is getUrl, baseURL is baseUrl, HTTPClient is httpClient. With the + legacy strcase rules, HTTPClient is httpclient and e2eTest is e2ETest. + + Errors on a name the module's naming rules can't parse (non-ASCII, no letters + or digits, or over 256 bytes). The legacy rules name anything. + """ + fieldNames( + """ + The function, field and argument names as the module's source declares them. + """ + names: [String!]! + ): [String!]! + """ + A unique identifier for this ModuleNaming. + """ + id: ID! + """ + Which of the candidates, the names of objects this module declares, the engine + takes as the module's main object; null if none. + + The engine finds the main object by the module's name, in any casing: the + first candidate, in input order, whose name normalizes to the same type name + as the module's, or is spelled as that type name already (K8STools for module + k8s-tools, by either rules: strcase spells k8s-tools K8STools, though it would + normalize K8STools again to K8Stools). Failing that, with the engine's + identifier naming rules only, the only candidate spelled the same once + lowercased without word boundaries (Sha256Sum for module sha256sum); several + such candidates are ambiguous, and give null. + + Errors on a name the module's naming rules can't parse (non-ASCII, no letters + or digits, or over 256 bytes). The legacy rules name anything. + """ + mainObject( + """ + The object names as the module's source declares them. + """ + candidates: [String!]! + ): String + """ + The module's name, which namespaces its types. + """ + name: String! + """ + The module's original name, which its main object and namespaced type names + are spelled after. It differs from name when the module is loaded under + another name, as a dependency alias. + """ + originalName: String! + """ + The schema names of objects, interfaces and enums this module declares, as the + engine installs them: namespaced under the module's name, in input order. + + A name is prefixed with the module's name unless it already starts with the + module's name on a word boundary. With the engine's identifier naming rules: + HttpClient in module my-mod is MyModHTTPClient; Postman in module post is + PostPostman, while PostMan stays PostMan; K8STools in module k8s-tools is + K8sTools, the module's own name. With the legacy strcase rules, HttpClient in + module my-mod is MyModHttpClient. + + Errors on a name the module's naming rules can't parse (non-ASCII, no letters + or digits, or over 256 bytes). The legacy rules name anything. + """ + typeNames( + """ + The type names as the module's source declares them. + """ + names: [String!]! + ): [String!]! + """ + The normalized engine version whose naming rules name the module. + """ + version: String! +} extend type ModuleSource { + """ + The names the engine gives this module's own declarations, by the naming rules + of the version the module is named by: its engine version, capped at the + engine's own. + + Modules declaring a version before the identifier casing cut get the legacy + strcase names; later ones get the engine's identifier naming rules. + + For SDK codegen, which must reproduce these names before the module is loaded: + this reads only the source's name, original name and engine version, so it + answers before the module's entrypoint is generated. + + It answers for the module under its own name (moduleName). A workspace or + toolchain that loads the module under another name namespaces its types under + that name instead, which this doesn't reflect. + """ + naming: ModuleNaming! @experimental(reason: "Identifier casing APIs are likely to change.") } +""" +The engine's identifier naming rules at an engine version. +""" +type Naming implements Node { + """ + The acronyms and terms used to parse and format identifiers. + """ + dictionary: [NamingTerm!]! + """ + Format many names at once, for codegen. Returns them in input order. + """ + formatIdentifiers( + """ + How to write acronyms and terms where a word starts with a capital. + """ + acronyms: AcronymStyle = UPPERCASE + + """ + The casing to format the names in. + """ + casing: Casing! + + """ + The names to format, in any casing. + """ + names: [String!]! + ): [String!]! + """ + A unique identifier for this Naming. + """ + id: ID! + """ + Parse a name in any casing into words. + + Known acronyms and terms come from the naming dictionary; everything else + falls back to the case heuristic. Errors on non-ASCII input, input with no + letters or digits, or input over 256 bytes. + """ + identifier( + """ + The name to parse. + """ + name: String! + ): Identifier! + """ + The names the engine gives the declarations of a module named by these rules. + """ + module( + """ + The module's name, which namespaces its types. + """ + name: String! + + """ + The module's original name, when it's loaded under another (as a dependency + alias): its main object and namespaced type names are spelled after it. + Defaults to name. + """ + originalName: String + ): ModuleNaming! + """ + The normalized engine version these rules answer for. + """ + version: String! +} extend type Query { """ - Format many names at once, for codegen. Returns them in input order. + The engine's identifier naming rules at an engine version. """ - formatIdentifiers( - """ - How to write acronyms and terms where a word starts with a capital. - """ - acronyms: AcronymStyle = UPPERCASE - - """ - The casing to format the names in. - """ - casing: Casing! - - """ - The names to format, in any casing. - """ - names: [String!]! - + naming( """ - The engine version whose naming dictionary to parse the names with, e.g. the - __schemaVersion of a schema being generated. Defaults to the caller's engine - version. + The engine version to answer for, e.g. the engine version a module declares. + Defaults to the caller's. Normalized as a module's is: a version past the + engine's is capped at the engine's own. """ version: String - ): [String!]! @experimental(reason: "Identifier casing APIs are likely to change.") - """ - Parse a name in any casing into words. - - Known acronyms and terms come from the naming dictionary; everything else - falls back to the case heuristic. Errors on non-ASCII input, input with no - letters or digits, or input over 256 bytes. - """ - identifier( - """ - The name to parse. - """ - name: String! - ): Identifier! @experimental(reason: "Identifier casing APIs are likely to change.") - """ - The acronyms and terms used to parse and format identifiers. - """ - namingDictionary: [NamingTerm!]! @experimental(reason: "Identifier casing APIs are likely to change.") + ): Naming! @experimental(reason: "Identifier casing APIs are likely to change.") }