Closed raymondbutcher closed 1 month ago
Unfortunately, botocore
shapes mark all output shape keys as required. I will check if there is a way to distinguish between keys that can be missing.
A similar issue happens with the key CommonPrefixes
in ListObjectVersionsOutputTypeDef
in the response of ListObjectVersion
. It is typed as a List[CommonPrefixTypeDef]
in ListObjectVersionsOutputTypeDef
but can be missing from the response - likely if the list of common prefixes is empty.
I can open an issue if you want to keep track of both bugs separately --> done here https://github.com/youtype/mypy_boto3_builder/issues/248
The issue has finally been fixed in mypy_boto3_builder 7.24.0
release. I have also released mypy-boto3-s3 1.34.91
with the fix included. Please update and let me know if it works as expected.
Describe the bug
ListObjectsV2OutputTypeDef
is aTypedDict
which specifies theContents
key asList[ObjectTypeDef]
but the API can return a response without this key. Can we please change this toNotRequired[List[ObjectTypeDef]]
?To Reproduce Steps to reproduce the behavior:
boto3
andboto3-stubs[s3]
andpyright
pyright
on the following code sample:Actual output
Expected output
If I manually change
type_defs.pyi
to useNotRequired[List[ObjectTypeDef]]
then it does what I was expecting:Additional context
Using macOS 14.2.1, Python 3.11.2, Poetry (version 1.4.2) for managing dependencies, boto3 1.34.23, boto3-stubs 1.34.23.
I printed the
page
dictionary and got the following. You can see that there is noContents
key.