Skip to content

Commit

Permalink
recursion limit adjustment
Browse files Browse the repository at this point in the history
Signed-off-by: Clemens Vasters <clemens@vasters.com>
  • Loading branch information
clemensv committed Mar 4, 2024
1 parent f03a9ba commit df74e13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 6 additions & 5 deletions avrotize/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def find_schema_node(test, avro_schema, recursion_stack = []):
for recursion_item in recursion_stack:
if avro_schema is recursion_item:
raise ValueError('Cyclical reference detected in schema')
if len(recursion_stack) > 30:
raise ValueError('Maximum recursion depth 30 exceeded in schema')
if len(recursion_stack) > 50:
raise ValueError('Maximum recursion depth 50 exceeded in schema')
try:
recursion_stack.append(avro_schema)
if isinstance(avro_schema, dict):
Expand All @@ -60,9 +60,10 @@ def find_schema_node(test, avro_schema, recursion_stack = []):
return node
elif isinstance(avro_schema, list):
for item in avro_schema:
node = find_schema_node(test, item, recursion_stack)
if node:
return node
if isinstance(item, (dict,list)):
node = find_schema_node(test, item, recursion_stack)
if node:
return node
return None
finally:
recursion_stack.pop()
Expand Down
1 change: 0 additions & 1 deletion test/test_jsontoavro.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def test_convert_avro_avsc_jsons_to_avro(self):
def test_convert_clouidify_jsons_to_avro(self):
self.create_avro_from_jsons("cloudify.json", "cloudify.avsc")

@pytest.mark.skip(reason="Recursion issue")
def test_convert_databricks_asset_bundles_to_avro(self):
self.create_avro_from_jsons("databricks-asset-bundles.json", "databricks-asset-bundles.avsc")

Expand Down

0 comments on commit df74e13

Please sign in to comment.