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

Feature request: openAPI - support for top level tags metadata #3533

Closed
MCR2019 opened this issue Dec 18, 2023 · 5 comments · Fixed by #3543
Closed

Feature request: openAPI - support for top level tags metadata #3533

MCR2019 opened this issue Dec 18, 2023 · 5 comments · Fixed by #3543
Assignees
Labels

Comments

@MCR2019
Copy link

MCR2019 commented Dec 18, 2023

Expected Behaviour

tag objects should support optional metadata such as description and externalDocs as in the openAPI spec: OAS

image

(just adding the description would be great)

Current Behaviour

Currently only the required tag name is supported.

Code snippet

from aws_lambda_powertools.event_handler import APIGatewayRestResolver

app = APIGatewayRestResolver(enable_validation=True)


@app.put(
    "/example-resource",
    tags=["Example Tag"]
)
def put():
    pass


if __name__ == "__main__":
    print(app.get_openapi_json_schema(
        tags=["Example Tag"]
    ))

Possible Solution

No response

Steps to Reproduce

  • Create an operation and specify a tag.
  • There is no way to specify anything other than the tag name

Powertools for AWS Lambda (Python) version

2.30.2

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 18, 2023
@rubenfonseca
Copy link
Contributor

Looking at this now

@leandrodamascena leandrodamascena added feature-request feature request event_handlers and removed bug Something isn't working labels Dec 19, 2023
@leandrodamascena leandrodamascena changed the title Bug: openAPI generation - support for tags metadata Feature request: openAPI generation - support for tags metadata Dec 19, 2023
@leandrodamascena
Copy link
Contributor

I am classifying this issue as a feature request instead of a bug and assigning it to @rubenfonseca.

@rubenfonseca
Copy link
Contributor

Hi @MCR2019 thank you for opening this issue. It seems our top level OpenAPI object is only supporting strings at the moment.

Please notice that according to the spec, tags in Operations are just lists of strings. The only place where a Tag is an object with additional fields is on the top level OpenAPI object:

from aws_lambda_powertools.event_handler import APIGatewayRestResolver
from aws_lambda_powertools.event_handler.openapi.models import ExternalDocumentation, Tag

app = APIGatewayRestResolver(enable_validation=True)


@app.put("/example-resource", tags=["Example Tag"])
def put():
    pass


if __name__ == "__main__":
    print(
        app.get_openapi_json_schema(
            tags=[
                Tag(
                    name="Example",
                    description="This is a description",
                    externalDocs=ExternalDocumentation(url="https://example.org", description="Example website"),
                )
            ]
        )
    )

I'll be working on adding support for this.

@rubenfonseca rubenfonseca removed the triage Pending triage from maintainers label Dec 19, 2023
@rubenfonseca rubenfonseca moved this from Backlog to Working on it in Powertools for AWS Lambda (Python) Dec 19, 2023
@rubenfonseca rubenfonseca changed the title Feature request: openAPI generation - support for tags metadata Feature request: openAPI - support for top level tags metadata Dec 19, 2023
@rubenfonseca rubenfonseca linked a pull request Dec 20, 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 20, 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 20, 2023
Copy link
Contributor

github-actions bot commented Jan 5, 2024

This is now released under 2.31.0 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Jan 5, 2024
@leandrodamascena leandrodamascena moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Shipped
Development

Successfully merging a pull request may close this issue.

3 participants