Skip to content

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

Closed
@danikenan

Description

@danikenan

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

Activity

added
bugSomething isn't working
triagePending triage from maintainers
on Dec 15, 2023
boring-cyborg

boring-cyborg commented on Dec 15, 2023

@boring-cyborg

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

rubenfonseca commented on Dec 18, 2023

@rubenfonseca
Contributor

Looking at this now

rubenfonseca

rubenfonseca commented on Dec 18, 2023

@rubenfonseca
Contributor

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

self-assigned this
on Dec 18, 2023
moved this from Triage to Working on it in Powertools for AWS Lambda (Python)on Dec 18, 2023
github-actions

github-actions commented on Dec 18, 2023

@github-actions
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 commented on Dec 18, 2023

@github-actions
Contributor

This is now released under 2.30.2 version!

moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python)on Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

    Participants

    @rubenfonseca@danikenan

    Issue actions

      Bug: swagger ui try out bugs with simple query string params · Issue #3515 · aws-powertools/powertools-lambda-python