Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into seshubaws/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrodamascena committed Dec 18, 2023
2 parents 74fccd7 + 77a4a9d commit a741e7e
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 99 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@
<a name="unreleased"></a>
# Unreleased


<a name="v2.30.2"></a>
## [v2.30.2] - 2023-12-18
## Bug Fixes

* **event-handler:** fix operation tags schema generation ([#3528](https://github.com/aws-powertools/powertools-lambda-python/issues/3528))

## Maintenance

* version bump


<a name="v2.30.1"></a>
Expand Down Expand Up @@ -4177,7 +4185,8 @@
* Merge pull request [#5](https://github.com/aws-powertools/powertools-lambda-python/issues/5) from jfuss/feat/python38


[Unreleased]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.30.1...HEAD
[Unreleased]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.30.2...HEAD
[v2.30.2]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.30.1...v2.30.2
[v2.30.1]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.30.0...v2.30.1
[v2.30.0]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.29.1...v2.30.0
[v2.29.1]: https://github.com/aws-powertools/powertools-lambda-python/compare/v2.29.0...v2.29.1
Expand Down
8 changes: 4 additions & 4 deletions aws_lambda_powertools/event_handler/api_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def _openapi_operation_metadata(self, operation_ids: Set[str]) -> Dict[str, Any]

# Ensure tags is added to the operation
if self.tags:
operation["tags"] = [{"name": tag for tag in self.tags}]
operation["tags"] = self.tags

# Ensure summary is added to the operation
operation["summary"] = self._openapi_operation_summary()
Expand Down Expand Up @@ -1375,7 +1375,7 @@ def get_openapi_schema(
The title of the application.
version: str
The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API
openapi_version: str, default = "3.1.0"
openapi_version: str, default = "3.0.0"
The version of the OpenAPI Specification (which the document uses).
summary: str, optional
A short summary of what the application does.
Expand Down Expand Up @@ -1497,7 +1497,7 @@ def get_openapi_json_schema(
The title of the application.
version: str
The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API
openapi_version: str, default = "3.1.0"
openapi_version: str, default = "3.0.0"
The version of the OpenAPI Specification (which the document uses).
summary: str, optional
A short summary of what the application does.
Expand Down Expand Up @@ -1567,7 +1567,7 @@ def enable_swagger(
The title of the application.
version: str
The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API
openapi_version: str, default = "3.1.0"
openapi_version: str, default = "3.0.0"
The version of the OpenAPI Specification (which the document uses).
summary: str, optional
A short summary of what the application does.
Expand Down
4 changes: 2 additions & 2 deletions aws_lambda_powertools/event_handler/openapi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class Schema(BaseModel):
readOnly: Optional[bool] = None
writeOnly: Optional[bool] = None
examples: Optional[List["Example"]] = None
# Ref: OpenAPI 3.1.0: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object
# Ref: OpenAPI 3.0.0: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#schema-object
# Schema Object
discriminator: Optional[Discriminator] = None
xml: Optional[XML] = None
Expand Down Expand Up @@ -380,7 +380,7 @@ class Config:

# https://swagger.io/specification/#operation-object
class Operation(BaseModel):
tags: Optional[List[Tag]] = None
tags: Optional[List[str]] = None
summary: Optional[str] = None
description: Optional[str] = None
externalDocs: Optional[ExternalDocumentation] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def generate_swagger_html(spec: str, js_url: str, css_url: str) -> str:
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<meta
http-equiv="Cache-control"
content="no-cache, no-store, must-revalidate"
/>
<link rel="stylesheet" type="text/css" href="{css_url}">
</head>
Expand All @@ -34,6 +38,9 @@ def generate_swagger_html(spec: str, js_url: str, css_url: str) -> str:
docExpansion: "list",
deepLinking: true,
filter: true,
layout: "BaseLayout",
showExtensions: true,
showCommonExtensions: true,
spec: JSON.parse(`
{spec}
`.trim()),
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion aws_lambda_powertools/shared/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Exposes version constant to avoid circular dependencies."""

VERSION = "2.30.1"
VERSION = "2.30.2"
140 changes: 70 additions & 70 deletions docs/index.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/logger/sam/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Globals:
Layers:
# Find the latest Layer version in the official documentation
# https://docs.powertools.aws.dev/lambda/python/latest/#lambda-layer
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:57
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:58

Resources:
LoggerLambdaHandlerExample:
Expand Down
2 changes: 1 addition & 1 deletion examples/metrics/sam/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Globals:
Layers:
# Find the latest Layer version in the official documentation
# https://docs.powertools.aws.dev/lambda/python/latest/#lambda-layer
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:57
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:58

Resources:
CaptureLambdaHandlerExample:
Expand Down
2 changes: 1 addition & 1 deletion examples/tracer/sam/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Globals:
Layers:
# Find the latest Layer version in the official documentation
# https://docs.powertools.aws.dev/lambda/python/latest/#lambda-layer
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:57
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:58

Resources:
CaptureLambdaHandlerExample:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aws_lambda_powertools"
version = "2.30.1"
version = "2.30.2"
description = "Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless best practices and increase developer velocity."
authors = ["Amazon Web Services"]
include = ["aws_lambda_powertools/py.typed", "THIRD-PARTY-LICENSES"]
Expand Down
7 changes: 3 additions & 4 deletions tests/functional/event_handler/test_openapi_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
Parameter,
ParameterInType,
Schema,
Tag,
)
from aws_lambda_powertools.event_handler.openapi.params import (
Body,
Expand Down Expand Up @@ -119,7 +118,7 @@ def handler(
assert get.summary == "Get Users"
assert get.operationId == "GetUsers"
assert get.description == "Get paginated users"
assert get.tags == [Tag(name="Users")]
assert get.tags == ["Users"]

parameter = get.parameters[0]
assert parameter.required is False
Expand Down Expand Up @@ -378,7 +377,7 @@ def handler():
assert len(get.tags) == 1

tag = get.tags[0]
assert tag.name == "Users"
assert tag == "Users"


def test_openapi_with_excluded_operations():
Expand Down Expand Up @@ -421,7 +420,7 @@ def handler():
schema = app.get_openapi_schema()
tags = schema.paths["/example-resource"].put.tags
assert len(tags) == 1
assert tags[0].name == "Example"
assert tags[0] == "Example"


def test_create_header():
Expand Down

0 comments on commit a741e7e

Please sign in to comment.