From 208e02fd50e65bf7b05702b499aca33a3536ddbf Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 8 Nov 2023 13:27:15 -0500 Subject: [PATCH] [8.11] [OAS] Fix cases API data types for comments (#170698) (#170878) # Backport This will backport the following commits from `main` to `8.11`: - [[OAS] Fix cases API data types for comments (#170698)](https://github.com/elastic/kibana/pull/170698) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Lisa Cawley --- .../plugins/cases/docs/openapi/bundled.json | 126 +++++++++++++++++- .../plugins/cases/docs/openapi/bundled.yaml | 102 +++++++++++++- .../get_case_observability_response.yaml | 97 ++++++++++++++ .../examples/get_case_response.yaml | 1 + .../alert_comment_response_properties.yaml | 17 ++- .../openapi/paths/api@cases@{caseid}.yaml | 4 +- .../paths/s@{spaceid}@api@cases@{caseid}.yaml | 2 + 7 files changed, 328 insertions(+), 21 deletions(-) create mode 100644 x-pack/plugins/cases/docs/openapi/components/examples/get_case_observability_response.yaml diff --git a/x-pack/plugins/cases/docs/openapi/bundled.json b/x-pack/plugins/cases/docs/openapi/bundled.json index 80cdefd30e957..54a9c31d34312 100644 --- a/x-pack/plugins/cases/docs/openapi/bundled.json +++ b/x-pack/plugins/cases/docs/openapi/bundled.json @@ -1206,8 +1206,11 @@ "$ref": "#/components/schemas/case_response_properties" }, "examples": { - "getCaseResponse": { + "getDefaultCaseResponse": { "$ref": "#/components/examples/get_case_response" + }, + "getDefaultObservabilityCaseReponse": { + "$ref": "#/components/examples/get_case_observability_response" } } } @@ -3078,6 +3081,9 @@ "examples": { "getCaseResponse": { "$ref": "#/components/examples/get_case_response" + }, + "getObservabilityCaseReponse": { + "$ref": "#/components/examples/get_case_observability_response" } } } @@ -4614,13 +4620,16 @@ ], "properties": { "alertId": { - "type": "string", - "example": "6b24c4dc44bc720cfc92797f3d61fff952f2b2627db1fb4f8cc49f4530c4ff42" + "type": "array", + "items": { + "type": "string", + "example": "a6e12ac4-7bce-457b-84f6-d7ce8deb8446" + } }, "created_at": { "type": "string", "format": "date-time", - "example": "2022-03-24T02:31:03.210Z" + "example": "2023-11-06T19:29:38.424Z" }, "created_by": { "type": "object", @@ -4656,8 +4665,11 @@ "example": "73362370-ab1a-11ec-985f-97e55adae8b9" }, "index": { - "type": "string", - "example": ".internal.alerts-security.alerts-default-000001" + "type": "array", + "items": { + "type": "string", + "example": ".internal.alerts-security.alerts-default-000001" + } }, "owner": { "$ref": "#/components/schemas/owners" @@ -4723,10 +4735,11 @@ "updated_at": { "type": "string", "format": "date-time", - "example": null + "nullable": true }, "updated_by": { "type": "object", + "nullable": true, "required": [ "email", "full_name", @@ -6971,6 +6984,7 @@ "syncAlerts": true }, "owner": "cases", + "category": null, "customFields": [ { "type": "text", @@ -7017,6 +7031,104 @@ "external_service": null } }, + "get_case_observability_response": { + "summary": "Retrieves information about an Observability case including its alerts and comments.", + "value": { + "description": "An Observability case description.", + "owner": "observability", + "settings": { + "syncAlerts": false + }, + "tags": [ + "observability", + "tag 1" + ], + "title": "Observability case title 1", + "category": null, + "customFields": [], + "assignees": [ + { + "uid": "u_0wpfV1MqYDaXzLtRVY-gLMrddKDEmfz51Fszhj7hWC8_0" + } + ], + "connector": { + "id": "none", + "type": ".none", + "fields": null, + "name": "none" + }, + "severity": "low", + "status": "in-progress", + "duration": null, + "closed_at": null, + "closed_by": null, + "created_at": "2023-11-06T19:29:04.086Z", + "created_by": { + "username": "elastic", + "full_name": null, + "email": null + }, + "updated_at": "2023-11-06T19:47:55.662Z", + "updated_by": { + "username": "elastic", + "full_name": null, + "email": null, + "profile_uid": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0" + }, + "external_service": null, + "id": "c3ff7550-def1-4e90-b6bc-c9969a4a09b1", + "version": "WzI0NywyXQ==", + "totalComment": 1, + "totalAlerts": 1, + "comments": [ + { + "alertId": [ + "a6e12ac4-7bce-457b-84f6-d7ce8deb8446" + ], + "index": [ + ".internal.alerts-observability.logs.alerts-default-000001" + ], + "type": "alert", + "rule": { + "id": "03e4eb87-62ca-4e5d-9570-3d7625e9669d", + "name": "Observability rule" + }, + "owner": "observability", + "created_at": "2023-11-06T19:29:38.424Z", + "created_by": { + "email": null, + "full_name": null, + "username": "elastic", + "profile_uid": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0" + }, + "pushed_at": null, + "pushed_by": null, + "updated_at": null, + "updated_by": null, + "id": "59d438d0-79a9-4864-8d4b-e63adacebf6e", + "version": "WzY3LDJd" + }, + { + "comment": "The first comment.", + "type": "user", + "owner": "observability", + "created_at": "2023-11-06T19:29:57.812Z", + "created_by": { + "email": null, + "full_name": null, + "username": "elastic", + "profile_uid": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0" + }, + "pushed_at": null, + "pushed_by": null, + "updated_at": null, + "updated_by": null, + "id": "d99342d3-3aa3-4b80-90ec-a702607604f5", + "version": "WzcyLDJd" + } + ] + } + }, "get_case_alerts_response": { "summary": "Retrieves all alerts attached to a case", "value": [ diff --git a/x-pack/plugins/cases/docs/openapi/bundled.yaml b/x-pack/plugins/cases/docs/openapi/bundled.yaml index ec5c1db337f29..8347d7d85741b 100644 --- a/x-pack/plugins/cases/docs/openapi/bundled.yaml +++ b/x-pack/plugins/cases/docs/openapi/bundled.yaml @@ -811,8 +811,10 @@ paths: schema: $ref: '#/components/schemas/case_response_properties' examples: - getCaseResponse: + getDefaultCaseResponse: $ref: '#/components/examples/get_case_response' + getDefaultObservabilityCaseReponse: + $ref: '#/components/examples/get_case_observability_response' '401': description: Authorization information is missing or invalid. content: @@ -2017,6 +2019,8 @@ paths: examples: getCaseResponse: $ref: '#/components/examples/get_case_response' + getObservabilityCaseReponse: + $ref: '#/components/examples/get_case_observability_response' '401': description: Authorization information is missing or invalid. content: @@ -3068,12 +3072,14 @@ components: - type properties: alertId: - type: string - example: 6b24c4dc44bc720cfc92797f3d61fff952f2b2627db1fb4f8cc49f4530c4ff42 + type: array + items: + type: string + example: a6e12ac4-7bce-457b-84f6-d7ce8deb8446 created_at: type: string format: date-time - example: '2022-03-24T02:31:03.210Z' + example: '2023-11-06T19:29:38.424Z' created_by: type: object required: @@ -3100,8 +3106,10 @@ components: type: string example: 73362370-ab1a-11ec-985f-97e55adae8b9 index: - type: string - example: .internal.alerts-security.alerts-default-000001 + type: array + items: + type: string + example: .internal.alerts-security.alerts-default-000001 owner: $ref: '#/components/schemas/owners' pushed_at: @@ -3151,9 +3159,10 @@ components: updated_at: type: string format: date-time - example: null + nullable: true updated_by: type: object + nullable: true required: - email - full_name @@ -4769,6 +4778,7 @@ components: settings: syncAlerts: true owner: cases + category: null customFields: - type: text key: d312efda-ec2b-42ec-9e2c-84981795c581 @@ -4802,6 +4812,84 @@ components: type: .none fields: null external_service: null + get_case_observability_response: + summary: Retrieves information about an Observability case including its alerts and comments. + value: + description: An Observability case description. + owner: observability + settings: + syncAlerts: false + tags: + - observability + - tag 1 + title: Observability case title 1 + category: null + customFields: [] + assignees: + - uid: u_0wpfV1MqYDaXzLtRVY-gLMrddKDEmfz51Fszhj7hWC8_0 + connector: + id: none + type: .none + fields: null + name: none + severity: low + status: in-progress + duration: null + closed_at: null + closed_by: null + created_at: '2023-11-06T19:29:04.086Z' + created_by: + username: elastic + full_name: null + email: null + updated_at: '2023-11-06T19:47:55.662Z' + updated_by: + username: elastic + full_name: null + email: null + profile_uid: u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0 + external_service: null + id: c3ff7550-def1-4e90-b6bc-c9969a4a09b1 + version: WzI0NywyXQ== + totalComment: 1 + totalAlerts: 1 + comments: + - alertId: + - a6e12ac4-7bce-457b-84f6-d7ce8deb8446 + index: + - .internal.alerts-observability.logs.alerts-default-000001 + type: alert + rule: + id: 03e4eb87-62ca-4e5d-9570-3d7625e9669d + name: Observability rule + owner: observability + created_at: '2023-11-06T19:29:38.424Z' + created_by: + email: null + full_name: null + username: elastic + profile_uid: u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0 + pushed_at: null + pushed_by: null + updated_at: null + updated_by: null + id: 59d438d0-79a9-4864-8d4b-e63adacebf6e + version: WzY3LDJd + - comment: The first comment. + type: user + owner: observability + created_at: '2023-11-06T19:29:57.812Z' + created_by: + email: null + full_name: null + username: elastic + profile_uid: u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0 + pushed_at: null + pushed_by: null + updated_at: null + updated_by: null + id: d99342d3-3aa3-4b80-90ec-a702607604f5 + version: WzcyLDJd get_case_alerts_response: summary: Retrieves all alerts attached to a case value: diff --git a/x-pack/plugins/cases/docs/openapi/components/examples/get_case_observability_response.yaml b/x-pack/plugins/cases/docs/openapi/components/examples/get_case_observability_response.yaml new file mode 100644 index 0000000000000..49b9aa692a335 --- /dev/null +++ b/x-pack/plugins/cases/docs/openapi/components/examples/get_case_observability_response.yaml @@ -0,0 +1,97 @@ +summary: Retrieves information about an Observability case including its alerts and comments. +value: + { + "description": "An Observability case description.", + "owner": "observability", + "settings": { + "syncAlerts": false + }, + "tags": [ + "observability", + "tag 1" + ], + "title": "Observability case title 1", + "category": null, + "customFields": [], + "assignees": [ + { + "uid": "u_0wpfV1MqYDaXzLtRVY-gLMrddKDEmfz51Fszhj7hWC8_0" + } + ], + "connector": { + "id": "none", + "type": ".none", + "fields": null, + "name": "none" + }, + "severity": "low", + "status": "in-progress", + "duration": null, + "closed_at": null, + "closed_by": null, + "created_at": "2023-11-06T19:29:04.086Z", + "created_by": { + "username": "elastic", + "full_name": null, + "email": null + }, + "updated_at": "2023-11-06T19:47:55.662Z", + "updated_by": { + "username": "elastic", + "full_name": null, + "email": null, + "profile_uid": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0" + }, + "external_service": null, + "id": "c3ff7550-def1-4e90-b6bc-c9969a4a09b1", + "version": "WzI0NywyXQ==", + "totalComment": 1, + "totalAlerts": 1, + "comments": [ + { + "alertId": [ + "a6e12ac4-7bce-457b-84f6-d7ce8deb8446" + ], + "index": [ + ".internal.alerts-observability.logs.alerts-default-000001" + ], + "type": "alert", + "rule": { + "id": "03e4eb87-62ca-4e5d-9570-3d7625e9669d", + "name": "Observability rule" + }, + "owner": "observability", + "created_at": "2023-11-06T19:29:38.424Z", + "created_by": { + "email": null, + "full_name": null, + "username": "elastic", + "profile_uid": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0" + }, + "pushed_at": null, + "pushed_by": null, + "updated_at": null, + "updated_by": null, + "id": "59d438d0-79a9-4864-8d4b-e63adacebf6e", + "version": "WzY3LDJd" + }, + { + "comment": "The first comment.", + "type": "user", + "owner": "observability", + "created_at": "2023-11-06T19:29:57.812Z", + "created_by": { + "email": null, + "full_name": null, + "username": "elastic", + "profile_uid": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0" + }, + "pushed_at": null, + "pushed_by": null, + "updated_at": null, + "updated_by": null, + "id": "d99342d3-3aa3-4b80-90ec-a702607604f5", + "version": "WzcyLDJd" + } + ] +} \ No newline at end of file diff --git a/x-pack/plugins/cases/docs/openapi/components/examples/get_case_response.yaml b/x-pack/plugins/cases/docs/openapi/components/examples/get_case_response.yaml index d4fc3db97a169..50dabd2dc8a9b 100644 --- a/x-pack/plugins/cases/docs/openapi/components/examples/get_case_response.yaml +++ b/x-pack/plugins/cases/docs/openapi/components/examples/get_case_response.yaml @@ -27,6 +27,7 @@ value: "tags":["tag 1"], "settings":{"syncAlerts":true}, "owner":"cases", + "category":null, "customFields": [ { "type": "text", diff --git a/x-pack/plugins/cases/docs/openapi/components/schemas/alert_comment_response_properties.yaml b/x-pack/plugins/cases/docs/openapi/components/schemas/alert_comment_response_properties.yaml index aa39aad1381a0..443d9dcc55523 100644 --- a/x-pack/plugins/cases/docs/openapi/components/schemas/alert_comment_response_properties.yaml +++ b/x-pack/plugins/cases/docs/openapi/components/schemas/alert_comment_response_properties.yaml @@ -4,12 +4,14 @@ required: - type properties: alertId: - type: string - example: 6b24c4dc44bc720cfc92797f3d61fff952f2b2627db1fb4f8cc49f4530c4ff42 + type: array + items: + type: string + example: a6e12ac4-7bce-457b-84f6-d7ce8deb8446 created_at: type: string format: date-time - example: 2022-03-24T02:31:03.210Z + example: 2023-11-06T19:29:38.424Z created_by: type: object required: @@ -22,8 +24,10 @@ properties: type: string example: 73362370-ab1a-11ec-985f-97e55adae8b9 index: - type: string - example: .internal.alerts-security.alerts-default-000001 + type: array + items: + type: string + example: .internal.alerts-security.alerts-default-000001 owner: $ref: 'owners.yaml' pushed_at: @@ -52,9 +56,10 @@ properties: updated_at: type: string format: date-time - example: null + nullable: true updated_by: type: object + nullable: true required: - email - full_name diff --git a/x-pack/plugins/cases/docs/openapi/paths/api@cases@{caseid}.yaml b/x-pack/plugins/cases/docs/openapi/paths/api@cases@{caseid}.yaml index 9629049c9b342..c5b52a52b741f 100644 --- a/x-pack/plugins/cases/docs/openapi/paths/api@cases@{caseid}.yaml +++ b/x-pack/plugins/cases/docs/openapi/paths/api@cases@{caseid}.yaml @@ -18,8 +18,10 @@ get: schema: $ref: '../components/schemas/case_response_properties.yaml' examples: - getCaseResponse: + getDefaultCaseResponse: $ref: '../components/examples/get_case_response.yaml' + getDefaultObservabilityCaseReponse: + $ref: '../components/examples/get_case_observability_response.yaml' '401': description: Authorization information is missing or invalid. content: diff --git a/x-pack/plugins/cases/docs/openapi/paths/s@{spaceid}@api@cases@{caseid}.yaml b/x-pack/plugins/cases/docs/openapi/paths/s@{spaceid}@api@cases@{caseid}.yaml index 32e3434f15add..aecd3f6394bb7 100644 --- a/x-pack/plugins/cases/docs/openapi/paths/s@{spaceid}@api@cases@{caseid}.yaml +++ b/x-pack/plugins/cases/docs/openapi/paths/s@{spaceid}@api@cases@{caseid}.yaml @@ -21,6 +21,8 @@ get: examples: getCaseResponse: $ref: '../components/examples/get_case_response.yaml' + getObservabilityCaseReponse: + $ref: '../components/examples/get_case_observability_response.yaml' '401': description: Authorization information is missing or invalid. content: