AWS Security ChangesHomeSearch

AWS powertools documentation change

Service: powertools · 2026-07-01 · Documentation low

File: powertools/python/latest/api_doc/event_handler/openapi.md

Summary

Added documentation links for Circuit Breaker utility and updated parameter handling logic for Pydantic Field annotations in OpenAPI event handler

Security assessment

Changes involve adding navigation links to Circuit Breaker documentation and refactoring parameter validation logic to better handle Pydantic Field annotations. No security vulnerabilities, exploits, or security features are mentioned in the changes.

Diff

diff --git a/powertools/python/latest/api_doc/event_handler/openapi.md b/powertools/python/latest/api_doc/event_handler/openapi.md
index 8ce3c1cdd..78aea5de3 100644
--- a//powertools/python/latest/api_doc/event_handler/openapi.md
+++ b//powertools/python/latest/api_doc/event_handler/openapi.md
@@ -56,0 +57 @@ Metrics
+      * [ Circuit Breaker  ](../../../utilities/circuit_breaker/)
@@ -190,0 +192,6 @@ Build recipes
+    * Circuit Breaker (alpha)  Circuit Breaker (alpha) 
+      * [ Circuit Breaker  ](../../circuit_breaker_alpha/circuit_breaker/)
+      * [ Config  ](../../circuit_breaker_alpha/config/)
+      * [ States  ](../../circuit_breaker_alpha/states/)
+      * [ Exceptions  ](../../circuit_breaker_alpha/exceptions/)
+      * [ Persistence  ](../../circuit_breaker_alpha/persistence/)
@@ -4636,2 +4642,0 @@ Source code in `aws_lambda_powertools/event_handler/openapi/params.py`
-    1076
-    1077
@@ -4657,0 +4663,2 @@ Source code in `aws_lambda_powertools/event_handler/openapi/params.py`
+    1098
+    1099
@@ -4773,0 +4781,2 @@ Source code in `aws_lambda_powertools/event_handler/openapi/params.py`
+    1018
+    1019
@@ -4827,0 +4837,2 @@ Source code in `aws_lambda_powertools/event_handler/openapi/params.py`
+    1074
+    1075
@@ -4858 +4869,3 @@ Source code in `aws_lambda_powertools/event_handler/openapi/params.py`
-        has_discriminator_with_param = False
+        # When a plain Pydantic Field is paired with a location marker (e.g. Field(gt=0) + Query),
+        # we keep the full Annotated type as the annotation so the Field's metadata still validates.
+        preserve_full_annotation = False
@@ -4861,4 +4874,5 @@ Source code in `aws_lambda_powertools/event_handler/openapi/params.py`
-            powertools_annotation, type_annotation, has_discriminator_with_param = _handle_discriminator_with_param(
-                powertools_annotations,
-                annotation,
-            )
+            # A location marker (Path/Query/Header/Body) plus a plain Pydantic Field carrying
+            # constraints, a discriminator, or any other Field setting. The marker says where the
+            # value comes from; the Field says how to validate it.
+            powertools_annotation, _ = _split_location_marker_and_field(powertools_annotations)
+            preserve_full_annotation = True
@@ -4872 +4886 @@ Source code in `aws_lambda_powertools/event_handler/openapi/params.py`
-        if other_metadata and not has_discriminator_with_param:
+        if other_metadata and not preserve_full_annotation:
@@ -4877,2 +4891,5 @@ Source code in `aws_lambda_powertools/event_handler/openapi/params.py`
-        if isinstance(powertools_annotation, FieldInfo):  # pragma: no cover
-            field_info = _create_field_info(powertools_annotation, type_annotation, has_discriminator_with_param)
+        if isinstance(powertools_annotation, FieldInfo):
+            # When pairing a location marker with a plain Field, hand the full Annotated[...] to the
+            # field so the Field's constraints/discriminator flow into the validating TypeAdapter.
+            field_annotation = annotation if preserve_full_annotation else type_annotation
+            field_info = _create_field_info(powertools_annotation, field_annotation, preserve_full_annotation)
@@ -4880,4 +4897,2 @@ Source code in `aws_lambda_powertools/event_handler/openapi/params.py`
-    
-            # Preserve full annotated type for discriminated unions
-            if _has_discriminator(powertools_annotation):  # pragma: no cover
-                type_annotation = annotation  # pragma: no cover
+            if preserve_full_annotation:
+                type_annotation = annotation