[sts] GetCallerIdentityResponseTypeDef -> Arn should be 'str' but ist dict[str, Any]
Closed this issue · 3 comments
Describe the bug
With mypy-boto3-sts==1.28.36 the return value for the ARN changed.
GetCallerIdentityResponseTypeDef -> Arn should be 'str' but ist dict[str, Any]
To Reproduce
pip install -U 'mypy-boto3-sts==1.28.36'
- Install
boto3-stubs[...]
- Run
mypy
/pyright
on the following code sample
import boto3
sts_client = boto3.client("sts")
arn = sts_client..get_caller_identity()["Arn"]
reveal_type(arn)
...
Actual output
note: Revealed type is "builtins.dict[builtins.str, Any]"
Expected output
note: Revealed type is "builtins.str"
Additional context
With mypy-boto3-sts==1.28.16
you will see the expected output.
Thank you for the report.
I think it is related to JSON string conversion in botocore. I will try to fix it today.
So, it looks like only strings with a particular pattern should be handled as a potential JSON. I left only two patterns that are converted to JSON: "[\\u0009\\u000A\\u000D\\u0020-\\u00FF]+"
and "^[\\u0009\\u000A\\u000D\\u0020-\\u00FF]+$"
. All others are still considered strings.
@Wurstnase I published mypy-boto3-sts 1.28.36.post1
with the fix. Please update and let me know if it works for you. If it does - I release updates for all affected packages.
Thanks. Looks good to me.