You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Contribute to Elastic API docs locally: Quickstart guides
6
6
7
+
This guide provides step-by-step workflows for contributing to Elasticsearch and {{kib}} API documentation locally. These workflows enable you to validate, preview, and debug your changes before submitting them for review.
8
+
7
9
::::::::{tab-set}
8
10
:::::::{tab-item} Elasticsearch
9
11
@@ -99,6 +101,7 @@ You should try to fix all linter warnings and not just errors. Fixing errors alo
99
101
```shell
100
102
make overlay-docs
101
103
```
104
+
::::
102
105
103
106
::::{step} Preview your changes
104
107
Generate a preview of how your docs will appear:
@@ -122,34 +125,134 @@ Once you're satisfied with your docs changes:
122
125
123
126
:::::::
124
127
125
-
:::::::{tab-item} Kibana
126
-
Follow these steps to capture live API specs from Kibana, generate OpenAPI documentation, and view a preview URL.
128
+
:::::::{tab-item} {{kib}}
129
+
130
+
Follow these steps to capture live API specs from {{kib}}, generate OpenAPI documentation, and view a preview URL.
127
131
128
-
## Step 0: Set up Kibana environment
132
+
:::{tip}
133
+
Refer to the {{kib}} [OAS docs README](https://github.com/elastic/kibana/tree/main/oas_docs#kibana-api-reference-documentation) for more information.
134
+
:::
135
+
136
+
:::::{stepper}
137
+
138
+
::::{step} Set up {{kib}} environment
129
139
130
140
```bash
131
141
cd kibana
132
142
nvm use
133
143
yarn kbn bootstrap
134
144
```
135
145
136
-
**Note:** Run `yarn kbn clean` first if dependencies are broken.
146
+
:::{note}
147
+
Run `yarn kbn clean` first if dependencies are broken.
148
+
:::
149
+
::::
137
150
138
-
## Step 0.1: Start Docker
151
+
::::{step} Start Docker
139
152
Ensure Docker is running, otherwise things will fail slowly.
153
+
::::
140
154
141
-
## Step 1: Capture OAS snapshot
155
+
::::{step} Enable OAS in {{kib}}
142
156
143
-
### 1.1: Ensure OAS is enabled
144
-
`kibana/config/kibana.dev.yml` shoud look like this:
157
+
Ensure `kibana/config/kibana.dev.yml` contains:
145
158
```yaml
146
159
server.oas.enabled: true
147
160
```
161
+
::::
148
162
149
-
### 1.2: Run capture command
163
+
::::{step} Add examples to your routes (optional)
164
+
165
+
Beyond schema definitions, providing concrete request and response examples significantly improves API documentation usability. Examples are type-checked at development time, so shape errors are caught during authoring.
166
+
167
+
:::{dropdown} Inline TypeScript examples
168
+
You can add examples directly in your route definitions:
169
+
```typescript
170
+
.addVersion({
171
+
version: '2023-10-31',
172
+
options: {
173
+
oasOperationObject: () => ({
174
+
requestBody: {
175
+
content: {
176
+
'application/json': {
177
+
examples: {
178
+
fooExample1: {
179
+
summary: 'An example foo request',
180
+
value: {
181
+
name: 'Cool foo!',
182
+
} as FooResource,
183
+
},
184
+
},
185
+
},
186
+
},
187
+
},
188
+
}),
189
+
},
190
+
// ...
191
+
})
192
+
```
193
+
:::
150
194
151
-
You can just include your API set of interest, here it's for all plugins per [`capture_oas_snapshot.sh`](https://github.com/elastic/kibana/blob/main/.buildkite/scripts/steps/checks/capture_oas_snapshot.sh).
Skip this step if you've only edited manually-maintained YAML files (like `bundled.yaml`, `*.schema.yaml`, or `kibana.info.serverless.yaml`).
249
+
:::
250
+
251
+
Run this step when you've made changes to route definitions, request/response schemas, or added new HTTP APIs in your plugin code.
252
+
253
+
This spins up a local {{es}} and {{kib}} cluster with your code changes, then extracts the OpenAPI specification that {{kib}} generates at runtime based on your route definitions and schemas.
254
+
255
+
This example includes all plugins per [`capture_oas_snapshot.sh`](https://github.com/elastic/kibana/blob/main/.buildkite/scripts/steps/checks/capture_oas_snapshot.sh):
0 commit comments