Skip to content

Commit

Permalink
Added text/plain responses to cat APIs.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock committed Jun 26, 2024
1 parent 35f3a5c commit 83393eb
Show file tree
Hide file tree
Showing 11 changed files with 211 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added `cancel_after_time_interval` and `phase_took` in `_search` ([#353](https://github.com/opensearch-project/opensearch-api-specification/pull/353))
- Added support for testing `application/x-ndjson` payloads ([#355](https://github.com/opensearch-project/opensearch-api-specification/pull/355))
- Added SPECIFICATION_TESTING.md [#359](https://github.com/opensearch-project/opensearch-api-specification/pull/359)
- Added support for `text/plain` responses in `_cat` APIs ([#360](https://github.com/opensearch-project/opensearch-api-specification/pull/360))

### Changed

Expand Down
23 changes: 23 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@eslint/js": "^9.1.1",
"@stylistic/eslint-plugin": "^2.3.0",
"@types/jest": "^29.5.12",
"@types/qs": "^6.9.15",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"ajv-errors": "^3.0.0",
"eslint": "^8.57.0",
Expand All @@ -51,6 +52,7 @@
"jest": "^29.7.0",
"json-diff-ts": "^4.0.1",
"json-schema-to-typescript": "^14.0.4",
"qs": "^6.12.1",
"ts-jest": "^29.1.2"
}
}
46 changes: 45 additions & 1 deletion spec/namespaces/cat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,8 @@ components:
cat.aliases@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -797,6 +799,8 @@ components:
cat.all_pit_segments@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -805,6 +809,8 @@ components:
cat.allocation@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -815,6 +821,8 @@ components:
cat.count@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -823,6 +831,8 @@ components:
cat.fielddata@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -831,6 +841,8 @@ components:
cat.health@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -845,6 +857,8 @@ components:
cat.indices@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -853,6 +867,8 @@ components:
cat.master@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -861,6 +877,8 @@ components:
cat.nodeattrs@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -869,6 +887,8 @@ components:
cat.nodes@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -877,6 +897,8 @@ components:
cat.pending_tasks@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -885,6 +907,8 @@ components:
cat.pit_segments@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -893,6 +917,8 @@ components:
cat.plugins@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -901,6 +927,8 @@ components:
cat.recovery@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -909,6 +937,8 @@ components:
cat.repositories@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -917,6 +947,8 @@ components:
cat.segment_replication@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -925,6 +957,8 @@ components:
cat.segments@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -933,6 +967,8 @@ components:
cat.shards@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -941,6 +977,8 @@ components:
cat.snapshots@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -949,6 +987,8 @@ components:
cat.tasks@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -957,6 +997,8 @@ components:
cat.templates@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand All @@ -965,6 +1007,8 @@ components:
cat.thread_pool@200:
description: ''
content:
text/plain:
type: string
application/json:
schema:
type: array
Expand Down Expand Up @@ -1009,9 +1053,9 @@ components:
in: query
description: Return help information.
schema:
description: Return help information.
type: boolean
default: false
description: Return help information.
cat.aliases::query.local:
name: local
in: query
Expand Down
1 change: 0 additions & 1 deletion tests/_core/bulk.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$schema: ../../json_schemas/test_story.schema.yaml

skip: false
description: Test bulk endpoint.
epilogues:
- path: /books,movies
Expand Down
1 change: 0 additions & 1 deletion tests/_core/search.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$schema: ../../json_schemas/test_story.schema.yaml

skip: false
description: Test search endpoint.
prologues:
- path: /movies/_doc
Expand Down
19 changes: 19 additions & 0 deletions tests/cat/aliases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test cat/aliases endpoints.
chapters:
- synopsis: Cat with a text response.
path: /_cat/aliases
method: GET
response:
status: 200
content_type: text/plain
- synopsis: Cat with a json response.
path: /_cat/aliases
parameters:
format: json
method: GET
response:
status: 200
content_type: application/json
payload: []
58 changes: 58 additions & 0 deletions tests/cat/health.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
$schema: ../../json_schemas/test_story.schema.yaml

description: Test cat/health endpoints.
chapters:
- synopsis: Cat with a default text response.
method: GET
path: /_cat/health
response:
status: 200
content_type: text/plain
- synopsis: Cat with verbose output (v=true).
method: GET
path: /_cat/health
parameters:
v: true
response:
status: 200
content_type: text/plain
- synopsis: Cat with headers (h=header1,header2).
method: GET
path: /_cat/health
parameters:
h:
- status
- timestamp
response:
status: 200
content_type: text/plain
- synopsis: Cat displaying all available headers (help=true).
method: GET
path: /_cat/health
parameters:
help: true
response:
status: 200
content_type: text/plain
- synopsis: Cat with sorted results.
method: GET
path: /_cat/health
parameters:
s:
- status
response:
status: 200
content_type: text/plain
- synopsis: Cat with a json response.
method: GET
path: /_cat/health
parameters:
format: json
response:
status: 200
content_type: application/json
payload:
- node.total: '1'
status: yellow
node.data: '1'
discovered_cluster_manager: 'true'
1 change: 0 additions & 1 deletion tests/cat/index.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$schema: ../../json_schemas/test_story.schema.yaml

skip: false
description: Test cat endpoints.
chapters:
- synopsis: Cat with a json response.
Expand Down
Loading

0 comments on commit 83393eb

Please sign in to comment.