Skip to content

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

Closed

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

  1. added
    bug
    triage
    on Dec 15, 2023
  2. 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

  3. rubenfonseca commented on Dec 18, 2023

    @rubenfonseca
    Contributor

    Looking at this now

  4. 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!

  5. self-assigned this
    on Dec 18, 2023
  6. added and removed
    triage
    on Dec 18, 2023
  7. moved this from Triage to Working on it in Powertools for AWS Lambda (Python)on Dec 18, 2023
  8. 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.

  9. added
    pending-release
    on Dec 18, 2023
  10. github-actions commented on Dec 18, 2023

    @github-actions
    Contributor

    This is now released under 2.30.2 version!

  11. removed
    pending-release
    on Dec 18, 2023
  12. 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

bugevent_handlers

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions