Skip to content

Commit

Permalink
Corrected /{index}/_create/{id} 201 response. (#669)
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <dblock@amazon.com>
  • Loading branch information
dblock authored Nov 13, 2024
1 parent 52f8e2c commit 2cdd46a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed incorrect `style` in `indices.get_mapping::query.index` ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Removed invalid `required` from `ppl` responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Added schema for security API error responses ([#646](https://github.com/opensearch-project/opensearch-api-specification/pull/646))
- Fixed `/{index}/_create/{id}` returning `201` ([#669](https://github.com/opensearch-project/opensearch-api-specification/pull/669))

## [0.1.0] - 2024-10-25

Expand Down
10 changes: 5 additions & 5 deletions spec/namespaces/_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1241,8 +1241,8 @@ paths:
requestBody:
$ref: '#/components/requestBodies/create'
responses:
'200':
$ref: '#/components/responses/create@200'
'201':
$ref: '#/components/responses/create@201'
put:
operationId: create.1
x-operation-group: create
Expand All @@ -1266,8 +1266,8 @@ paths:
requestBody:
$ref: '#/components/requestBodies/create'
responses:
'200':
$ref: '#/components/responses/create@200'
'201':
$ref: '#/components/responses/create@201'
/{index}/_delete_by_query:
post:
operationId: delete_by_query.0
Expand Down Expand Up @@ -2834,7 +2834,7 @@ components:
required:
- _shards
- count
create@200:
create@201:
content:
application/json:
schema:
Expand Down
32 changes: 32 additions & 0 deletions tests/default/indices/create.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test inserting and retrieving a doc.
epilogues:
- path: /movies
method: DELETE
status: [200, 404]
chapters:
- synopsis: Create a document it doesn't already exist (POST).
path: /{index}/_create/{id}
method: POST
parameters:
index: movies
id: '1'
request:
payload:
title: Beauty and the Beast
year: 1991
response:
status: 201
- synopsis: Create a document it doesn't already exist (PUT).
path: /{index}/_create/{id}
method: PUT
parameters:
index: movies
id: '2'
request:
payload:
title: To Kill a Mockingbird
year: 1960
response:
status: 201

0 comments on commit 2cdd46a

Please sign in to comment.