Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert EC2 Query Protocol empty list serialization #2269

Conversation

syall
Copy link
Contributor

@syall syall commented May 1, 2024

Overview

Revert EC2 Query Protocol empty list serialization.

Empty lists are NOT serialized for the EC2 query protocol, which differs from the AWS query protocol.
See "EmptyQueryLists" for the AWS query protocol equivalent test case.

This is needed since SDKs that conform to the broken protocol tests will send invalid requests to EC2.

Testing

Tested with aws-sdk-js-v3 locally (smithy-typescript, aws-sdk-js-v3) sending a previously failing command with the error InvalidRequest: The request received was invalid. now with the correct validation error.

const { EC2Client: Client, DescribeKeyPairsCommand: Command } = require("@aws-sdk/client-ec2");

(async () => {
    const client = new Client();
    client.middlewareStack.add(next => async (args) => {
        console.info(args.request.body);
        return await next(args);
    }, { step: 'finalizeRequest' });
    try {
        await client.send(new Command({
            Filters: [],
            KeyPairIds: ["key-KEYISNOTREALATALL"],
        }));
    } catch (error) {
        console.error(error);
    }
})();

Before:

Filter=&KeyPairId.1=key-KEYISNOTREALATALL&Action=DescribeKeyPairs&Version=2016-11-15
InvalidRequest: The request received was invalid.

After:

KeyPairId.1=key-KEYISNOTREALATALL&Action=DescribeKeyPairs&Version=2016-11-15
InvalidParameterValue: Invalid value 'key-KEYISNOTREALATALL' for keyPairId.

The Filter= empty list serialization is removed.

- Filter=&KeyPairId.1=key-KEYISNOTREALATALL&Action=DescribeKeyPairs&Version=2016-11-15
+ KeyPairId.1=key-KEYISNOTREALATALL&Action=DescribeKeyPairs&Version=2016-11-15

Links


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@syall syall marked this pull request as ready for review May 1, 2024 19:40
@syall syall requested a review from a team as a code owner May 1, 2024 19:40
@syall syall requested a review from kstich May 1, 2024 19:40
Empty lists are NOT serialized for the EC2 query protocol, which differs from the AWS query protocol.
See "EmptyQueryLists" for the AWS query protocol equivalent test case.
@syall syall force-pushed the revert-ec2-query-protocol-empty-list-serialization branch from 82ccb94 to cc57eff Compare May 1, 2024 20:01
@syall syall merged commit cbf76e2 into smithy-lang:main May 1, 2024
13 checks passed
@syall syall deleted the revert-ec2-query-protocol-empty-list-serialization branch May 1, 2024 20:31
ysaito1001 added a commit to smithy-lang/smithy-rs that referenced this pull request May 23, 2024
github-merge-queue bot pushed a commit to smithy-lang/smithy-rs that referenced this pull request May 24, 2024
## Motivation and Context
Upgrades Smithy to 1.49.0

## Description
As part of the upgrade, it updates the serializer for EC2 query protocol
to handle empty lists in response to
[this](smithy-lang/smithy#2269) (otherwise [a
protocol
test](https://github.com/smithy-lang/smithy-rs/blob/main/codegen-client-test/build.gradle.kts#L75)
`ec2_empty_query_lists_request` would fail).

## Testing
Existing tests in CI

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants