feat: update ParametersTypeCoder and ParameterExportTypeCoder to emit output under version subdirectories#1960
Open
feat: update ParametersTypeCoder and ParameterExportTypeCoder to emit output under version subdirectories#1960
Conversation
6 tasks
Copilot
AI
changed the title
[WIP] Update remaining TypeCoders to emit output under version subdirectories
feat: update ParametersTypeCoder and ParameterExportTypeCoder to emit output under version subdirectories
Apr 26, 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.
Summary
ParametersTypeCoderandParameterExportTypeCoderwere not following thetypes/<version>/...output convention already used bySchemaTypeCoderandResponseTypeCoder. This change brings them into alignment so all type coders (exceptOperationTypeCoder) isolate per-version output undertypes/<version>/.ParametersTypeCoder.modulePath()parameters/<path>.types.ts(notypes/prefix, wrong subdirectory)types/<version>/paths/<path>.parameters.tswhen versioned,types/paths/<path>.parameters.tswhen notParameterExportTypeCoder.modulePath()public _modulePath!: stringfield that was set post-construction by callersmodulePath()now computes the path directly fromthis.versionandthis.requirement.url, identical logic toVersionedArgTypeCoderOperationTypeCodercleanupmodulePathparameter fromexportParameterType()andbuildDollarArgType(), and thecoder._modulePath = modulePathassignmentTests
ParametersTypeCodermodulePathtest to expect the new path formatmodulePathtests forParametersTypeCodertest/typescript-generator/parameter-export-type-coder.test.tscovering versioned and non-versionedmodulePath()behaviourOriginal Prompt
SchemaTypeCoderandResponseTypeCoderalready emit their output undertypes/<version>/...when a non-emptyversionis set. The remainingTypeCodersubclasses that produce version-specific type files must be updated to follow the same convention.Context
The multi-version code generation strategy is:
SchemaTypeCoderandResponseTypeCoderalready implement this:The following coders still need to be updated:
ParametersTypeCoder– emitstypes/paths/<path>.parameters.tsResponsesTypeCoder– emits types for the combined response objectParameterExportTypeCoder– emits individual exported parameter typesProposed change
For each coder listed above, update
modulePath()to insert theversionsegment betweentypes/and the remainder of the path whenthis.versionis non-empty, mirroring the pattern already used inSchemaTypeCoderandResponseTypeCoder:No other behaviour should change; only the output file location is affected.
Acceptance criteria
ParametersTypeCoder.modulePath()returnstypes/<version>/paths/...whenversionis non-empty andtypes/paths/...when emptyResponsesTypeCoder.modulePath()(if it declares one) follows the same conventionParameterExportTypeCoder.modulePath()follows the same conventionmodulePath()on each affected coder continue to passversionon each affected coderManual acceptance tests
version) generates parameter type files attypes/paths/<path>.parameters.tswith no version segment insertedversion: "v1") generates parameter type files attypes/v1/paths/<path>.parameters.tsParameterExportTypeCoderexports (e.g.HTTP_GET_$_Query) land intypes/v1/paths/<path>.types.tswhenversion = "v1"andtypes/paths/<path>.types.tswhenversion = ""versioncontinue to work as before with no generated-output changesTasks
ParametersTypeCoder.modulePath()to usepathJoin("types", this.version, "paths", pathString) + ".parameters.ts"ParameterExportTypeCoder._modulePathfield with a self-containedmodulePath()that computes the versioned path fromthis.versionandthis.requirement.urlmodulePathparameter fromOperationTypeCoder.exportParameterType()andbuildDollarArgType()(and their call sites)ParametersTypeCodermodulePathtest; added versioned and empty-version assertionstest/typescript-generator/parameter-export-type-coder.test.tswith non-versioned, versioned, and empty-versionmodulePathtests