Skip to content

Commit da910f8

Browse files
committed
Include oneOf JSON-RPC descriptions in API parameter details
1 parent 8e04435 commit da910f8

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/model/api/jsonrpc.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ export class JsonRpcApiOperation implements ApiOperation {
168168

169169
}
170170

171+
const capitalizeFirst = (input: string | undefined) =>
172+
input
173+
? input.charAt(0).toUpperCase() + input.slice(1)
174+
: undefined;
175+
171176
export class JsonRpcApiRequest implements ApiRequest {
172177

173178
constructor(rpcMethod: MatchedOperation, exchange: HttpExchange) {
@@ -182,7 +187,18 @@ export class JsonRpcApiRequest implements ApiRequest {
182187
description: fromMarkdown([
183188
param.summary,
184189
param.description,
185-
schema?.title
190+
capitalizeFirst(schema?.title),
191+
...(schema?.oneOf?.length
192+
? [
193+
'One of:',
194+
(schema.oneOf as JSONSchemaObject[]).map(subschema =>
195+
`* ${capitalizeFirst(subschema.title)}: ${
196+
subschema.description || subschema.type || 'unknown'
197+
}`
198+
).join('\n')
199+
]
200+
: []
201+
)
186202
].filter(x => !!x).join('\n\n')),
187203
in: 'body',
188204
required: !!param.required,

0 commit comments

Comments
 (0)