Skip to content

Commit 9f63bbf

Browse files
dhasani23David Hasani
andauthored
fix(amazonq): default requestedConversions to undefined in manifest (#5924)
## Problem Recently noticed an issue where language upgrade transformations fail when our `manifest.json` includes this new key which was added for SQL conversions (unreleased feature). ## Solution Use a default of `undefined` for `requestedConversions`, so that it does not appear in the `manifest.json`, and only add it to the `manifest.json` when the user is doing a SQL conversion, as this key is only used for SQL conversions. --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: David Hasani <[email protected]>
1 parent cee0fa3 commit 9f63bbf

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

packages/core/src/codewhisperer/models/model.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -330,17 +330,15 @@ export class ZipManifest {
330330
hilCapabilities: string[] = ['HIL_1pDependency_VersionUpgrade']
331331
transformCapabilities: string[] = ['EXPLAINABILITY_V1'] // TO-DO: for SQL conversions, maybe make this = []
332332
customBuildCommand: string = 'clean test'
333-
requestedConversions: {
334-
sqlConversion:
335-
| {
336-
source: string | undefined
337-
target: string | undefined
338-
schema: string | undefined
339-
host: string | undefined
340-
sctFileName: string | undefined
341-
}
342-
| undefined
343-
} = { sqlConversion: undefined }
333+
requestedConversions?: {
334+
sqlConversion?: {
335+
source?: string
336+
target?: string
337+
schema?: string
338+
host?: string
339+
sctFileName?: string
340+
}
341+
}
344342
}
345343

346344
export interface IHilZipManifestParams {

packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,15 @@ export async function zipCode(
327327
) {
328328
// note that zipManifest must be a ZipManifest since only other option is HilZipManifest which is not used for SQL conversions
329329
const metadataZip = new AdmZip(transformByQState.getMetadataPathSQL())
330-
zipManifest.requestedConversions.sqlConversion = {
331-
source: transformByQState.getSourceDB(),
332-
target: transformByQState.getTargetDB(),
333-
schema: transformByQState.getSchema(),
334-
host: transformByQState.getSourceServerName(),
335-
sctFileName: metadataZip.getEntries().filter((entry) => entry.entryName.endsWith('.sct'))[0].entryName,
330+
zipManifest.requestedConversions = {
331+
sqlConversion: {
332+
source: transformByQState.getSourceDB(),
333+
target: transformByQState.getTargetDB(),
334+
schema: transformByQState.getSchema(),
335+
host: transformByQState.getSourceServerName(),
336+
sctFileName: metadataZip.getEntries().filter((entry) => entry.entryName.endsWith('.sct'))[0]
337+
.entryName,
338+
},
336339
}
337340
// TO-DO: later consider making this add to path.join(zipManifest.dependenciesRoot, 'qct-sct-metadata', entry.entryName) so that it's more organized
338341
metadataZip

0 commit comments

Comments
 (0)