diff --git a/prototypes/python/src/opentelemetry/configuration/__init__.py b/prototypes/python/src/opentelemetry/configuration/__init__.py index e10f9b5..afe051a 100644 --- a/prototypes/python/src/opentelemetry/configuration/__init__.py +++ b/prototypes/python/src/opentelemetry/configuration/__init__.py @@ -24,6 +24,7 @@ process_schema, render_schema, create_object, + load_configuration ) __all__ = [ @@ -32,4 +33,5 @@ "process_schema", "render_schema", "create_object", + "load_configuration" ] diff --git a/prototypes/python/src/opentelemetry/configuration/_internal/__init__.py b/prototypes/python/src/opentelemetry/configuration/_internal/__init__.py index 9b7dded..e93df4f 100644 --- a/prototypes/python/src/opentelemetry/configuration/_internal/__init__.py +++ b/prototypes/python/src/opentelemetry/configuration/_internal/__init__.py @@ -38,11 +38,14 @@ def resolve_schema(json_file_path) -> dict: return dictionary -def validate_configuration(configuration_file_path: str) -> dict: +def load_configuration(configuration_file_path: str) -> dict: with open(configuration_file_path, "r") as configuration_file: - configuration = safe_load(configuration_file) + return safe_load(configuration_file) + + +def validate_configuration(configuration: dict): root_path = Path(getcwd()).parent.parent @@ -63,10 +66,8 @@ def retrieve_from_path(path: str): registry=Registry(retrieve=retrieve_from_path) ).validate(configuration) - return configuration - -def process_schema(schema: dict): +def process_schema(schema: dict) -> dict: type_type = { "integer": "int", diff --git a/prototypes/python/tests/test_configuration.py b/prototypes/python/tests/test_configuration.py index 295e000..cbe1f38 100644 --- a/prototypes/python/tests/test_configuration.py +++ b/prototypes/python/tests/test_configuration.py @@ -19,6 +19,7 @@ process_schema, create_object, validate_configuration, + load_configuration, ) from pathlib import Path @@ -27,10 +28,12 @@ def test_create_object(): - configuration = validate_configuration( + configuration = load_configuration( data_path.joinpath("kitchen-sink.yaml") ) + validate_configuration(configuration) + processed_schema = process_schema( resolve_schema( data_path.joinpath("opentelemetry_configuration.json")