Skip to content

Regression to number types with respect to SDKv2 #5198

Closed as not planned
Closed as not planned
@rix0rrr

Description

@rix0rrr

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

Environment details (OS name and version, etc.)

Metadata

Metadata

Assignees

Labels

feature-requestNew feature or enhancement. May require GitHub community feedback.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions