From 037cbce707fc2ffba1397b87673b6da80db3851c Mon Sep 17 00:00:00 2001 From: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:41:22 +0100 Subject: [PATCH] [OAS] Adding update and delete to runtime fields OAS (#163777) This PR drafts openAPI specifications for: - [Delete runtime field API](https://www.elastic.co/guide/en/kibana/master/data-views-runtime-field-api-delete.html). - [Update runtime field API](https://www.elastic.co/guide/en/kibana/master/data-views-runtime-field-api-update.html) Relates to https://github.com/elastic/kibana/issues/137240 --- .../data_views/docs/openapi/bundled.json | 103 ++++++++++++++++++ .../data_views/docs/openapi/bundled.yaml | 62 +++++++++++ .../update_runtime_field_request.yaml | 9 ++ ...ew@{viewid}@runtime_field@{fieldname}.yaml | 58 ++++++++++ 4 files changed, 232 insertions(+) create mode 100644 src/plugins/data_views/docs/openapi/components/examples/update_runtime_field_request.yaml diff --git a/src/plugins/data_views/docs/openapi/bundled.json b/src/plugins/data_views/docs/openapi/bundled.json index 09515ba8b1ad4c..894e5e02f45642 100644 --- a/src/plugins/data_views/docs/openapi/bundled.json +++ b/src/plugins/data_views/docs/openapi/bundled.json @@ -462,6 +462,99 @@ } } }, + "delete": { + "summary": "Delete a runtime field from a data view.", + "operationId": "deleteRuntimeField", + "description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.\n", + "tags": [ + "data views" + ], + "parameters": [ + { + "$ref": "#/components/parameters/field_name" + }, + { + "$ref": "#/components/parameters/view_id" + } + ], + "responses": { + "200": { + "description": "Indicates a successful call." + }, + "404": { + "description": "Object is not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/404_response" + } + } + } + } + } + }, + "post": { + "summary": "Update an existing runtime field.", + "operationId": "updateRuntimeField", + "description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.\n", + "tags": [ + "data views" + ], + "parameters": [ + { + "$ref": "#/components/parameters/field_name" + }, + { + "$ref": "#/components/parameters/view_id" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data_view": { + "type": "object" + }, + "fields": { + "type": "array", + "items": { + "type": "object" + } + } + } + }, + "examples": { + "updateRuntimeFieldRequest": { + "$ref": "#/components/examples/update_runtime_field_request" + } + } + } + } + }, + "responses": { + "200": { + "description": "Indicates a successful call." + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/400_response" + } + } + } + } + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, "servers": [ { "url": "https://localhost:5601" @@ -2434,6 +2527,16 @@ } } }, + "update_runtime_field_request": { + "summary": "Update an existing runtime field on a data view.", + "value": { + "runtimeField": { + "script": { + "source": "emit(doc[\"bar\"].value)" + } + } + } + }, "get_default_data_view_response": { "summary": "The get default data view API returns the default data view identifier.", "value": { diff --git a/src/plugins/data_views/docs/openapi/bundled.yaml b/src/plugins/data_views/docs/openapi/bundled.yaml index 01f5b4eb3615c0..7fa381a6a3d02a 100644 --- a/src/plugins/data_views/docs/openapi/bundled.yaml +++ b/src/plugins/data_views/docs/openapi/bundled.yaml @@ -280,6 +280,62 @@ paths: application/json: schema: $ref: '#/components/schemas/404_response' + delete: + summary: Delete a runtime field from a data view. + operationId: deleteRuntimeField + description: | + This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. + tags: + - data views + parameters: + - $ref: '#/components/parameters/field_name' + - $ref: '#/components/parameters/view_id' + responses: + '200': + description: Indicates a successful call. + '404': + description: Object is not found. + content: + application/json: + schema: + $ref: '#/components/schemas/404_response' + post: + summary: Update an existing runtime field. + operationId: updateRuntimeField + description: | + This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. + tags: + - data views + parameters: + - $ref: '#/components/parameters/field_name' + - $ref: '#/components/parameters/view_id' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + data_view: + type: object + fields: + type: array + items: + type: object + examples: + updateRuntimeFieldRequest: + $ref: '#/components/examples/update_runtime_field_request' + responses: + '200': + description: Indicates a successful call. + '400': + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/400_response' + servers: + - url: https://localhost:5601 servers: - url: https://localhost:5601 /api/data_views/default: @@ -1832,6 +1888,12 @@ components: fieldAttrs: {} allowNoIndex: false name: Kibana Sample Data Flights + update_runtime_field_request: + summary: Update an existing runtime field on a data view. + value: + runtimeField: + script: + source: emit(doc["bar"].value) get_default_data_view_response: summary: The get default data view API returns the default data view identifier. value: diff --git a/src/plugins/data_views/docs/openapi/components/examples/update_runtime_field_request.yaml b/src/plugins/data_views/docs/openapi/components/examples/update_runtime_field_request.yaml new file mode 100644 index 00000000000000..4cc70238b5ee8e --- /dev/null +++ b/src/plugins/data_views/docs/openapi/components/examples/update_runtime_field_request.yaml @@ -0,0 +1,9 @@ +summary: Update an existing runtime field on a data view. +value: + { + "runtimeField": { + "script": { + "source": 'emit(doc["bar"].value)' + } + } +} \ No newline at end of file diff --git a/src/plugins/data_views/docs/openapi/paths/api@data_views@data_view@{viewid}@runtime_field@{fieldname}.yaml b/src/plugins/data_views/docs/openapi/paths/api@data_views@data_view@{viewid}@runtime_field@{fieldname}.yaml index 15c5659f09d4ac..55f1e14dafb8a2 100644 --- a/src/plugins/data_views/docs/openapi/paths/api@data_views@data_view@{viewid}@runtime_field@{fieldname}.yaml +++ b/src/plugins/data_views/docs/openapi/paths/api@data_views@data_view@{viewid}@runtime_field@{fieldname}.yaml @@ -31,5 +31,63 @@ get: application/json: schema: $ref: '../components/schemas/404_response.yaml' + +delete: + summary: Delete a runtime field from a data view. + operationId: deleteRuntimeField + description: > + This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. + tags: + - data views + parameters: + - $ref: '../components/parameters/field_name.yaml' + - $ref: '../components/parameters/view_id.yaml' + responses: + '200': + description: Indicates a successful call. + '404': + description: Object is not found. + content: + application/json: + schema: + $ref: '../components/schemas/404_response.yaml' + +post: + summary: Update an existing runtime field. + operationId: updateRuntimeField + description: > + This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. + tags: + - data views + parameters: + - $ref: '../components/parameters/field_name.yaml' + - $ref: '../components/parameters/view_id.yaml' + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + data_view: + type: object + fields: + type: array + items: + type: object + examples: + updateRuntimeFieldRequest: + $ref: '../components/examples/update_runtime_field_request.yaml' + responses: + '200': + description: Indicates a successful call. + '400': + description: Bad request + content: + application/json: + schema: + $ref: '../components/schemas/400_response.yaml' + servers: + - url: https://localhost:5601 servers: - url: https://localhost:5601