From 2cdd46a18f5c52e5e11765e1939f6214d71aa1fa Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Wed, 13 Nov 2024 14:53:04 -0500 Subject: [PATCH] Corrected /{index}/_create/{id} 201 response. (#669) Signed-off-by: dblock --- CHANGELOG.md | 1 + spec/namespaces/_core.yaml | 10 +++++----- tests/default/indices/create.yaml | 32 +++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 tests/default/indices/create.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 47df345f2..d24b75f3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/spec/namespaces/_core.yaml b/spec/namespaces/_core.yaml index af76fa7e3..fafc809b3 100644 --- a/spec/namespaces/_core.yaml +++ b/spec/namespaces/_core.yaml @@ -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 @@ -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 @@ -2834,7 +2834,7 @@ components: required: - _shards - count - create@200: + create@201: content: application/json: schema: diff --git a/tests/default/indices/create.yaml b/tests/default/indices/create.yaml new file mode 100644 index 000000000..b002fadfe --- /dev/null +++ b/tests/default/indices/create.yaml @@ -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