Commit 7e56fe1
feat(event_handler): add custom response validation in OpenAPI utility (#6189)
* feat(openapi-validation): Add response validation flag and distinct exception.
* feat(api-gateway-resolver): Add option for custom response validation error status code.
* feat(docs): Added doc for custom response validation error responses.
* refactor(docs): Make exception handler function name better.
* feat(unit-test): Add tests for custom response validation error.
* fix: Formatting.
* fix(docs): Fix grammar in response validation docs
* fix(unit-test): fix failed CI.
* bugfix(lint): Ignore lint error FA102, irrelevant for python >=3.9
* refactor: make response_validation_error_http_status accept more types and add more detailed error messages.
* feat(unit-test): add tests for incorrect types and invalid configs
* refactor: rename response_validation_error_http_status to response_validation_error_http_code
* refactor(api_gateway): add method for validating response_validation_error_http_code param.
* fix(api_gateway): fix type and docstring for response_validation_error_http_code param.
* fix(api_gateway): remove unncessary check of response_validation_error_http_code param being None.
* fix(openapi-validation): docstring for has_response_validation_error param.
* refactor(tests): move unit tests into openapi_validation functional test file
* fix(tests): skipping validation for falsy response
* Refactoring documentation
---------
Co-authored-by: Amin Farjadi <amin.farjadi@eonnext.com>
Co-authored-by: Leandro Damascena <lcdama@amazon.pt>1 parent bba7e5c commit 7e56fe1
File tree
9 files changed
+488
-10
lines changed- aws_lambda_powertools/event_handler
- middlewares
- openapi
- docs/core/event_handler
- examples/event_handler_rest/src
- tests/functional/event_handler/_pydantic
9 files changed
+488
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| |||
1496 | 1500 | | |
1497 | 1501 | | |
1498 | 1502 | | |
| 1503 | + | |
1499 | 1504 | | |
1500 | 1505 | | |
1501 | 1506 | | |
| |||
1515 | 1520 | | |
1516 | 1521 | | |
1517 | 1522 | | |
| 1523 | + | |
| 1524 | + | |
1518 | 1525 | | |
1519 | 1526 | | |
1520 | 1527 | | |
| |||
1530 | 1537 | | |
1531 | 1538 | | |
1532 | 1539 | | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
1533 | 1545 | | |
1534 | 1546 | | |
1535 | 1547 | | |
| |||
1539 | 1551 | | |
1540 | 1552 | | |
1541 | 1553 | | |
1542 | | - | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
1543 | 1588 | | |
1544 | 1589 | | |
1545 | 1590 | | |
| |||
2370 | 2415 | | |
2371 | 2416 | | |
2372 | 2417 | | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
2373 | 2433 | | |
2374 | 2434 | | |
2375 | 2435 | | |
| |||
2582 | 2642 | | |
2583 | 2643 | | |
2584 | 2644 | | |
| 2645 | + | |
2585 | 2646 | | |
2586 | 2647 | | |
2587 | 2648 | | |
| |||
2591 | 2652 | | |
2592 | 2653 | | |
2593 | 2654 | | |
| 2655 | + | |
2594 | 2656 | | |
2595 | 2657 | | |
2596 | 2658 | | |
| |||
2664 | 2726 | | |
2665 | 2727 | | |
2666 | 2728 | | |
| 2729 | + | |
2667 | 2730 | | |
2668 | 2731 | | |
2669 | 2732 | | |
| |||
2673 | 2736 | | |
2674 | 2737 | | |
2675 | 2738 | | |
| 2739 | + | |
2676 | 2740 | | |
2677 | 2741 | | |
2678 | 2742 | | |
| |||
2701 | 2765 | | |
2702 | 2766 | | |
2703 | 2767 | | |
| 2768 | + | |
2704 | 2769 | | |
2705 | 2770 | | |
2706 | | - | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
2707 | 2780 | | |
2708 | 2781 | | |
2709 | 2782 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
| |||
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
70 | 78 | | |
71 | 79 | | |
| 80 | + | |
72 | 81 | | |
73 | 82 | | |
74 | 83 | | |
| |||
164 | 173 | | |
165 | 174 | | |
166 | 175 | | |
| 176 | + | |
| 177 | + | |
167 | 178 | | |
168 | 179 | | |
169 | 180 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
26 | 36 | | |
27 | 37 | | |
28 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
59 | 70 | | |
60 | 71 | | |
61 | 72 | | |
| |||
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
| 116 | + | |
105 | 117 | | |
106 | 118 | | |
107 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
108 | 128 | | |
109 | 129 | | |
110 | 130 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | | - | |
325 | | - | |
326 | 324 | | |
327 | 325 | | |
328 | 326 | | |
| |||
398 | 396 | | |
399 | 397 | | |
400 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
401 | 420 | | |
402 | 421 | | |
403 | 422 | | |
| |||
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments