chore(docs): fix docs API handling duped methods with different langs
This commit is contained in:
parent
3d5f85d7e4
commit
6d8cfa699b
|
|
@ -159,8 +159,8 @@ class ApiParser {
|
||||||
const clazz = this.classes.get(className);
|
const clazz = this.classes.get(className);
|
||||||
if (!clazz)
|
if (!clazz)
|
||||||
throw new Error('Invalid class ' + className);
|
throw new Error('Invalid class ' + className);
|
||||||
const method = clazz.membersArray.find(m => m.kind === 'method' && m.name === methodName);
|
const methods = clazz.membersArray.filter(m => m.kind === 'method' && m.name === methodName);
|
||||||
if (!method)
|
if (methods.length < 1)
|
||||||
throw new Error(`Invalid method ${className}.${methodName} when parsing: ${match[0]}`);
|
throw new Error(`Invalid method ${className}.${methodName} when parsing: ${match[0]}`);
|
||||||
if (!name)
|
if (!name)
|
||||||
throw new Error('Invalid member name ' + spec.text);
|
throw new Error('Invalid member name ' + spec.text);
|
||||||
|
|
@ -169,6 +169,7 @@ class ApiParser {
|
||||||
if (!arg)
|
if (!arg)
|
||||||
return;
|
return;
|
||||||
arg.name = name;
|
arg.name = name;
|
||||||
|
for (const method of methods) {
|
||||||
const existingArg = method.argsArray.find(m => m.name === arg.name);
|
const existingArg = method.argsArray.find(m => m.name === arg.name);
|
||||||
if (existingArg && isTypeOverride(existingArg, arg)) {
|
if (existingArg && isTypeOverride(existingArg, arg)) {
|
||||||
if (!arg.langs || !arg.langs.only)
|
if (!arg.langs || !arg.langs.only)
|
||||||
|
|
@ -180,8 +181,10 @@ class ApiParser {
|
||||||
} else {
|
} else {
|
||||||
method.argsArray.push(arg);
|
method.argsArray.push(arg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// match[1] === 'option'
|
// match[1] === 'option'
|
||||||
|
for (const method of methods) {
|
||||||
const p = this.parseProperty(spec, match[2]);
|
const p = this.parseProperty(spec, match[2]);
|
||||||
if (!p)
|
if (!p)
|
||||||
return;
|
return;
|
||||||
|
|
@ -195,6 +198,7 @@ class ApiParser {
|
||||||
options.type?.properties?.push(p);
|
options.type?.properties?.push(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {MarkdownHeaderNode} spec
|
* @param {MarkdownHeaderNode} spec
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue