Skip to content

Commit

Permalink
WIP, trying to figure out how to handle arguments to create objects
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Nov 9, 2023
1 parent d345d89 commit 8371e09
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,32 +393,43 @@ def write_schema_paths_functions(
)


def create_configuration_objects(configuration_dictionary):
def create_configuration_objects(configuration_dictionary, schema_paths):

def traverse(dictionary, path):
set_trace()

def traverse(dictionary, path, schema_paths):

print(path)

for dictionary_key, dictionary_value in dictionary.items():

if isinstance(dictionary_value, dict):

path.append(dictionary_key.lower())

if "/".join(path) in path_function.keys():
schema_path = "/".join(path)

if "processors" in path:
set_trace()

if schema_path in path_function.keys():
set_trace

traverse(
dictionary_value,
path
path,
schema_paths
)
path.pop()

elif isinstance(dictionary, list):
elif isinstance(dictionary_value, list):

path.append(dictionary_key.lower())

for element in dictionary:
traverse(element, path)
for element in dictionary_value:
if isinstance(element, dict):
traverse(element, path, schema_paths)

path.pop()

traverse(configuration_dictionary, [])
traverse(configuration_dictionary, [], schema_paths)
7 changes: 6 additions & 1 deletion prototypes/python/tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ def test_create_configuration_objects():

configuration = YAMLParser().parse(data_path.joinpath("kitchen-sink.yaml"))

create_configuration_objects(configuration)
result = resolve_schema(
data_path.joinpath("opentelemetry_configuration.json")
)

result = get_schema_paths(result)
create_configuration_objects(configuration, result)


def test_bad_attribute_limits():
Expand Down

0 comments on commit 8371e09

Please sign in to comment.