forked from FoundKeyGang/FoundKey
docs: show rate limit information
Changelog: Added
This commit is contained in:
parent
57cf6c7163
commit
95a9027a66
1 changed files with 13 additions and 3 deletions
|
@ -126,11 +126,21 @@ export function genOpenapiSpec() {
|
|||
};
|
||||
}
|
||||
|
||||
let desc = (endpoint.meta.description ? endpoint.meta.description : 'No description provided.') + '\n\n';
|
||||
let desc = endpoint.meta.description ?? 'No description provided.');
|
||||
desc += `**Credential required**: *${endpoint.meta.requireCredential ? 'Yes' : 'No'}*`;
|
||||
if (endpoint.meta.kind) {
|
||||
const kind = endpoint.meta.kind;
|
||||
desc += ` / **Permission**: *${kind}*`;
|
||||
desc += `\n\n**Permission**: `' + endpoint.meta.kind + '`';
|
||||
}
|
||||
if (endpoint.meta.limit) {
|
||||
const limit = endpoint.meta.limit;
|
||||
|
||||
desc += '\n### Rate limit\nRate limiting group: `' + (limit.key ?? endpoint.name) + '`';
|
||||
if (limit.duration && limit.max) {
|
||||
desc += ` \nNo more than ${limit.max} requests every ${limit.duration} ms.`;
|
||||
}
|
||||
if (limit.minInterval) {
|
||||
desc += ` \nMinimum delay between each request: ${endpoint.meta.limit.minInterval} ms.`;
|
||||
}
|
||||
}
|
||||
|
||||
const requestType = endpoint.meta.requireFile ? 'multipart/form-data' : 'application/json';
|
||||
|
|
Loading…
Reference in a new issue