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

Bug: swagger ui try out bugs with simple query string params #3515

Closed
danikenan opened this issue Dec 15, 2023 · 5 comments · Fixed by #3526
Closed

Bug: swagger ui try out bugs with simple query string params #3515

danikenan opened this issue Dec 15, 2023 · 5 comments · Fixed by #3526
Assignees
Labels
bug Something isn't working event_handlers

Comments

@danikenan
Copy link

danikenan commented Dec 15, 2023

Expected Behaviour

Allow filling out fields and executing (try out) simple requests in swagger ui without validation errors.

Please note:
The openapi json (extracted from the swagger html) works well in other swaggers editors. I tested with several editors.

Current Behaviour

Multiple bugs in the swagger ui:

  1. Two input fields representing two distinct query params seem to somehow be connected. They initialize to the same value (with no reason) and when the changes in the first field are also shown in the second.

  2. Even when both required fields are filled, the ui reports of a validation error as if one of the field is missing

Code snippet

app = APIGatewayRestResolver(
    enable_validation=True,
)

app.enable_swagger(
    path="/docs/swagger",
    title="My Company API",
)

@app.get("/v1/audience-anywhere")
def audience_anywhere(
    network: Annotated[
        Literal["twitter", "reddit"],
        Query(description="The network name. Currently only 'twitter' supported"),
    ],
    hashed_user_id: Annotated[str, Query(alias="hashed-user-id")],
) -> AudienceAnywhereResponse:
    logger.debug({"network": network, "hashed-user-id": hashed_user_id})
    return AudienceAnywhereResponse(audiences=["some value"])

Possible Solution

No response

Steps to Reproduce

create a simple lambda with the above code, deploy and test in browser

Screenshot 2023-12-15 at 14 21 57

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.12

Packaging format used

Lambda Layers

Debugging logs

No response

@danikenan danikenan added bug Something isn't working triage Pending triage from maintainers labels Dec 15, 2023
Copy link

boring-cyborg bot commented Dec 15, 2023

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@rubenfonseca
Copy link
Contributor

Looking at this now

@rubenfonseca
Copy link
Contributor

We were using an outdated version of the Swagger UI that had problems, submitting a new PR to fix this!

@rubenfonseca rubenfonseca self-assigned this Dec 18, 2023
@rubenfonseca rubenfonseca added event_handlers and removed triage Pending triage from maintainers labels Dec 18, 2023
@rubenfonseca rubenfonseca moved this from Triage to Working on it in Powertools for AWS Lambda (Python) Dec 18, 2023
@rubenfonseca rubenfonseca linked a pull request Dec 18, 2023 that will close this issue
7 tasks
@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in Powertools for AWS Lambda (Python) Dec 18, 2023
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Dec 18, 2023
Copy link
Contributor

This is now released under 2.30.2 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Dec 18, 2023
@rubenfonseca rubenfonseca moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Jan 3, 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 event_handlers
Projects
Status: Shipped
Development

Successfully merging a pull request may close this issue.

2 participants