Skip to content

Commit de8b67f

Browse files
mikewuuseambotrazor-x
authored
fix: handle missing nested Array of Object objects (#945)
* fix: handle missing nested Array of Object objects * ci: Generate docs --------- Co-authored-by: Seam Bot <[email protected]> Co-authored-by: Evan Sosenko <[email protected]>
1 parent 1214550 commit de8b67f

File tree

2 files changed

+69
-3
lines changed

2 files changed

+69
-3
lines changed

codegen/lib/layout/api-endpoint.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,27 @@ const mapBlueprintParamToEndpointParam = (
249249

250250
...(param.format === 'list' &&
251251
param.itemFormat === 'object' && {
252-
objectParameters: param.itemParameters.map(
253-
mapBlueprintParamToEndpointParam,
254-
),
252+
objectParameters: param.itemParameters.flatMap((nestedParam) => {
253+
const mappedNestedParam =
254+
mapBlueprintParamToEndpointParam(nestedParam)
255+
256+
if (mappedNestedParam.format !== 'Object') {
257+
return [mappedNestedParam]
258+
}
259+
260+
const nestedObjectParameters =
261+
mapBlueprintParamToEndpointParam(nestedParam).objectParameters
262+
263+
if (nestedObjectParameters == null) {
264+
return [mappedNestedParam]
265+
}
266+
267+
const prefixedNestedObjectParameters = nestedObjectParameters.map(
268+
(p) => ({ ...p, name: `${mappedNestedParam.name}.${p.name}` }),
269+
)
270+
271+
return [mappedNestedParam, ...prefixedNestedObjectParameters]
272+
}),
255273
}),
256274
}
257275
}

docs/api/acs/systems/report_devices.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,18 @@ Array of ACS encoders to report
236236

237237

238238

239+
<details>
240+
241+
<summary><b><code>hotek_metadata.encoder_number</code></b> <i>String</i></summary>
242+
243+
The encoder number determined by the USB port connection.
244+
245+
</details>
246+
247+
---
248+
249+
250+
239251
<details>
240252

241253
<summary><b><code>is_removed</code></b> <i>Boolean</i></summary>
@@ -263,6 +275,42 @@ Hotek-specific metadata associated with the entrance.
263275

264276

265277

278+
<details>
279+
280+
<summary><b><code>hotek_metadata.common_area_name</code></b> <i>String</i></summary>
281+
282+
The common area name
283+
284+
</details>
285+
286+
---
287+
288+
289+
290+
<details>
291+
292+
<summary><b><code>hotek_metadata.common_area_number</code></b> <i>String</i></summary>
293+
294+
The room number identifier
295+
296+
</details>
297+
298+
---
299+
300+
301+
302+
<details>
303+
304+
<summary><b><code>hotek_metadata.room_number</code></b> <i>String</i></summary>
305+
306+
The room number identifier
307+
308+
</details>
309+
310+
---
311+
312+
313+
266314
<details>
267315

268316
<summary><b><code>is_removed</code></b> <i>Boolean</i></summary>

0 commit comments

Comments
 (0)