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: get_openapi_json_schema() default openapi version 3.0.0 #3519

Closed
MCR2019 opened this issue Dec 15, 2023 · 4 comments · Fixed by #3527
Closed

Bug: get_openapi_json_schema() default openapi version 3.0.0 #3519

MCR2019 opened this issue Dec 15, 2023 · 4 comments · Fixed by #3527
Assignees
Labels
bug Something isn't working event_handlers

Comments

@MCR2019
Copy link

MCR2019 commented Dec 15, 2023

Expected Behaviour

api_gateway.py docstring on line 1500 states:

"""
openapi_version: str, default = "3.1.0"
The version of the OpenAPI Specification (which the document uses).
"""

When creating a openapi json schema with no openapi_version specified it is expected that the version defaults to 3.1.0.

Current Behaviour

When creating an openpi json schema with no openapi version specified (openapi_version) it defaults to 3.0.0.

Code snippet

from aws_lambda_powertools.event_handler import APIGatewayRestResolver

app = APIGatewayRestResolver(enable_validation=True)


@app.put(
    "/example-resource",
    responses={200: {"description": "Todo item found"}},
    tags=["Examples"]
)
def put():
    pass


if __name__ == "__main__":
    print(app.get_openapi_json_schema())

Possible Solution

Either update the docstring or update the constant: DEFAULT_OPENAPI_VERSION = "3.0.0"

Steps to Reproduce

Create an openapi json schema with no openapi_version specified and view the output.

Powertools for AWS Lambda (Python) version

2.30.1

AWS Lambda function runtime

3.10

Packaging format used

PyPi

Debugging logs

No response

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

Awesome catch! Fixing it now.

@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 linked a pull request Dec 18, 2023 that will close this issue
7 tasks
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.

@rubenfonseca
Copy link
Contributor

Your effort to ensure consistency across our documentation regarding the default OpenAPI version is much appreciated. It's great to see the clarification that version 3.0.0 is supported by default. Your contributions help make our documentation clearer for everyone. Thanks again for your diligent work!

@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
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