Prevent insertion of duplicate instances
This commit is contained in:
parent
d2cfd4aea7
commit
b1a7c15ead
|
|
@ -173,11 +173,12 @@ class ApiParser {
|
||||||
if (!name)
|
if (!name)
|
||||||
throw new Error('Invalid member name ' + spec.text);
|
throw new Error('Invalid member name ' + spec.text);
|
||||||
if (match[1] === 'param') {
|
if (match[1] === 'param') {
|
||||||
const arg = this.parseProperty(spec, match[2]);
|
|
||||||
if (!arg)
|
|
||||||
return;
|
|
||||||
arg.name = name;
|
|
||||||
for (const method of methods) {
|
for (const method of methods) {
|
||||||
|
// Purposefully create separate instances of the same option for each method
|
||||||
|
const arg = this.parseProperty(spec, match[2]);
|
||||||
|
if (!arg)
|
||||||
|
continue;
|
||||||
|
arg.name = name;
|
||||||
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)
|
||||||
|
|
@ -193,9 +194,10 @@ class ApiParser {
|
||||||
} else {
|
} else {
|
||||||
// match[1] === 'option'
|
// match[1] === 'option'
|
||||||
for (const method of methods) {
|
for (const method of methods) {
|
||||||
|
// Purposefully create separate instances of the same option for each method
|
||||||
const p = this.parseProperty(spec, match[2]);
|
const p = this.parseProperty(spec, match[2]);
|
||||||
if (!p)
|
if (!p)
|
||||||
return;
|
continue;
|
||||||
let options = method.argsArray.find(o => o.name === 'options');
|
let options = method.argsArray.find(o => o.name === 'options');
|
||||||
if (!options) {
|
if (!options) {
|
||||||
const type = new docs.Type('Object', []);
|
const type = new docs.Type('Object', []);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue