* Determine if a method has typed params. Returns `{ hasParams, typeName }`. * Handles `$ref`-based, title-bearing, and inline params uniformly: * * - Resolves `$ref` to its definition. * - For session methods, ignores `sessionId` (the namespace injects it). * - Returns `hasParams=false`
( method: RpcMethod, defCollections: DefinitionCollections, isSession: boolean, )
| 1704 | * definition's `title`, then the inline params `title`. |
| 1705 | */ |
| 1706 | function getMethodParamsInfo( |
| 1707 | method: RpcMethod, |
| 1708 | defCollections: DefinitionCollections, |
| 1709 | isSession: boolean, |
| 1710 | ): { hasParams: boolean; optional: boolean; typeName: string | null } { |
| 1711 | if (!method.params) return { hasParams: false, optional: false, typeName: null }; |
| 1712 | const paramsSchema = getMethodParamsObjectSchema( |
| 1713 | method, |
| 1714 | defCollections, |
| 1715 | isSession, |
| 1716 | ); |
| 1717 | if (!paramsSchema) return { hasParams: false, optional: false, typeName: null }; |
| 1718 | |
| 1719 | const typeName = rustParamsTypeName(method, defCollections); |
| 1720 | |
| 1721 | const props = Object.keys(paramsSchema.properties || {}); |
| 1722 | if (props.length === 0) return { hasParams: false, optional: false, typeName: null }; |
| 1723 | if (!typeName) return { hasParams: false, optional: false, typeName: null }; |
| 1724 | const required = new Set(paramsSchema.required || []); |
| 1725 | const hasRequiredParams = props.some((p) => required.has(p)); |
| 1726 | const optional = isNullableParamsSchema(method.params, defCollections) && |
| 1727 | !hasRequiredParams; |
| 1728 | return { hasParams: true, optional, typeName }; |
| 1729 | } |
| 1730 | |
| 1731 | function rpcMethodConstName(method: RpcMethod): string { |
| 1732 | return method.rpcMethod.replace(/\./g, "_").toUpperCase(); |
no test coverage detected
searching dependent graphs…