Closed as not planned
Description
Describe the feature
This issue is very similar to #5181.
Apparently, the same problem applies to number
types. In SDKv2, number
types that are accidentally passed as strings
, the SDK converts them to the right type silently.
SDKv3 will not do the conversion, allowing the server call to fail because of mismatched types.
Example:
SDKv2
const codedeploy = new AWS.CodeDeploy({ region: 'eu-west-1' });
const input: AWS.CodeDeploy.CreateDeploymentConfigInput = {
deploymentConfigName: 'testtest',
computePlatform: 'Lambda',
trafficRoutingConfig: {
type: "TimeBasedLinear",
timeBasedLinear: {
linearInterval: "1" as any, // The type says 'number' but I'm forcing strings here
linearPercentage:"5" as any,
},
}
};
// Following call happily succeeds
console.log(await codedeploy.createDeploymentConfig(input).promise());
SDKv3
const codedeploy = new CodeDeploy();
const input: CreateDeploymentConfigCommandInput = {
deploymentConfigName: 'testtest',
computePlatform: 'Lambda',
trafficRoutingConfig: {
type: "TimeBasedLinear",
timeBasedLinear: {
linearInterval: "1" as any, // The type says 'number' but I'm forcing strings here
linearPercentage:"5" as any,
},
}
};
await codedeploy.createDeploymentConfig(input);
The call fails with:
SerializationException: STRING_VALUE can not be converted to an Integer
Use Case
Why does this matter to us?
Same reason as in #5181, we allow users to drive SDK calls using arbitrary, user-controlled parameters that cannot be type checked. We are transparently migrating all SDKv2 calls to SDKv3 calls, and calls that used to work no longer work after the upgrade.
Proposed Solution
Accept the same argument types as in SDKv2
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
SDK version used
3.409.0