8080 License ,
8181 OpenAPI ,
8282 Server ,
83+ Tag ,
8384 )
8485 from aws_lambda_powertools .event_handler .openapi .params import Dependant
8586 from aws_lambda_powertools .event_handler .openapi .types import (
@@ -1360,7 +1361,7 @@ def get_openapi_schema(
13601361 openapi_version : str = DEFAULT_OPENAPI_VERSION ,
13611362 summary : Optional [str ] = None ,
13621363 description : Optional [str ] = None ,
1363- tags : Optional [List [str ]] = None ,
1364+ tags : Optional [List [Union [ "Tag" , str ] ]] = None ,
13641365 servers : Optional [List ["Server" ]] = None ,
13651366 terms_of_service : Optional [str ] = None ,
13661367 contact : Optional ["Contact" ] = None ,
@@ -1381,7 +1382,7 @@ def get_openapi_schema(
13811382 A short summary of what the application does.
13821383 description: str, optional
13831384 A verbose explanation of the application behavior.
1384- tags: List[str], optional
1385+ tags: List[Tag | str], optional
13851386 A list of tags used by the specification with additional metadata.
13861387 servers: List[Server], optional
13871388 An array of Server Objects, which provide connectivity information to a target server.
@@ -1403,7 +1404,7 @@ def get_openapi_schema(
14031404 get_compat_model_name_map ,
14041405 get_definitions ,
14051406 )
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
14071408 from aws_lambda_powertools .event_handler .openapi .types import (
14081409 COMPONENT_REF_TEMPLATE ,
14091410 )
@@ -1468,7 +1469,7 @@ def get_openapi_schema(
14681469 if components :
14691470 output ["components" ] = components
14701471 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 ]
14721473
14731474 output ["paths" ] = {k : PathItem (** v ) for k , v in paths .items ()}
14741475
@@ -1482,7 +1483,7 @@ def get_openapi_json_schema(
14821483 openapi_version : str = DEFAULT_OPENAPI_VERSION ,
14831484 summary : Optional [str ] = None ,
14841485 description : Optional [str ] = None ,
1485- tags : Optional [List [str ]] = None ,
1486+ tags : Optional [List [Union [ "Tag" , str ] ]] = None ,
14861487 servers : Optional [List ["Server" ]] = None ,
14871488 terms_of_service : Optional [str ] = None ,
14881489 contact : Optional ["Contact" ] = None ,
@@ -1503,7 +1504,7 @@ def get_openapi_json_schema(
15031504 A short summary of what the application does.
15041505 description: str, optional
15051506 A verbose explanation of the application behavior.
1506- tags: List[str], optional
1507+ tags: List[Tag, str], optional
15071508 A list of tags used by the specification with additional metadata.
15081509 servers: List[Server], optional
15091510 An array of Server Objects, which provide connectivity information to a target server.
@@ -1548,7 +1549,7 @@ def enable_swagger(
15481549 openapi_version : str = DEFAULT_OPENAPI_VERSION ,
15491550 summary : Optional [str ] = None ,
15501551 description : Optional [str ] = None ,
1551- tags : Optional [List [str ]] = None ,
1552+ tags : Optional [List [Union [ "Tag" , str ] ]] = None ,
15521553 servers : Optional [List ["Server" ]] = None ,
15531554 terms_of_service : Optional [str ] = None ,
15541555 contact : Optional ["Contact" ] = None ,
@@ -1573,7 +1574,7 @@ def enable_swagger(
15731574 A short summary of what the application does.
15741575 description: str, optional
15751576 A verbose explanation of the application behavior.
1576- tags: List[str], optional
1577+ tags: List[Tag, str], optional
15771578 A list of tags used by the specification with additional metadata.
15781579 servers: List[Server], optional
15791580 An array of Server Objects, which provide connectivity information to a target server.
0 commit comments