readonly string[]
| List of plugin ids that this plugin's UI code imports modules from that are not in requiredPlugins
. |
| [requiredPlugins](./kibana-plugin-core-server.pluginmanifest.requiredplugins.md) | readonly PluginName[]
| An optional list of the other plugins that \*\*must be\*\* installed and enabled for this plugin to function properly. |
| [server](./kibana-plugin-core-server.pluginmanifest.server.md) | boolean
| Specifies whether plugin includes some server-side specific functionality. |
+| [serviceFolders](./kibana-plugin-core-server.pluginmanifest.servicefolders.md) | readonly string[]
| Only used for the automatically generated API documentation. Specifying service folders will cause your plugin API reference to be broken up into sub sections. |
| [ui](./kibana-plugin-core-server.pluginmanifest.ui.md) | boolean
| Specifies whether plugin includes some client/browser specific functionality that should be included into client bundle via public/ui_plugin.js
file. |
| [version](./kibana-plugin-core-server.pluginmanifest.version.md) | string
| Version of the plugin. |
diff --git a/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.servicefolders.md b/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.servicefolders.md
new file mode 100644
index 0000000000000..8ee33bdfa0f3f
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.servicefolders.md
@@ -0,0 +1,13 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [PluginManifest](./kibana-plugin-core-server.pluginmanifest.md) > [serviceFolders](./kibana-plugin-core-server.pluginmanifest.servicefolders.md)
+
+## PluginManifest.serviceFolders property
+
+Only used for the automatically generated API documentation. Specifying service folders will cause your plugin API reference to be broken up into sub sections.
+
+Signature:
+
+```typescript
+readonly serviceFolders?: readonly string[];
+```
diff --git a/package.json b/package.json
index 70918f02dcd41..f28c940e8fb24 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,7 @@
"test:ftr:runner": "node scripts/functional_test_runner",
"checkLicenses": "node scripts/check_licenses --dev",
"build": "node scripts/build --all-platforms",
+ "build:apidocs": "node scripts/build_api_docs",
"start": "node scripts/kibana --dev",
"debug": "node --nolazy --inspect scripts/kibana --dev",
"debug-break": "node --nolazy --inspect-brk scripts/kibana --dev",
@@ -367,7 +368,7 @@
"@kbn/plugin-generator": "link:packages/kbn-plugin-generator",
"@kbn/plugin-helpers": "link:packages/kbn-plugin-helpers",
"@kbn/pm": "link:packages/kbn-pm",
- "@kbn/release-notes": "link:packages/kbn-release-notes",
+ "@kbn/docs-utils": "link:packages/kbn-docs-utils",
"@kbn/storybook": "link:packages/kbn-storybook",
"@kbn/telemetry-tools": "link:packages/kbn-telemetry-tools",
"@kbn/test": "link:packages/kbn-test",
@@ -822,6 +823,7 @@
"tinycolor2": "1.4.1",
"topojson-client": "3.0.0",
"ts-loader": "^7.0.5",
+ "ts-morph": "^9.1.0",
"tsd": "^0.13.1",
"typescript": "4.1.3",
"typescript-fsa": "^3.0.0",
diff --git a/packages/kbn-dev-utils/src/plugins/parse_kibana_platform_plugin.ts b/packages/kbn-dev-utils/src/plugins/parse_kibana_platform_plugin.ts
index 62a6f1d347c9b..8d3fdb0f390c5 100644
--- a/packages/kbn-dev-utils/src/plugins/parse_kibana_platform_plugin.ts
+++ b/packages/kbn-dev-utils/src/plugins/parse_kibana_platform_plugin.ts
@@ -29,6 +29,7 @@ interface Manifest {
server: boolean;
kibanaVersion: string;
version: string;
+ serviceFolders: readonly string[];
requiredPlugins: readonly string[];
optionalPlugins: readonly string[];
requiredBundles: readonly string[];
@@ -64,6 +65,7 @@ export function parseKibanaPlatformPlugin(manifestPath: string): KibanaPlatformP
id: manifest.id,
version: manifest.version,
kibanaVersion: manifest.kibanaVersion || manifest.version,
+ serviceFolders: manifest.serviceFolders || [],
requiredPlugins: isValidDepsDeclaration(manifest.requiredPlugins, 'requiredPlugins'),
optionalPlugins: isValidDepsDeclaration(manifest.optionalPlugins, 'optionalPlugins'),
requiredBundles: isValidDepsDeclaration(manifest.requiredBundles, 'requiredBundles'),
diff --git a/packages/kbn-release-notes/jest.config.js b/packages/kbn-docs-utils/jest.config.js
similarity index 89%
rename from packages/kbn-release-notes/jest.config.js
rename to packages/kbn-docs-utils/jest.config.js
index db5e48b1704fb..e9cdc1978231e 100644
--- a/packages/kbn-release-notes/jest.config.js
+++ b/packages/kbn-docs-utils/jest.config.js
@@ -9,5 +9,5 @@
module.exports = {
preset: '@kbn/test',
rootDir: '../..',
- roots: [' extends ExampleClass extends ",
+ Object {
+ "docId": "kibPluginAPluginApi",
+ "pluginId": "pluginA",
+ "scope": "public",
+ "section": "def-public.ExampleClass",
+ "text": "ExampleClass",
+ },
+ "<",
+ Object {
+ "docId": "kibPluginAPluginApi",
+ "pluginId": "pluginA",
+ "scope": "public",
+ "section": "def-public.WithGen",
+ "text": "WithGen",
+ },
+ " >",
+ ]
+ `);
+ expect(linkCount(clss?.signature!)).toBe(3);
+ });
+
+ it('Function with generic inside interface is exported with function type', () => {
+ const exampleInterface = doc.client.find((c) => c.label === 'ExampleInterface');
+ expect(exampleInterface).toBeDefined();
+
+ const fnWithGeneric = exampleInterface?.children?.find((c) => c.label === 'aFnWithGen');
+ expect(fnWithGeneric).toBeDefined();
+ expect(fnWithGeneric?.type).toBe(TypeKind.FunctionKind);
+ });
+});
diff --git a/packages/kbn-docs-utils/src/api_docs/tests/kibana_platform_plugin_mock.ts b/packages/kbn-docs-utils/src/api_docs/tests/kibana_platform_plugin_mock.ts
new file mode 100644
index 0000000000000..9debca91b7ca8
--- /dev/null
+++ b/packages/kbn-docs-utils/src/api_docs/tests/kibana_platform_plugin_mock.ts
@@ -0,0 +1,30 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
+ * Side Public License, v 1.
+ */
+
+import { KibanaPlatformPlugin } from '@kbn/dev-utils';
+import Path from 'path';
+
+export function getKibanaPlatformPlugin(id: string, dir?: string): KibanaPlatformPlugin {
+ const directory = dir ?? Path.resolve(__dirname, '__fixtures__/src/plugin_a');
+ return {
+ manifest: {
+ id,
+ ui: true,
+ server: true,
+ kibanaVersion: '1',
+ version: '1',
+ serviceFolders: [],
+ requiredPlugins: [],
+ requiredBundles: [],
+ optionalPlugins: [],
+ extraPublicDirs: [],
+ },
+ directory,
+ manifestPath: Path.resolve(directory, 'kibana.json'),
+ };
+}
diff --git a/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json
new file mode 100644
index 0000000000000..db25b8c4f021e
--- /dev/null
+++ b/packages/kbn-docs-utils/src/api_docs/tests/snapshots/plugin_a.json
@@ -0,0 +1 @@
+{"id":"pluginA","client":{"classes":[{"id":"def-public.ExampleClass","type":"Class","label":"ExampleClass","description":[],"signature":[{"pluginId":"pluginA","scope":"public","docId":"kibPluginAPluginApi","section":"def-public.ExampleClass","text":"ExampleClass"}," extends ",{"pluginId":"pluginA","scope":"public","docId":"kibPluginAPluginApi","section":"def-public.ExampleClass","text":"ExampleClass"},"<",{"pluginId":"pluginA","scope":"public","docId":"kibPluginAPluginApi","section":"def-public.WithGen","text":"WithGen"}," >"],"children":[],"source":{"path":"/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts","lineNumber":51,"link":"https://github.com/elastic/kibana/tree/master/packages/kbn-docs-utils/src/api_docs/tests/__fixtures__/src/plugin_a/public/classes.ts#L51"},"initialIsOpen":false}],"functions":[{"id":"def-public.notAnArrowFn","type":"Function","label":"notAnArrowFn","signature":["(a: string, b: number | undefined, c: ",{"pluginId":"pluginA","scope":"public","docId":"kibPluginAPluginApi","section":"def-public.TypeWithGeneric","text":"TypeWithGeneric"},"