moto icon indicating copy to clipboard operation
moto copied to clipboard

Dynamodb incorrectly allows a mix of "expression" and "non-expression" parameters

Open paulmdavies opened this issue 2 years ago • 1 comments

Versions

moto: 3.1.16 boto3: 1.21.46

Code

table.get_item(
    Key={
        'key': 'the-key'
    },
    AttributesToGet=[
        'foo'
    ],
    ProjectionExpression='foo'
)

Expectation

An error. This is what is produced by boto3 when calling this against a real table:

botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the GetItem operation: Can not use both expression and non-expression parameters in the same request: Non-expression parameters: {AttributesToGet} Expression parameters: {ProjectionExpression}

Reality

No error.

paulmdavies avatar Aug 02 '22 12:08 paulmdavies

Thanks for raising this @paulmdavies - marking it as an enhancement to add this validation.

If this is something you want to implement yourself, PR's are always welcome! Let me know if you need help getting started.

bblommers avatar Aug 02 '22 17:08 bblommers