1
- import pytest
2
1
import json
2
+
3
3
from typing_extensions import Annotated
4
4
5
5
from aws_lambda_powertools .event_handler import APIGatewayRestResolver
@@ -35,7 +35,7 @@ def upload_multiple_files(
35
35
36
36
# Generate OpenAPI schema
37
37
schema = app .get_openapi_schema ()
38
-
38
+
39
39
# Print schema for debugging
40
40
schema_dict = schema .model_dump ()
41
41
print ("SCHEMA PATHS:" )
@@ -46,27 +46,28 @@ def upload_multiple_files(
46
46
if "content" in path_item ["post" ]["requestBody" ]:
47
47
if "multipart/form-data" in path_item ["post" ]["requestBody" ]["content" ]:
48
48
print (" Found multipart/form-data" )
49
- print (f" Schema: { json .dumps (path_item ['post' ]['requestBody' ]['content' ]['multipart/form-data' ], indent = 2 )} " )
50
-
49
+ content = path_item ["post" ]["requestBody" ]["content" ]["multipart/form-data" ]
50
+ print (f" Schema: { json .dumps (content , indent = 2 )} " )
51
+
51
52
print ("\n SCHEMA COMPONENTS:" )
52
53
if "components" in schema_dict and "schemas" in schema_dict ["components" ]:
53
54
for name , comp_schema in schema_dict ["components" ]["schemas" ].items ():
54
55
if "file" in name .lower () or "upload" in name .lower ():
55
56
print (f"Component: { name } " )
56
57
print (f" { json .dumps (comp_schema , indent = 2 )} " )
57
-
58
+
58
59
# Basic verification
59
60
paths = schema .paths
60
61
assert "/upload-single" in paths
61
62
assert "/upload-multiple" in paths
62
-
63
+
63
64
# Verify upload-single endpoint exists
64
65
upload_single = paths ["/upload-single" ]
65
66
assert upload_single .post is not None
66
-
67
+
67
68
# Verify upload-multiple endpoint exists
68
69
upload_multiple = paths ["/upload-multiple" ]
69
70
assert upload_multiple .post is not None
70
-
71
+
71
72
# Print success
72
73
print ("\n ✅ Basic OpenAPI schema generation tests passed" )
0 commit comments