Repository navigation
[R-392] fix: Fix duplicated identifiers in functions.ts and index.ts (#392) Co-authored-by: Claude Code - #407
Merged
luisfpg merged 1 commit intoSep 23, 2026
Conversation
…yclosproject#392) Co-authored-by: Claude Code
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.
Fix duplicated identifiers in functions.ts and index.ts (#392)
in detail:
Operation function export names
Rationale for how the generated functions are written and exported by
functions.tsandindex.ts(see issues #379, #389 and #392).The problem
Both index files re-export every generated function and its params type. Two situations used to
produce duplicated export names, which don't compile (
TS2308: Module has already exported a member named '...'):An operation declaring multiple tags (Duplicate function exports #379). The operation belongs to one service per tag,
but all of those services reference the very same operation - and thus the very same function.
Collecting the functions per service exported it once per tag:
Distinct operations sharing a method name (Duplicated X-Operation-Name Attribute Is Ignored And Not Generated #389).
operationIds are made unique when thespec is read, but
x-operation-nameis used as-is, so the same name can appear underdifferent tags:
The fix
operation yields a single function. It is written under its first tag only
(
fn/appointment/delete-appointment.ts), is exported once without any suffix, and everyservice of the operation imports that same file.
the exported name. The tag is free text, so it is converted to a valid identifier first
(
Car reportbecomesCarReport). Should the method name and the tag collide, the tagcannot disambiguate anymore - the operations would silently overwrite each other's file - so
generation fails with an error asking to make the names unique within the tag.
The generated exports for the two examples above:
The params types follow the same naming:
GetConsumptionCarReport$ParamsandGetConsumptionPlane$Params.The same reasoning applies within a service: operations grouped into one service by a shared
(super-category) tag must have unique method names, as the service class would otherwise declare
the same method twice - the export/file checks don't catch this, since names and paths are
derived from the first tag only. When services are generated, this also fails with an error.
Note that only the export name carries the tag - the function file itself is always
fn/<first tag>/<method name>.ts, and there is no per-tag export for a multi-tagged operation.Tag-scoped access is what the generated services are for.