80
80
License ,
81
81
OpenAPI ,
82
82
Server ,
83
+ Tag ,
83
84
)
84
85
from aws_lambda_powertools .event_handler .openapi .params import Dependant
85
86
from aws_lambda_powertools .event_handler .openapi .types import (
@@ -1360,7 +1361,7 @@ def get_openapi_schema(
1360
1361
openapi_version : str = DEFAULT_OPENAPI_VERSION ,
1361
1362
summary : Optional [str ] = None ,
1362
1363
description : Optional [str ] = None ,
1363
- tags : Optional [List [str ]] = None ,
1364
+ tags : Optional [List [Union [ "Tag" , str ] ]] = None ,
1364
1365
servers : Optional [List ["Server" ]] = None ,
1365
1366
terms_of_service : Optional [str ] = None ,
1366
1367
contact : Optional ["Contact" ] = None ,
@@ -1381,7 +1382,7 @@ def get_openapi_schema(
1381
1382
A short summary of what the application does.
1382
1383
description: str, optional
1383
1384
A verbose explanation of the application behavior.
1384
- tags: List[str], optional
1385
+ tags: List[Tag | str], optional
1385
1386
A list of tags used by the specification with additional metadata.
1386
1387
servers: List[Server], optional
1387
1388
An array of Server Objects, which provide connectivity information to a target server.
@@ -1403,7 +1404,7 @@ def get_openapi_schema(
1403
1404
get_compat_model_name_map ,
1404
1405
get_definitions ,
1405
1406
)
1406
- from aws_lambda_powertools .event_handler .openapi .models import OpenAPI , PathItem , Server
1407
+ from aws_lambda_powertools .event_handler .openapi .models import OpenAPI , PathItem , Server , Tag
1407
1408
from aws_lambda_powertools .event_handler .openapi .types import (
1408
1409
COMPONENT_REF_TEMPLATE ,
1409
1410
)
@@ -1468,7 +1469,7 @@ def get_openapi_schema(
1468
1469
if components :
1469
1470
output ["components" ] = components
1470
1471
if tags :
1471
- output ["tags" ] = [{ " name" : tag } for tag in tags ]
1472
+ output ["tags" ] = [Tag ( name = tag ) if isinstance ( tag , str ) else tag for tag in tags ]
1472
1473
1473
1474
output ["paths" ] = {k : PathItem (** v ) for k , v in paths .items ()}
1474
1475
@@ -1482,7 +1483,7 @@ def get_openapi_json_schema(
1482
1483
openapi_version : str = DEFAULT_OPENAPI_VERSION ,
1483
1484
summary : Optional [str ] = None ,
1484
1485
description : Optional [str ] = None ,
1485
- tags : Optional [List [str ]] = None ,
1486
+ tags : Optional [List [Union [ "Tag" , str ] ]] = None ,
1486
1487
servers : Optional [List ["Server" ]] = None ,
1487
1488
terms_of_service : Optional [str ] = None ,
1488
1489
contact : Optional ["Contact" ] = None ,
@@ -1503,7 +1504,7 @@ def get_openapi_json_schema(
1503
1504
A short summary of what the application does.
1504
1505
description: str, optional
1505
1506
A verbose explanation of the application behavior.
1506
- tags: List[str], optional
1507
+ tags: List[Tag, str], optional
1507
1508
A list of tags used by the specification with additional metadata.
1508
1509
servers: List[Server], optional
1509
1510
An array of Server Objects, which provide connectivity information to a target server.
@@ -1548,7 +1549,7 @@ def enable_swagger(
1548
1549
openapi_version : str = DEFAULT_OPENAPI_VERSION ,
1549
1550
summary : Optional [str ] = None ,
1550
1551
description : Optional [str ] = None ,
1551
- tags : Optional [List [str ]] = None ,
1552
+ tags : Optional [List [Union [ "Tag" , str ] ]] = None ,
1552
1553
servers : Optional [List ["Server" ]] = None ,
1553
1554
terms_of_service : Optional [str ] = None ,
1554
1555
contact : Optional ["Contact" ] = None ,
@@ -1573,7 +1574,7 @@ def enable_swagger(
1573
1574
A short summary of what the application does.
1574
1575
description: str, optional
1575
1576
A verbose explanation of the application behavior.
1576
- tags: List[str], optional
1577
+ tags: List[Tag, str], optional
1577
1578
A list of tags used by the specification with additional metadata.
1578
1579
servers: List[Server], optional
1579
1580
An array of Server Objects, which provide connectivity information to a target server.
0 commit comments