( method: RpcMethod, defCollections: DefinitionCollections, isSession: boolean, )
| 1350 | } |
| 1351 | |
| 1352 | function getMethodParamsObjectSchema( |
| 1353 | method: RpcMethod, |
| 1354 | defCollections: DefinitionCollections, |
| 1355 | isSession: boolean, |
| 1356 | ): JSONSchema7 | undefined { |
| 1357 | if (!method.params) return undefined; |
| 1358 | |
| 1359 | const resolved = asGeneratedObjectSchema(method.params, defCollections); |
| 1360 | if (!resolved) return undefined; |
| 1361 | |
| 1362 | const properties = { ...(resolved.properties ?? {}) }; |
| 1363 | if (isSession) { |
| 1364 | delete properties.sessionId; |
| 1365 | } |
| 1366 | |
| 1367 | if (Object.keys(properties).length === 0) return undefined; |
| 1368 | |
| 1369 | const required = (resolved.required ?? []) |
| 1370 | .filter((name) => !isSession || name !== "sessionId") |
| 1371 | .filter((name) => Object.prototype.hasOwnProperty.call(properties, name)); |
| 1372 | |
| 1373 | const schema: JSONSchema7 = { |
| 1374 | ...resolved, |
| 1375 | properties, |
| 1376 | description: method.params.description ?? resolved.description, |
| 1377 | }; |
| 1378 | |
| 1379 | if (required.length > 0) { |
| 1380 | schema.required = required; |
| 1381 | } else { |
| 1382 | delete schema.required; |
| 1383 | } |
| 1384 | |
| 1385 | return schema; |
| 1386 | } |
| 1387 | |
| 1388 | function isNullableParamsSchema( |
| 1389 | params: JSONSchema7, |
no test coverage detected
searching dependent graphs…