ListUserPoolClientsResponseTypeDef : NextToken should be not required
Closed this issue · 3 comments
Describe the bug
This is the actual definition for ListUserPoolClientsResponseTypeDef. Also I remark writing this issue that HostId
is also missing in ResponseMetadata but he is required inside the actual typing.
ListUserPoolClientsResponseTypeDef = TypedDict(
"ListUserPoolClientsResponseTypeDef",
{
"UserPoolClients": List[UserPoolClientDescriptionTypeDef],
"NextToken": str,
"ResponseMetadata": ResponseMetadataTypeDef,
},
)
But Boto3 doesn't return NextToken if it's the last page. I suggest to change the type from str to
To Reproduce
Steps to reproduce the behavior:
bsm = BotoSesManager()
cognito_idp_client = bsm.cognitoidentityprovider_client
response = cognito_idp_client.list_user_pool_clients(UserPoolId=user_pool_id)
logger.info(response)
Actual output
Log give this output :
{
"UserPoolClients": [],
"ResponseMetadata": {
"RequestId": "ec73c8d5-ab56-46aa-a6fb-43d18e10b1c0",
"HTTPStatusCode": 200,
"HTTPHeaders": {
"date": "Tue, 26 Dec 2023 17:37:07 GMT",
"content-type": "application/x-amz-json-1.1",
"content-length": "22",
"connection": "keep-alive",
"x-amzn-requestid": "ec73c8d5-ab56-46aa-a6fb-43d18e10b1c0"
},
"RetryAttempts": 0
}
}
Expected output
...
Additional context
Your OS, boto3-stubs
installation method, boto3
version, etc.
Thank you for the report. Response shapes usually have full totality. I will try to find a way to check if the field is optional.
Similar situation with DescribeInstancesResultTypeDef
:
DescribeInstancesResultTypeDef = TypedDict(
"DescribeInstancesResultTypeDef",
{
"Reservations": List[ReservationTypeDef],
"NextToken": str,
"ResponseMetadata": ResponseMetadataTypeDef,
},
)
Roughly half of the definitions in types_aiobotocore_ec2.type_defs
which have NextToken
declare it as optional, but I'm guessing it should be optional for all.
The issue has finally been fixed in mypy_boto3_builder 7.24.0
release. I have also released mypy-boto3-cognito-idp 1.34.91
with the fix included. Please update and let me know if it works as expected.