Skip to content

Commit

Permalink
[7.x] Generate core API docs from TSDoc comments (#32148) (#34421)
Browse files Browse the repository at this point in the history
* Generate core API docs from TSDoc comments (#32148)

* Generate core API docs from TSDoc comments

Uses api-extractor and api-documenter to generate documentation for
the Kibana core API from TSDoc comments in the source code.

Documentation can be generated using `npm run docs:api`.

I used --no-verify to ignore the following pre-commit hook errors:
1. Filenames MUST use snake_case - api-extractor.json
   It's possible to specify a different config file, but I prefer to keep the "standard" config file name.
2. UNHANDLED ERROR: Unable to find tsconfig.json file selecting "common/core_api_review/kibana.api.ts". Ensure one exists and it is listed in "src/dev/typescript/projects.ts"
   This is not a source file, so safe to ignore.

* Flesh out API docs a little bit

* Ignore snake_case check for api-extractor.json

* Ignore api-extractor's review file from pre-commit check

* Try to fix build failing by using masters yarn.lock

* I'm being stupid

* Found a better home for ignoring common/core_api_review/kibana.api.ts

* Node script for detecting core API changes

I initially wanted to include this as a precommit hook, but it takes
quite long to execute (~12s) so might be better suited as a test or
as part of the release process.

The script currently fails because api-extractor uses an older version
of typescript.

* Fix tslint precommit hook ignore condition

* Write tsdoc-metadata.json into ./build

* Add LogMeta and ElasticSearch to exported types & docs

* Suppress logging when running api-extractor from script

* Improve check_core_api_changes script and run as test

* Inline api-extractor.json config

* Fix check_core_api_changes --help flag

* LogMeta TSDoc comments

* check_core_api_changes: fail if api-extractor produces warnings or errors

And print more useful messages to the console

* Move ignored ts files list into dev/file

* Add back build:types since api-exporter cannot operate on source files

* Upgrade api-exporter/documenter

* api-extractor: independantly analyze core/public and core/server

Becasue of microsoft/rushstack#1029
api-extractor can't use core/index.ts as a single entry point for
analyzing the public and server API's as isolated namespaces.

Instead we analyze these projects separately. This introduces other
problems like the api review files and documentation always being
called "kibana." from the package.json filename.

* Build types as part of build task

* Include types in typescript browser compilation

* Force inclusion of core/public for building types

* Fix api review filename in api-exporter errors

* Update docs and API review files

* Fix api-extractor warnings

* Remove ts file ignored list since it's no longer necessary

* Rename exported api package name

* Review comments

* Export other missing types

* Upgrade api-documenter to latest beta

* Export more missing types

* Fix warnings and add api-exporter to Jenkins tests

* Correctly handle runBuildTypes() exceptions

* Fix another swallowed exception

* Fix api-extractor warnings after master merge

* Update yarn.lock

* Fix erraneous type

* Revert "Update yarn.lock"

This reverts commit 85a8093.

* Revert "Fix erraneous type"

This reverts commit 7f0550c.

* Backport #32440

* Update core api signature and docs
  • Loading branch information
rudolf authored Apr 4, 2019
1 parent e97b329 commit 8945b56
Show file tree
Hide file tree
Showing 138 changed files with 2,627 additions and 81 deletions.
10 changes: 10 additions & 0 deletions docs/development/core/public/kibana-plugin-public.basepathsetup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Home](./index) > [kibana-plugin-public](./kibana-plugin-public.md) > [BasePathSetup](./kibana-plugin-public.basepathsetup.md)

## BasePathSetup type


<b>Signature:</b>

```typescript
export declare type BasePathSetup = ReturnType<BasePathService['setup']>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeBrand](./kibana-plugin-public.chromebrand.md) &gt; [logo](./kibana-plugin-public.chromebrand.logo.md)

## ChromeBrand.logo property

<b>Signature:</b>

```typescript
logo?: string;
```
18 changes: 18 additions & 0 deletions docs/development/core/public/kibana-plugin-public.chromebrand.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeBrand](./kibana-plugin-public.chromebrand.md)

## ChromeBrand interface


<b>Signature:</b>

```typescript
export interface ChromeBrand
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [logo](./kibana-plugin-public.chromebrand.logo.md) | <code>string</code> | |
| [smallLogo](./kibana-plugin-public.chromebrand.smalllogo.md) | <code>string</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeBrand](./kibana-plugin-public.chromebrand.md) &gt; [smallLogo](./kibana-plugin-public.chromebrand.smalllogo.md)

## ChromeBrand.smallLogo property

<b>Signature:</b>

```typescript
smallLogo?: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeBreadcrumb](./kibana-plugin-public.chromebreadcrumb.md) &gt; [data-test-subj](./kibana-plugin-public.chromebreadcrumb.data-test-subj.md)

## ChromeBreadcrumb.data-test-subj property

<b>Signature:</b>

```typescript
'data-test-subj'?: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeBreadcrumb](./kibana-plugin-public.chromebreadcrumb.md) &gt; [href](./kibana-plugin-public.chromebreadcrumb.href.md)

## ChromeBreadcrumb.href property

<b>Signature:</b>

```typescript
href?: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeBreadcrumb](./kibana-plugin-public.chromebreadcrumb.md)

## ChromeBreadcrumb interface


<b>Signature:</b>

```typescript
export interface ChromeBreadcrumb
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [data-test-subj](./kibana-plugin-public.chromebreadcrumb.data-test-subj.md) | <code>string</code> | |
| [href](./kibana-plugin-public.chromebreadcrumb.href.md) | <code>string</code> | |
| [text](./kibana-plugin-public.chromebreadcrumb.text.md) | <code>string</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeBreadcrumb](./kibana-plugin-public.chromebreadcrumb.md) &gt; [text](./kibana-plugin-public.chromebreadcrumb.text.md)

## ChromeBreadcrumb.text property

<b>Signature:</b>

```typescript
text: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeHelpExtension](./kibana-plugin-public.chromehelpextension.md)

## ChromeHelpExtension type


<b>Signature:</b>

```typescript
export declare type ChromeHelpExtension = (element: HTMLDivElement) => (() => void);
```
10 changes: 10 additions & 0 deletions docs/development/core/public/kibana-plugin-public.chromesetup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [ChromeSetup](./kibana-plugin-public.chromesetup.md)

## ChromeSetup type


<b>Signature:</b>

```typescript
export declare type ChromeSetup = ReturnType<ChromeService['setup']>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md) &gt; [basePath](./kibana-plugin-public.coresetup.basepath.md)

## CoreSetup.basePath property

<b>Signature:</b>

```typescript
basePath: BasePathSetup;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md) &gt; [chrome](./kibana-plugin-public.coresetup.chrome.md)

## CoreSetup.chrome property

<b>Signature:</b>

```typescript
chrome: ChromeSetup;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md) &gt; [fatalErrors](./kibana-plugin-public.coresetup.fatalerrors.md)

## CoreSetup.fatalErrors property

<b>Signature:</b>

```typescript
fatalErrors: FatalErrorsSetup;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md) &gt; [http](./kibana-plugin-public.coresetup.http.md)

## CoreSetup.http property

<b>Signature:</b>

```typescript
http: HttpSetup;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md) &gt; [i18n](./kibana-plugin-public.coresetup.i18n.md)

## CoreSetup.i18n property

<b>Signature:</b>

```typescript
i18n: I18nSetup;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md) &gt; [injectedMetadata](./kibana-plugin-public.coresetup.injectedmetadata.md)

## CoreSetup.injectedMetadata property

<b>Signature:</b>

```typescript
injectedMetadata: InjectedMetadataSetup;
```
25 changes: 25 additions & 0 deletions docs/development/core/public/kibana-plugin-public.coresetup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md)

## CoreSetup interface

Core services exposed to the start lifecycle

<b>Signature:</b>

```typescript
export interface CoreSetup
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [basePath](./kibana-plugin-public.coresetup.basepath.md) | <code>BasePathSetup</code> | |
| [chrome](./kibana-plugin-public.coresetup.chrome.md) | <code>ChromeSetup</code> | |
| [fatalErrors](./kibana-plugin-public.coresetup.fatalerrors.md) | <code>FatalErrorsSetup</code> | |
| [http](./kibana-plugin-public.coresetup.http.md) | <code>HttpSetup</code> | |
| [i18n](./kibana-plugin-public.coresetup.i18n.md) | <code>I18nSetup</code> | |
| [injectedMetadata](./kibana-plugin-public.coresetup.injectedmetadata.md) | <code>InjectedMetadataSetup</code> | |
| [notifications](./kibana-plugin-public.coresetup.notifications.md) | <code>NotificationsSetup</code> | |
| [uiSettings](./kibana-plugin-public.coresetup.uisettings.md) | <code>UiSettingsSetup</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md) &gt; [notifications](./kibana-plugin-public.coresetup.notifications.md)

## CoreSetup.notifications property

<b>Signature:</b>

```typescript
notifications: NotificationsSetup;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [CoreSetup](./kibana-plugin-public.coresetup.md) &gt; [uiSettings](./kibana-plugin-public.coresetup.uisettings.md)

## CoreSetup.uiSettings property

<b>Signature:</b>

```typescript
uiSettings: UiSettingsSetup;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [FatalErrorsSetup](./kibana-plugin-public.fatalerrorssetup.md)

## FatalErrorsSetup type


<b>Signature:</b>

```typescript
export declare type FatalErrorsSetup = ReturnType<FatalErrorsService['setup']>;
```
10 changes: 10 additions & 0 deletions docs/development/core/public/kibana-plugin-public.httpsetup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [HttpSetup](./kibana-plugin-public.httpsetup.md)

## HttpSetup type


<b>Signature:</b>

```typescript
export declare type HttpSetup = ReturnType<HttpService['setup']>;
```
10 changes: 10 additions & 0 deletions docs/development/core/public/kibana-plugin-public.i18nsetup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [I18nSetup](./kibana-plugin-public.i18nsetup.md)

## I18nSetup type


<b>Signature:</b>

```typescript
export declare type I18nSetup = ReturnType<I18nService['setup']>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md)

## InjectedMetadataSetup type


<b>Signature:</b>

```typescript
export declare type InjectedMetadataSetup = ReturnType<InjectedMetadataService['setup']>;
```
39 changes: 39 additions & 0 deletions docs/development/core/public/kibana-plugin-public.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md)

## kibana-plugin-public package

## Classes

| Class | Description |
| --- | --- |
| [ToastsSetup](./kibana-plugin-public.toastssetup.md) | |
| [UiSettingsClient](./kibana-plugin-public.uisettingsclient.md) | |

## Interfaces

| Interface | Description |
| --- | --- |
| [ChromeBrand](./kibana-plugin-public.chromebrand.md) | |
| [ChromeBreadcrumb](./kibana-plugin-public.chromebreadcrumb.md) | |
| [CoreSetup](./kibana-plugin-public.coresetup.md) | Core services exposed to the start lifecycle |
| [Plugin](./kibana-plugin-public.plugin.md) | The interface that should be returned by a <code>PluginInitializer</code>. |
| [PluginInitializerContext](./kibana-plugin-public.plugininitializercontext.md) | The available core services passed to a <code>PluginInitializer</code> |
| [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md) | The available core services passed to a plugin's <code>Plugin#setup</code> method. |
| [UiSettingsState](./kibana-plugin-public.uisettingsstate.md) | |

## Type Aliases

| Type Alias | Description |
| --- | --- |
| [BasePathSetup](./kibana-plugin-public.basepathsetup.md) | |
| [ChromeHelpExtension](./kibana-plugin-public.chromehelpextension.md) | |
| [ChromeSetup](./kibana-plugin-public.chromesetup.md) | |
| [FatalErrorsSetup](./kibana-plugin-public.fatalerrorssetup.md) | |
| [HttpSetup](./kibana-plugin-public.httpsetup.md) | |
| [I18nSetup](./kibana-plugin-public.i18nsetup.md) | |
| [InjectedMetadataSetup](./kibana-plugin-public.injectedmetadatasetup.md) | |
| [NotificationsSetup](./kibana-plugin-public.notificationssetup.md) | |
| [PluginInitializer](./kibana-plugin-public.plugininitializer.md) | The <code>plugin</code> export at the root of a plugin's <code>public</code> directory should conform to this interface. |
| [ToastInput](./kibana-plugin-public.toastinput.md) | |
| [UiSettingsSetup](./kibana-plugin-public.uisettingssetup.md) | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [NotificationsSetup](./kibana-plugin-public.notificationssetup.md)

## NotificationsSetup type


<b>Signature:</b>

```typescript
export declare type NotificationsSetup = ReturnType<NotificationsService['setup']>;
```
19 changes: 19 additions & 0 deletions docs/development/core/public/kibana-plugin-public.plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [Plugin](./kibana-plugin-public.plugin.md)

## Plugin interface

The interface that should be returned by a `PluginInitializer`<!-- -->.

<b>Signature:</b>

```typescript
export interface Plugin<TSetup, TDependencies extends Record<string, unknown> =
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [setup](./kibana-plugin-public.plugin.setup.md) | <code>(core: PluginSetupContext, dependencies: TDependencies) =&gt; TSetup &#124; Promise&lt;TSetup&gt;</code> | |
| [stop](./kibana-plugin-public.plugin.stop.md) | <code>() =&gt; void</code> | |
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [Plugin](./kibana-plugin-public.plugin.md) &gt; [setup](./kibana-plugin-public.plugin.setup.md)

## Plugin.setup property

<b>Signature:</b>

```typescript
setup: (core: PluginSetupContext, dependencies: TDependencies) => TSetup | Promise<TSetup>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [Plugin](./kibana-plugin-public.plugin.md) &gt; [stop](./kibana-plugin-public.plugin.stop.md)

## Plugin.stop property

<b>Signature:</b>

```typescript
stop?: () => void;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginInitializer](./kibana-plugin-public.plugininitializer.md)

## PluginInitializer type

The `plugin` export at the root of a plugin's `public` directory should conform to this interface.

<b>Signature:</b>

```typescript
export declare type PluginInitializer<TSetup, TDependencies extends Record<string, unknown> = {}> = (core: PluginInitializerContext) => Plugin<TSetup, TDependencies>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginInitializerContext](./kibana-plugin-public.plugininitializercontext.md)

## PluginInitializerContext interface

The available core services passed to a `PluginInitializer`

<b>Signature:</b>

```typescript
export interface PluginInitializerContext
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Home](./index) &gt; [kibana-plugin-public](./kibana-plugin-public.md) &gt; [PluginSetupContext](./kibana-plugin-public.pluginsetupcontext.md) &gt; [basePath](./kibana-plugin-public.pluginsetupcontext.basepath.md)

## PluginSetupContext.basePath property

<b>Signature:</b>

```typescript
basePath: BasePathSetup;
```
Loading

0 comments on commit 8945b56

Please sign in to comment.