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
Copy file name to clipboardExpand all lines: docs/add-new-api.md
+11-11Lines changed: 11 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,11 @@
3
3
It might happen that a new API in Elasticsearch is not yet defined
4
4
in this repository, or we do have an endpoint definition in [`/specification/_json_spec`](../specification/_json_spec)
5
5
but we don't have a type definition for it.
6
-
In this document you will see how to add a new endpopint and how to add a new endpoint definition.
6
+
In this document you will see how to add a new endpoint and how to add a new endpoint definition.
7
7
8
8
## How to add a new endpoint
9
9
10
-
Add a new endpoint is straightforward, you only need to copy-paste the json rest-api-spec defintion
10
+
Add a new endpoint is straightforward, you only need to copy-paste the json rest-api-spec definition
11
11
from the Elasticsearch repository inside [`/specification/_json_spec`](../specification/_json_spec)
12
12
and you are good to go.
13
13
@@ -17,10 +17,10 @@ or [here](https://github.com/elastic/elasticsearch/tree/7.x/x-pack/plugin/src/te
17
17
## How to add the definition of an endpoint
18
18
19
19
Once you have added a new endpoint definition, the next step is to add its type definition.
20
-
First of all, you should find the most approariate place inside [`/specification`](../specification)
20
+
First of all, you should find the most appropriate place inside [`/specification`](../specification)
21
21
where to put the new definition. The content of [`/specification`](../specification)
22
-
tryied to mimic the Elasticsearch online documentation, so you can use it as inspiration.
23
-
For example, the index document defintion can be found in [`/specification/_global/index`](../specification/_global/index).
22
+
tried to mimic the Elasticsearch online documentation, so you can use it as inspiration.
23
+
For example, the index document definition can be found in [`/specification/_global/index`](../specification/_global/index).
24
24
25
25
Once you have found the best place for the new definition, you should create a new file for it.
26
26
The filename should be the same of the type definition you are writing, for example:
@@ -40,16 +40,16 @@ you can define it in the same file where it's used, unless is a commonly used ty
40
40
41
41
### Add the endpoint request definition
42
42
43
-
Request definitions are slighly different from other definitions.
43
+
Request definitions are slightly different from other definitions.
44
44
It is required that the request definition is named `Request`.
45
-
A request definition is an interface and should contains three top level keys:
45
+
A request definition is an interface and should contain these top level keys:
46
46
47
47
-`urls`: the URL paths templates and allowed HTTP methods
48
48
-`path_parts`: the path parameters (eg: `indices`, `id`...)
49
49
-`query_parameters`: the query parameters (eg: `timeout`, `pipeline`...)
50
50
-`body`: the body parameters (eg: `query` or user defined entities)
51
51
52
-
Furthermore, every request definition **must** contain three JS Doc tags:
52
+
Furthermore, every request definition **must** contain these JS Doc tags:
53
53
54
54
-`@rest_spec_name`: the API name (eg: `search`, `indices.create`...).
55
55
-`@availability` Which flavor of Elasticsearch is this API available for? (eg `stack` or `serverless`)
@@ -130,7 +130,7 @@ class Response {
130
130
```
131
131
132
132
As you can see, for responses there are no custom top level keys, as the
133
-
response definition represents the body of a succesful response.
133
+
response definition represents the body of a successful response.
134
134
135
135
#### Generics
136
136
@@ -172,7 +172,7 @@ class Response {
172
172
Add an `examples` folder and `request` and `xxx_response` subfolders (where `xxx` is the relevant response code). The file names within these folders should be unique (for example,`DownsampleRequestExample1.yaml` not `RequestExample1.yaml`).
173
173
174
174
These examples are for use in the API documentation and must adhere to the [OpenAPI 3.0 Example object specification](https://spec.openapis.org/oas/v3.0.3#example-object). They must have a `value` field that contains the request or response body.
175
-
If there are multiple examples for the endpoint, they must each have a brief `summary` field, which is used as the label for the example. You can also optionaly provide an explanation in a `description` field.
175
+
If there are multiple examples for the endpoint, they must each have a brief `summary` field, which is used as the label for the example. You can also optionally provide an explanation in a `description` field.
176
176
177
177
For example:
178
178
@@ -196,5 +196,5 @@ value: |-
196
196
```
197
197
198
198
NOTE: A good example covers a very common use case or demonstrates a more complex but critical use case.
199
-
It involves realistic data sets (rather than generic "hello world" values).
199
+
It involves realistic data sets (rather than generic "hello world" values).
200
200
If it requires detailed setup or explanations, however, it is more appropriate for coverage in longer-form narrative documentation.
0 commit comments