Add deprecated flag to RPCs (#5244)

* Add deprecated flag to RPCs

* CHANGELOG
This commit is contained in:
Jaco
2022-09-28 08:14:47 +03:00
committed by GitHub
parent 7701205d58
commit a92bfca548
8 changed files with 41 additions and 12 deletions
+3 -1
View File
@@ -96,7 +96,9 @@ export function generateRpcTypes (registry: TypeRegistry, importDefinitions: Rec
const item = {
args: args.join(', '),
docs: [def.description],
docs: def.deprecated
? [`@deprecated ${def.deprecated}`, def.description]
: [def.description],
generic,
name: methodName,
type
+19 -11
View File
@@ -98,14 +98,17 @@ function renderPage (page: Page): string {
? `<h3 id="#${item.link}">${item.name}</h3>`
: `### ${item.name}`;
Object.keys(item).filter((key) => !['link', 'name'].includes(key)).forEach((bullet) => {
md += `\n- **${bullet}**: ${
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
item[bullet] instanceof Vec
? docsVecToMarkdown(item[bullet] as Vec<Text>, 2).toString()
: item[bullet]
}`;
});
Object
.keys(item)
.filter((key) => !['link', 'name'].includes(key))
.forEach((bullet) => {
md += `\n- **${bullet}**: ${
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
item[bullet] instanceof Vec
? docsVecToMarkdown(item[bullet] as Vec<Text>, 2).toString()
: item[bullet]
}`;
});
md += '\n';
});
@@ -160,14 +163,19 @@ function addRpc (): string {
}).join(', ');
const type = '`' + method.type + '`';
const jsonrpc = (method.endpoint || `${sectionName}_${methodName}`);
container.items.push({
const item: SectionItem = {
interface: '`' + `api.rpc.${sectionName}.${methodName}` + '`',
jsonrpc: '`' + jsonrpc + '`',
// link: jsonrpc,
name: `${methodName}(${args}): ${type}`,
...(method.description && { summary: method.description })
});
};
if (method.deprecated) {
item.deprecated = method.deprecated;
}
container.items.push(item);
});
return all;