diff --git a/splunk_add_on_ucc_framework/commands/openapi_generator/ucc_to_oas.py b/splunk_add_on_ucc_framework/commands/openapi_generator/ucc_to_oas.py index b9fdc9c97..2c60e371a 100644 --- a/splunk_add_on_ucc_framework/commands/openapi_generator/ucc_to_oas.py +++ b/splunk_add_on_ucc_framework/commands/openapi_generator/ucc_to_oas.py @@ -412,6 +412,9 @@ def __add_user_defined_paths( open_api_object: OpenAPIObject, global_config: global_config_lib.GlobalConfig, ) -> OpenAPIObject: + """ + Adds user defined paths (globalConfig["options"]["restHandlers"]) to the OpenAPI object. + """ if open_api_object.paths is None: open_api_object.paths = {} diff --git a/splunk_add_on_ucc_framework/commands/rest_builder/user_defined_rest_handlers.py b/splunk_add_on_ucc_framework/commands/rest_builder/user_defined_rest_handlers.py index 2b933b554..7afa71131 100644 --- a/splunk_add_on_ucc_framework/commands/rest_builder/user_defined_rest_handlers.py +++ b/splunk_add_on_ucc_framework/commands/rest_builder/user_defined_rest_handlers.py @@ -66,6 +66,10 @@ def _eai_response_schema(schema: Any) -> oas.MediaTypeObject: @dataclass class RestHandlerConfig: + """ + Represents a REST handler configuration. See schema.json. + """ + name: str endpoint: str handlerType: str @@ -268,6 +272,10 @@ def oas_paths(self) -> Dict[str, oas.PathItemObject]: class UserDefinedRestHandlers: + """ + Represents a logic for dealing with user-defined REST handlers + """ + def __init__(self) -> None: self._definitions: List[RestHandlerConfig] = [] self._names: Set[str] = set() diff --git a/splunk_add_on_ucc_framework/global_config.py b/splunk_add_on_ucc_framework/global_config.py index e2304fe59..f36387eb1 100644 --- a/splunk_add_on_ucc_framework/global_config.py +++ b/splunk_add_on_ucc_framework/global_config.py @@ -82,6 +82,7 @@ def __init__(self, global_config_path: str) -> None: self.user_defined_handlers = UserDefinedRestHandlers() def parse_user_defined_handlers(self) -> None: + """Parse user-defined REST handlers from globalConfig["options"]["restHandlers"]""" rest_handlers = self._content.get("options", {}).get("restHandlers", []) self.user_defined_handlers.add_definitions(rest_handlers)