Skip to content

Commit be3b9de

Browse files
authored
Merge pull request microsoft#366 from Microsoft/pgonzal/yaml-documenter5
Rollup of miscellaneous improvements for api-documenter
2 parents 9be3284 + 70b191a commit be3b9de

8 files changed

Lines changed: 263 additions & 89 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/api-extractor",
5+
"comment": "The isBeta and deprecatedMessage fields are now inherited in the *.api.json files",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@microsoft/api-extractor",
10+
"email": "pgonzal@users.noreply.github.com"
11+
}

‎libraries/api-documenter/src/DocItemSet.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export class DocItem {
8282
break;
8383
case 'constructor':
8484
this.kind = DocItemKind.Constructor;
85+
this.name = 'constructor';
8586
break;
8687
case 'function':
8788
this.kind = DocItemKind.Function;
@@ -128,6 +129,16 @@ export class DocItem {
128129
}
129130
return undefined;
130131
}
132+
133+
/**
134+
* Returns true if this is a package, and it has been classified as "external",
135+
* i.e. a system library that is maintained by an external party, but included in the
136+
* documentation for informational purposes.
137+
*/
138+
public get isExternalPackage(): boolean {
139+
// We should define a better criteria for this
140+
return this.apiItem.kind === 'package' && this.apiItem.name.substr(0, 1) === '@';
141+
}
131142
}
132143

133144
/**

libraries/api-documenter/src/yaml/IYamlFile.ts renamed to libraries/api-documenter/src/yaml/IYamlApiFile.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
* TypeScript interface describing a Universal Reference YAML documentation file,
66
* as defined by typescript.schema.json.
77
*/
8-
export interface IYamlFile {
8+
export interface IYamlApiFile {
99
items: IYamlItem[];
1010
references?: IYamlReference[];
1111
}
1212

1313
/**
14-
* Part of the IYamlFile structure. Used to document exceptions that can be thrown
14+
* Part of the IYamlApiFile structure. Used to document exceptions that can be thrown
1515
* by a method, property, function, or constructor.
1616
*/
1717
export interface IYamlException {
@@ -20,12 +20,12 @@ export interface IYamlException {
2020
}
2121

2222
/**
23-
* Part of the IYamlFile structure. Represents the type of an IYamlItem.
23+
* Part of the IYamlApiFile structure. Represents the type of an IYamlItem.
2424
*/
2525
export type YamlTypeId = 'class' | 'constructor' | 'enum' | 'field' | 'interface' | 'method' | 'package' | 'property';
2626

2727
/**
28-
* Part of the IYamlFile structure. Represents basic API elements such as
28+
* Part of the IYamlApiFile structure. Represents basic API elements such as
2929
* classes, interfaces, members, etc.
3030
*/
3131
export interface IYamlItem {
@@ -46,7 +46,7 @@ export interface IYamlItem {
4646
}
4747

4848
/**
49-
* Part of the IYamlFile structure. Represents a method or function parameter.
49+
* Part of the IYamlApiFile structure. Represents a method or function parameter.
5050
*/
5151
export interface IYamlParameter {
5252
description?: string;
@@ -55,7 +55,7 @@ export interface IYamlParameter {
5555
}
5656

5757
/**
58-
* Part of the IYamlFile structure. Represents a reference to an item that is
58+
* Part of the IYamlApiFile structure. Represents a reference to an item that is
5959
* declared in a separate YAML file.
6060
*/
6161
export interface IYamlReference {
@@ -64,7 +64,7 @@ export interface IYamlReference {
6464
}
6565

6666
/**
67-
* Part of the IYamlFile structure. Indicates the open source Git repository
67+
* Part of the IYamlApiFile structure. Indicates the open source Git repository
6868
* where an IYamlItem is defined.
6969
*/
7070
export interface IYamlRemote {
@@ -74,7 +74,7 @@ export interface IYamlRemote {
7474
}
7575

7676
/**
77-
* Part of the IYamlFile structure. Documents the return value of a function
77+
* Part of the IYamlApiFile structure. Documents the return value of a function
7878
* or method.
7979
*/
8080
export interface IYamlReturn {
@@ -83,7 +83,7 @@ export interface IYamlReturn {
8383
}
8484

8585
/**
86-
* Part of the IYamlFile structure. Documents the source file where an IYamlItem is defined.
86+
* Part of the IYamlApiFile structure. Documents the source file where an IYamlItem is defined.
8787
*/
8888
export interface IYamlSource {
8989
id?: string;
@@ -93,7 +93,7 @@ export interface IYamlSource {
9393
}
9494

9595
/**
96-
* Part of the IYamlFile structure. Documents the type signature for an IYamlItem.
96+
* Part of the IYamlApiFile structure. Documents the type signature for an IYamlItem.
9797
*/
9898
export interface IYamlSyntax {
9999
content?: string;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
/**
5+
* A node in the navigation hierarchy for the table of contents.
6+
*/
7+
export interface IYamlTocItem {
8+
/**
9+
* The title to display
10+
*/
11+
name: string;
12+
13+
/**
14+
* If specified, the hyperlink will point to the API with this UID
15+
*/
16+
uid?: string;
17+
18+
/**
19+
* IF specified, the hyperlink will point to this URL, which may be a relative URL path
20+
*/
21+
href?: string;
22+
23+
/**
24+
* Child nodes in the hierarchy
25+
*/
26+
items?: IYamlTocItem[];
27+
}
28+
29+
/**
30+
* TypeScript interface describing the toc.yml file format, used to represent
31+
* the table of contents for a Universal Reference YAML documentation file.
32+
*/
33+
export interface IYamlTocFile {
34+
items: IYamlTocItem[];
35+
metadata?: { [key: string]: string };
36+
}

0 commit comments

Comments
 (0)