digitalkin 0.3.2.dev28__py3-none-any.whl → 0.3.2.dev30__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
digitalkin/__version__.py CHANGED
@@ -5,4 +5,4 @@ from importlib.metadata import PackageNotFoundError, version
5
5
  try:
6
6
  __version__ = version("digitalkin")
7
7
  except PackageNotFoundError:
8
- __version__ = "0.3.2.dev28"
8
+ __version__ = "0.3.2.dev30"
@@ -58,10 +58,19 @@ class SchemaSplitter:
58
58
  cls._extract_ui_properties(value, items_ui, defs)
59
59
  if items_ui:
60
60
  ui_target["items"] = items_ui
61
- elif key == "allOf" and isinstance(value, list):
62
- for item in value:
63
- if isinstance(item, dict):
64
- cls._extract_ui_properties(item, ui_target, defs)
61
+ elif key in {"allOf", "oneOf", "anyOf"} and isinstance(value, list):
62
+ # For oneOf/anyOf, create a mirrored structure in ui_target
63
+ if key in {"oneOf", "anyOf"}:
64
+ ui_target[key] = []
65
+ for item in value:
66
+ if isinstance(item, dict):
67
+ item_ui: dict[str, Any] = {}
68
+ cls._extract_ui_properties(item, item_ui, defs)
69
+ ui_target[key].append(item_ui)
70
+ else: # allOf - merge into parent
71
+ for item in value:
72
+ if isinstance(item, dict):
73
+ cls._extract_ui_properties(item, ui_target, defs)
65
74
  elif key in {"if", "then", "else"} and isinstance(value, dict):
66
75
  cls._extract_ui_properties(value, ui_target, defs)
67
76
  elif key == "$ref" and isinstance(value, str) and defs is not None and value.startswith("#/$defs/"):
@@ -71,7 +80,7 @@ class SchemaSplitter:
71
80
  cls._extract_ui_properties(defs[def_name], ui_target, defs)
72
81
 
73
82
  @classmethod
74
- def _process_object( # noqa: C901, PLR0912
83
+ def _process_object( # noqa: C901, PLR0912, PLR0915
75
84
  cls,
76
85
  source: dict[str, Any],
77
86
  json_target: dict[str, Any],
@@ -123,13 +132,27 @@ class SchemaSplitter:
123
132
  json_target["allOf"] = []
124
133
  for item in value:
125
134
  if isinstance(item, dict):
126
- item_json: dict[str, Any] = {}
127
- cls._strip_ui_properties(item, item_json)
128
- json_target["allOf"].append(item_json)
135
+ item_json_all_of: dict[str, Any] = {}
136
+ cls._strip_ui_properties(item, item_json_all_of)
137
+ json_target["allOf"].append(item_json_all_of)
129
138
  # Extract UI properties from allOf item
130
139
  cls._extract_ui_properties(item, ui_target, schema_defs)
131
140
  else:
132
141
  json_target["allOf"].append(item)
142
+ elif key in {"oneOf", "anyOf"} and isinstance(value, list):
143
+ json_target[key] = []
144
+ ui_target[key] = [] # Mirror structure in ui_schema
145
+ for item in value:
146
+ if isinstance(item, dict):
147
+ item_json_oneof_anyof: dict[str, Any] = {}
148
+ cls._strip_ui_properties(item, item_json_oneof_anyof)
149
+ json_target[key].append(item_json_oneof_anyof)
150
+ # Extract UI properties into a separate dict for this variant
151
+ item_ui_oneof_anyof: dict[str, Any] = {}
152
+ cls._extract_ui_properties(item, item_ui_oneof_anyof, schema_defs)
153
+ ui_target[key].append(item_ui_oneof_anyof)
154
+ else:
155
+ json_target[key].append(item)
133
156
  elif key in {"if", "then", "else"} and isinstance(value, dict):
134
157
  json_target[key] = {}
135
158
  cls._strip_ui_properties(value, json_target[key])
@@ -187,6 +210,22 @@ class SchemaSplitter:
187
210
  cls._process_property(value, json_target["items"], items_ui, defs_ui)
188
211
  if items_ui:
189
212
  ui_target["items"] = items_ui
213
+ elif key in {"oneOf", "anyOf"} and isinstance(value, list):
214
+ json_target[key] = []
215
+ ui_target[key] = [] # Mirror structure in ui_schema
216
+ for item in value:
217
+ if isinstance(item, dict):
218
+ item_json_oneof_anyof: dict[str, Any] = {}
219
+ cls._strip_ui_properties(item, item_json_oneof_anyof)
220
+ json_target[key].append(item_json_oneof_anyof)
221
+ # Extract UI properties for this variant
222
+ item_ui_oneof_anyof: dict[str, Any] = {}
223
+ ref_path = item.get("$ref", "")
224
+ if ref_path.startswith("#/$defs/") and ref_path[8:] in defs_ui:
225
+ item_ui_oneof_anyof.update(defs_ui[ref_path[8:]])
226
+ ui_target[key].append(item_ui_oneof_anyof)
227
+ else:
228
+ json_target[key].append(item)
190
229
  elif key == "hidden":
191
230
  # Strip hidden key from json schema
192
231
  continue
@@ -230,11 +269,20 @@ class SchemaSplitter:
230
269
  json_target["allOf"] = []
231
270
  for item in value:
232
271
  if isinstance(item, dict):
233
- item_json: dict[str, Any] = {}
234
- cls._strip_ui_properties(item, item_json)
235
- json_target["allOf"].append(item_json)
272
+ item_json_all_of: dict[str, Any] = {}
273
+ cls._strip_ui_properties(item, item_json_all_of)
274
+ json_target["allOf"].append(item_json_all_of)
236
275
  else:
237
276
  json_target["allOf"].append(item)
277
+ elif key in {"oneOf", "anyOf"} and isinstance(value, list):
278
+ json_target[key] = []
279
+ for item in value:
280
+ if isinstance(item, dict):
281
+ item_json_oneof_anyof: dict[str, Any] = {}
282
+ cls._strip_ui_properties(item, item_json_oneof_anyof)
283
+ json_target[key].append(item_json_oneof_anyof)
284
+ else:
285
+ json_target[key].append(item)
238
286
  elif key in {"if", "then", "else"} and isinstance(value, dict):
239
287
  json_target[key] = {}
240
288
  cls._strip_ui_properties(value, json_target[key])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: digitalkin
3
- Version: 0.3.2.dev28
3
+ Version: 0.3.2.dev30
4
4
  Summary: SDK to build kin used in DigitalKin
5
5
  Author-email: "DigitalKin.ai" <contact@digitalkin.ai>
6
6
  License: Attribution-NonCommercial-ShareAlike 4.0 International
@@ -7,7 +7,7 @@ base_server/mock/__init__.py,sha256=YZFT-F1l_TpvJYuIPX-7kTeE1CfOjhx9YmNRXVoi-jQ,
7
7
  base_server/mock/mock_pb2.py,sha256=sETakcS3PAAm4E-hTCV1jIVaQTPEAIoVVHupB8Z_k7Y,1843
8
8
  base_server/mock/mock_pb2_grpc.py,sha256=BbOT70H6q3laKgkHfOx1QdfmCS_HxCY4wCOX84YAdG4,3180
9
9
  digitalkin/__init__.py,sha256=7LLBAba0th-3SGqcpqFO-lopWdUkVLKzLZiMtB-mW3M,162
10
- digitalkin/__version__.py,sha256=6iGJUSWdUJ2iwJ1TLCMXC_k2mRKmytScG0f_7FAyFlo,196
10
+ digitalkin/__version__.py,sha256=ae9RK0HSLfcT6PpMoP-U9CLQQeJH7Ej6t5Jw6ZGL7t8,196
11
11
  digitalkin/logger.py,sha256=8ze_tjt2G6mDTuQcsf7-UTXWP3UHZ7LZVSs_iqF4rX4,4685
12
12
  digitalkin/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  digitalkin/core/__init__.py,sha256=FJRcJ-B1Viyn-38L8XpOpZ8KOnf1I7PCDOAmKXLQhqc,71
@@ -122,8 +122,8 @@ digitalkin/utils/development_mode_action.py,sha256=2hznh0ajW_4ZTysfoc0Y49161f_PQ
122
122
  digitalkin/utils/dynamic_schema.py,sha256=y5csxjuqVHjWDpnTUzxbcUuI_wou9-ibRVHQlBs_btY,15275
123
123
  digitalkin/utils/llm_ready_schema.py,sha256=JjMug_lrQllqFoanaC091VgOqwAd-_YzcpqFlS7p778,2375
124
124
  digitalkin/utils/package_discover.py,sha256=sa6Zp5Kape1Zr4iYiNrnZxiHDnqM06ODk6yfWHom53w,13465
125
- digitalkin/utils/schema_splitter.py,sha256=f1RGzs0wSRPn8oydO9Ojo8mYTF4TFDkRFeGUt5jbPt4,11132
126
- digitalkin-0.3.2.dev28.dist-info/licenses/LICENSE,sha256=Ies4HFv2r2hzDRakJYxk3Y60uDFLiG-orIgeTpstnIo,20327
125
+ digitalkin/utils/schema_splitter.py,sha256=lMaReyLD4kGAZSQ9MSxpNZ4D4luWANVArFqNWV_bsko,14040
126
+ digitalkin-0.3.2.dev30.dist-info/licenses/LICENSE,sha256=Ies4HFv2r2hzDRakJYxk3Y60uDFLiG-orIgeTpstnIo,20327
127
127
  modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
128
128
  modules/archetype_with_tools_module.py,sha256=kJkVhAFWG0aDDqzupOXOnV3l8j3z5bEdWos_6Z9rUP8,7303
129
129
  modules/cpu_intensive_module.py,sha256=GZlirQDZdYuXrI46sv1q4RNAHZjL4EptHVQTvgK9zz8,8363
@@ -138,7 +138,7 @@ monitoring/digitalkin_observability/prometheus.py,sha256=gDmM9ySaVwPAe7Yg84pLxmE
138
138
  monitoring/tests/test_metrics.py,sha256=ugnYfAwqBPO6zA8z4afKTlyBWECTivacYSN-URQCn2E,5856
139
139
  services/filesystem_module.py,sha256=U4dgqtuDadaXz8PJ1d_uQ_1EPncBqudAQCLUICF9yL4,7421
140
140
  services/storage_module.py,sha256=Wz2MzLvqs2D_bnBBgtnujYcAKK2V2KFMk8K21RoepSE,6972
141
- digitalkin-0.3.2.dev28.dist-info/METADATA,sha256=hwYFHYrLASp_RxVjCh5sbgNL-fn8XaTeUsGiEBIknok,29725
142
- digitalkin-0.3.2.dev28.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
143
- digitalkin-0.3.2.dev28.dist-info/top_level.txt,sha256=AYVIesKrO0jnedQ-Muog9JBehG81WeTCNeOFoJgwsgE,51
144
- digitalkin-0.3.2.dev28.dist-info/RECORD,,
141
+ digitalkin-0.3.2.dev30.dist-info/METADATA,sha256=p61ucL27xrbUi7r5PXTNAiQqdV5p_3a1PogbLEvK0mk,29725
142
+ digitalkin-0.3.2.dev30.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
143
+ digitalkin-0.3.2.dev30.dist-info/top_level.txt,sha256=AYVIesKrO0jnedQ-Muog9JBehG81WeTCNeOFoJgwsgE,51
144
+ digitalkin-0.3.2.dev30.dist-info/RECORD,,