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

feat(event_handler): support richer top level Tags #3543

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

rubenfonseca
Copy link
Contributor

Issue number: #3533

Summary

Changes

Please provide a summary of what's being changed

This PR adds support for richer top level Tags, acording to the OpenAPI specification.

User experience

Please share what the user experience looks like before and after this change

This code:

from pydantic import AnyUrl

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")
def put():
    pass


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

Now produces the following OpenAPI json schema

{
  ...
  "tags": [
    {
      "name": "Example",
      "description": "This is a description",
      "externalDocs": {
        "description": "Example website",
        "url": "https://example.org"
      }
    }
  ]
}

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@rubenfonseca rubenfonseca requested a review from a team as a code owner December 20, 2023 15:53
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 20, 2023
@rubenfonseca rubenfonseca changed the title feat(event_handler): support richer Tags on OpenAPI object feat(event_handler): support richer top level Tags Dec 20, 2023
@rubenfonseca rubenfonseca linked an issue Dec 20, 2023 that may be closed by this pull request
@rubenfonseca rubenfonseca merged commit 1d13798 into develop Dec 20, 2023
15 checks passed
@rubenfonseca rubenfonseca deleted the rf/enhance-tags branch December 20, 2023 20:21
Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event_handlers size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: openAPI - support for top level tags metadata
2 participants