Classgen: forward item types for array types

This commit is contained in:
Johannes Kirschbauer
2024-11-08 13:20:45 +01:00
parent 4994b5acb5
commit 16b0592d0f
2 changed files with 5 additions and 2 deletions

View File

@@ -36,4 +36,4 @@ class Inventory:
meta: Meta
machines: dict[str, Machine] = field(default_factory = dict)
services: dict[str, Service] = field(default_factory = dict)
tags: dict[str, list[Any]] = field(default_factory = dict)
tags: dict[str, list[str]] = field(default_factory = dict)

View File

@@ -24,7 +24,10 @@ def map_json_type(
res |= map_json_type(t)
return res
if isinstance(json_type, dict):
return map_json_type(json_type.get("type"))
items = json_type.get("items")
if items:
nested_types = map_json_type(items)
return map_json_type(json_type.get("type"), nested_types)
if json_type == "string":
return {"str"}
if json_type == "integer":