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

ListUserPoolClientsResponseTypeDef : NextToken should be not required #238

Open
filol opened this issue Dec 26, 2023 · 3 comments
Open

ListUserPoolClientsResponseTypeDef : NextToken should be not required #238

filol opened this issue Dec 26, 2023 · 3 comments
Labels
🐞 bug Something isn't working 🎉 released Changes were included to the latest release 👋 response needed Awaiting response from a reporter

Comments

@filol
Copy link

filol commented Dec 26, 2023

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.

@filol filol added the 🐞 bug Something isn't working label Dec 26, 2023
@vemel
Copy link
Collaborator

vemel commented Dec 28, 2023

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.

@jl32239
Copy link

jl32239 commented Feb 5, 2024

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.

@vemel
Copy link
Collaborator

vemel commented Apr 25, 2024

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.

@vemel vemel added 👋 response needed Awaiting response from a reporter 🎉 released Changes were included to the latest release labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🎉 released Changes were included to the latest release 👋 response needed Awaiting response from a reporter
Projects
None yet
Development

No branches or pull requests

3 participants