Skip to content

Commit 745db53

Browse files
authored
Add operation summaries for index template APIs (#2634)
1 parent 21b532f commit 745db53

File tree

14 files changed

+87
-49
lines changed

14 files changed

+87
-49
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ dump-routes: ## Create a new schema with all generics expanded
6060
contrib: | generate license-check spec-format-fix transform-to-openapi ## Pre contribution target
6161

6262
lint-docs: ## Lint the OpenAPI documents
63-
@npx @stoplight/spectral-cli lint output/openapi/elasticsearch-serverless-openapi.json
63+
@npx @stoplight/spectral-cli lint output/openapi/*.json --ruleset .spectral.yaml
64+
65+
lint-docs-serverless: ## Lint only the serverless OpenAPI document
66+
@npx @stoplight/spectral-cli lint output/openapi/elasticsearch-serverless-openapi.json --ruleset .spectral.yaml
6467

6568
help: ## Display help
6669
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,13 @@ Usage:
6969
spec-dangling-types Generate the dangling types rreport
7070
setup Install dependencies for contrib target
7171
clean-dep Clean npm dependencies
72+
transform-expand-generics Create a new schema with all generics expanded
73+
transform-to-openapi Generate the OpenAPI definition from the compiled schema
74+
filter-for-serverless Generate the serverless version from the compiled schema
75+
dump-routes Create a new schema with all generics expanded
7276
contrib Pre contribution target
77+
lint-docs Lint the OpenAPI documents
78+
lint-docs-serverless Lint only the serverless OpenAPI document
7379
help Display help
7480
```
7581

docs/doc-comments-guide.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ A specification is not only about formalizing data structures, it's also about e
44

55
Documentation of the TypeScript specification is made using [JSDoc](https://jsdoc.app/) comments, i.e. multiline comments starting with `/**` above a type or field declaration.
66

7+
The first phrase is used as the mandatory operation summary in the OpenAPI document.
8+
Refer to [API documentation guidelines](https://docs.elastic.dev/content-architecture/oas#summaries).
9+
10+
NOTE: You must add a period or `\n` at the end of the phrase for it to parse correctly.
11+
The period will be properly omitted from the output OpenAPI document.
12+
713
Additional lines start with a `*` followed by a space. Long lines are allowed but it's better if text is formatted to a maximum of 120 characters per line.
814

915
## Example
1016

1117
```ts
1218
/**
19+
* Get ranking evaluation.
1320
* Enables you to evaluate the quality of ranked search results over a set of typical search queries.
1421
* @rest_spec_name rank_eval
1522
* @availability stack since=6.2.0 stability=stable

output/openapi/elasticsearch-openapi.json

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11783,7 +11783,8 @@
1178311783
"tags": [
1178411784
"indices.get_index_template"
1178511785
],
11786-
"summary": "Returns information about one or more index templates",
11786+
"summary": "Get index templates",
11787+
"description": "Returns information about one or more index templates.",
1178711788
"externalDocs": {
1178811789
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html"
1178911790
},
@@ -11815,7 +11816,7 @@
1181511816
"tags": [
1181611817
"indices.put_index_template"
1181711818
],
11818-
"summary": "Creates or updates an index template",
11819+
"summary": "Create or update an index template",
1181911820
"description": "Index templates define settings, mappings, and aliases that can be applied automatically to new indices.",
1182011821
"externalDocs": {
1182111822
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html"
@@ -11848,7 +11849,7 @@
1184811849
"tags": [
1184911850
"indices.put_index_template"
1185011851
],
11851-
"summary": "Creates or updates an index template",
11852+
"summary": "Create or update an index template",
1185211853
"description": "Index templates define settings, mappings, and aliases that can be applied automatically to new indices.",
1185311854
"externalDocs": {
1185411855
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-put-template.html"
@@ -11881,8 +11882,8 @@
1188111882
"tags": [
1188211883
"indices.delete_index_template"
1188311884
],
11884-
"summary": "The provided <index-template> may contain multiple template names separated by a comma",
11885-
"description": "If multiple template names are specified then there is no wildcard support and the provided names should match completely with existing templates.",
11885+
"summary": "Delete an index template",
11886+
"description": "The provided <index-template> may contain multiple template names separated by a comma. If multiple template names are specified then there is no wildcard support and the provided names should match completely with existing templates.",
1188611887
"externalDocs": {
1188711888
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-delete-template.html"
1188811889
},
@@ -11980,7 +11981,8 @@
1198011981
"tags": [
1198111982
"indices.get_template"
1198211983
],
11983-
"summary": "Retrieves information about one or more index templates",
11984+
"summary": "Get index templates",
11985+
"description": "Retrieves information about one or more index templates.",
1198411986
"externalDocs": {
1198511987
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html"
1198611988
},
@@ -12009,7 +12011,7 @@
1200912011
"tags": [
1201012012
"indices.put_template"
1201112013
],
12012-
"summary": "Creates or updates an index template",
12014+
"summary": "Create or update an index template",
1201312015
"description": "Index templates define settings, mappings, and aliases that can be applied automatically to new indices.",
1201412016
"externalDocs": {
1201512017
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates-v1.html"
@@ -12045,7 +12047,7 @@
1204512047
"tags": [
1204612048
"indices.put_template"
1204712049
],
12048-
"summary": "Creates or updates an index template",
12050+
"summary": "Create or update an index template",
1204912051
"description": "Index templates define settings, mappings, and aliases that can be applied automatically to new indices.",
1205012052
"externalDocs": {
1205112053
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates-v1.html"
@@ -12136,7 +12138,8 @@
1213612138
"tags": [
1213712139
"indices.exists_template"
1213812140
],
12139-
"summary": "Returns information about whether a particular index template exists",
12141+
"summary": "Check existence of index templates",
12142+
"description": "Returns information about whether a particular index template exists.",
1214012143
"externalDocs": {
1214112144
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-template-exists-v1.html"
1214212145
},
@@ -12975,7 +12978,8 @@
1297512978
"tags": [
1297612979
"indices.get_index_template"
1297712980
],
12978-
"summary": "Returns information about one or more index templates",
12981+
"summary": "Get index templates",
12982+
"description": "Returns information about one or more index templates.",
1297912983
"externalDocs": {
1298012984
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template.html"
1298112985
},
@@ -13426,7 +13430,8 @@
1342613430
"tags": [
1342713431
"indices.get_template"
1342813432
],
13429-
"summary": "Retrieves information about one or more index templates",
13433+
"summary": "Get index templates",
13434+
"description": "Retrieves information about one or more index templates.",
1343013435
"externalDocs": {
1343113436
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-template-v1.html"
1343213437
},
@@ -14355,6 +14360,8 @@
1435514360
"tags": [
1435614361
"indices.simulate_index_template"
1435714362
],
14363+
"summary": "Simulate an index",
14364+
"description": "Returns the index configuration that would be applied to the specified index from an existing index template.",
1435814365
"externalDocs": {
1435914366
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-index.html"
1436014367
},
@@ -14425,7 +14432,8 @@
1442514432
"tags": [
1442614433
"indices.simulate_template"
1442714434
],
14428-
"summary": "Returns the index configuration that would be applied by a particular index template",
14435+
"summary": "Simulate an index template",
14436+
"description": "Returns the index configuration that would be applied by a particular index template.",
1442914437
"externalDocs": {
1443014438
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html"
1443114439
},
@@ -14456,7 +14464,8 @@
1445614464
"tags": [
1445714465
"indices.simulate_template"
1445814466
],
14459-
"summary": "Returns the index configuration that would be applied by a particular index template",
14467+
"summary": "Simulate an index template",
14468+
"description": "Returns the index configuration that would be applied by a particular index template.",
1446014469
"externalDocs": {
1446114470
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-simulate-template.html"
1446214471
},

output/openapi/elasticsearch-serverless-openapi.json

Lines changed: 16 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)