Skip to content

Commit

Permalink
Add 404 spec for delete index, get document, delete document APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Vatsal <vatsal.v.anand@gmail.com>
  • Loading branch information
imvtsl committed Sep 28, 2024
1 parent 7d05664 commit 9798e59
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 1 deletion.
4 changes: 4 additions & 0 deletions spec/namespaces/_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,8 @@ paths:
responses:
'200':
$ref: '#/components/responses/get@200'
'404':
$ref: '#/components/responses/get@200'
head:
operationId: exists.0
x-operation-group: exists
Expand Down Expand Up @@ -1364,6 +1366,8 @@ paths:
responses:
'200':
$ref: '#/components/responses/delete@200'
'404':
$ref: '#/components/responses/delete@200'
/{index}/_explain/{id}:
get:
operationId: explain.0
Expand Down
7 changes: 7 additions & 0 deletions spec/namespaces/indices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,8 @@ paths:
responses:
'200':
$ref: '#/components/responses/indices.delete@200'
'404':
$ref: '#/components/responses/indices.delete@404'
/{index}/_alias:
get:
operationId: indices.get_alias.2
Expand Down Expand Up @@ -2400,6 +2402,11 @@ components:
application/json:
schema:
$ref: '../schemas/_common.yaml#/components/schemas/IndicesResponseBase'
indices.delete@404:
content:
application/json:
schema:
$ref: '../schemas/indices._common.yaml#/components/schemas/IndexErrorCause'
indices.delete_alias@200:
content:
application/json:
Expand Down
4 changes: 4 additions & 0 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2238,3 +2238,7 @@ components:
required:
- reason
- status
ResourceType:
type: string
enum:
- index_or_alias
26 changes: 26 additions & 0 deletions spec/schemas/indices._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1010,3 +1010,29 @@ components:
- mappings
- order
- settings
IndexErrorCause:
type: object
properties:
type:
description: The type of error
type: string
reason:
description: A human-readable explanation of the error, in english
type: string
root_cause:
type: array
items:
$ref: '#/components/schemas/IndexErrorCause'
index:
$ref: '_common.yaml#/components/schemas/IndexName'
index_uuid:
$ref: '_common.yaml#/components/schemas/Uuid'
resource.id:
$ref: '_common.yaml#/components/schemas/IndexName'
resource.type:
$ref: '_common.yaml#/components/schemas/ResourceType'
required:
- type
additionalProperties:
title: metadata
description: Additional details about the error.
16 changes: 16 additions & 0 deletions tests/default/indices/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,19 @@ chapters:
id: '1'
response:
status: 200
- synopsis: Retrieve a non existing document.
path: /{index}/_doc/{id}
method: GET
parameters:
index: movies
id: '1'
response:
status: 404
- synopsis: Delete a non existing document.
path: /{index}/_doc/{id}
method: DELETE
parameters:
index: movies
id: '1'
response:
status: 404
10 changes: 9 additions & 1 deletion tests/default/indices/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,12 @@ chapters:
version: '>= 2.0'
parameters:
index: books,games
cluster_manager_timeout: 10s
cluster_manager_timeout: 10s

- synopsis: Delete non existing index `movies`.
path: /{index}
method: DELETE
parameters:
index: movies
response:
status: 404

0 comments on commit 9798e59

Please sign in to comment.