Skip to content

Commit 08adc49

Browse files
committed
Use the new canonicalReference field as the DocFX UID
1 parent 935767b commit 08adc49

1 file changed

Lines changed: 3 additions & 30 deletions

File tree

apps/api-documenter/src/documenters/YamlDocumenter.ts

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
ApiEnumMember,
2929
ApiClass,
3030
ApiInterface,
31-
ApiParameterListMixin,
3231
ApiMethod,
3332
ApiMethodSignature,
3433
ApiConstructor,
@@ -551,36 +550,10 @@ export class YamlDocumenter {
551550

552551
/**
553552
* Calculate the DocFX "uid" for the ApiItem
554-
* Example: node-core-library.JsonFile.load
553+
* Example: `node-core-library!JsonFile#load`
555554
*/
556555
protected _getUid(apiItem: ApiItem): string {
557-
let result: string = '';
558-
for (const hierarchyItem of apiItem.getHierarchy()) {
559-
560-
// For overloaded methods, add a suffix such as "MyClass.myMethod_2".
561-
let qualifiedName: string = hierarchyItem.displayName;
562-
if (ApiParameterListMixin.isBaseClassOf(hierarchyItem)) {
563-
if (hierarchyItem.overloadIndex > 1) {
564-
// Subtract one for compatibility with earlier releases of API Documenter.
565-
// (This will get revamped when we fix GitHub issue #1308)
566-
qualifiedName += `_${hierarchyItem.overloadIndex - 1}`;
567-
}
568-
}
569-
570-
switch (hierarchyItem.kind) {
571-
case ApiItemKind.Model:
572-
case ApiItemKind.EntryPoint:
573-
break;
574-
case ApiItemKind.Package:
575-
result += PackageName.getUnscopedName(hierarchyItem.displayName);
576-
break;
577-
default:
578-
result += '.';
579-
result += qualifiedName;
580-
break;
581-
}
582-
}
583-
return result;
556+
return apiItem.canonicalReference.toString();
584557
}
585558

586559
/**
@@ -679,7 +652,7 @@ export class YamlDocumenter {
679652
if (apiItem.parent && apiItem.parent.kind === ApiItemKind.Namespace) {
680653
// For members a namespace, show the full name excluding the package part:
681654
// Example: excel.Excel.Binding --> Excel.Binding
682-
return this._getUid(apiItem).replace(/^[^.]+\./, '');
655+
return apiItem.getScopedNameWithinPackage();
683656
}
684657
return Utilities.getConciseSignature(apiItem);
685658
}

0 commit comments

Comments
 (0)