Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions oas_docs/output/kibana.serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18278,7 +18278,6 @@ paths:
'200':
content:
application/json:
description: Elasticsearch update by query or update by IDs response
examples:
add:
value:
Expand All @@ -18297,7 +18296,13 @@ paths:
total: 1
updated: 1
version_conflicts: 0
description: Indicates a successful call.
schema:
additionalProperties: true
description: Elasticsearch update by query response
type: object
description: |
Indicates a successful call. The body matches an Elasticsearch update-by-query response
(for example `took`, `updated`, `failures`).
'400':
content:
application/json:
Expand Down Expand Up @@ -25369,16 +25374,18 @@ paths:
requestBody:
content:
application/json:
examples:
createSharedExceptionList:
value:
description: This is a sample detection type exception list.
list_id: simple_list
name: Sample Detection Exception List
namespace_type: single
os_types:
- linux
tags:
- malware
schema:
example:
description: This is a sample detection type exception list.
list_id: simple_list
name: Sample Detection Exception List
namespace_type: single
os_types:
- linux
tags:
- malware
type: object
properties:
description:
Expand Down
29 changes: 18 additions & 11 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20827,7 +20827,6 @@ paths:
'200':
content:
application/json:
description: Elasticsearch update by query or update by IDs response
examples:
add:
value:
Expand All @@ -20846,7 +20845,13 @@ paths:
total: 1
updated: 1
version_conflicts: 0
description: Indicates a successful call.
schema:
additionalProperties: true
description: Elasticsearch update by query response
type: object
description: |
Indicates a successful call. The body matches an Elasticsearch update-by-query response
(for example `took`, `updated`, `failures`).
'400':
content:
application/json:
Expand Down Expand Up @@ -28412,16 +28417,18 @@ paths:
requestBody:
content:
application/json:
examples:
createSharedExceptionList:
value:
description: This is a sample detection type exception list.
list_id: simple_list
name: Sample Detection Exception List
namespace_type: single
os_types:
- linux
tags:
- malware
schema:
example:
description: This is a sample detection type exception list.
list_id: simple_list
name: Sample Detection Exception List
namespace_type: single
os_types:
- linux
tags:
- malware
type: object
properties:
description:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"./oas_docs/output/kibana.yaml": 202,
"./oas_docs/output/kibana.serverless.yaml": 185
"./oas_docs/output/kibana.yaml": 200,
"./oas_docs/output/kibana.serverless.yaml": 183
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ paths:
required:
- name
- description
example:
list_id: simple_list
name: Sample Detection Exception List
description: This is a sample detection type exception list.
namespace_type: single
tags: [malware]
os_types: [linux]
examples:
createSharedExceptionList:
value:
list_id: simple_list
name: Sample Detection Exception List
description: This is a sample detection type exception list.
namespace_type: single
tags: [malware]
os_types: [linux]
responses:
200:
description: Successful response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2688,16 +2688,18 @@ paths:
requestBody:
content:
application/json:
examples:
createSharedExceptionList:
value:
description: This is a sample detection type exception list.
list_id: simple_list
name: Sample Detection Exception List
namespace_type: single
os_types:
- linux
tags:
- malware
schema:
example:
description: This is a sample detection type exception list.
list_id: simple_list
name: Sample Detection Exception List
namespace_type: single
os_types:
- linux
tags:
- malware
type: object
properties:
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2688,16 +2688,18 @@ paths:
requestBody:
content:
application/json:
examples:
createSharedExceptionList:
value:
description: This is a sample detection type exception list.
list_id: simple_list
name: Sample Detection Exception List
namespace_type: single
os_types:
- linux
tags:
- malware
schema:
example:
description: This is a sample detection type exception list.
list_id: simple_list
name: Sample Detection Exception List
namespace_type: single
os_types:
- linux
tags:
- malware
type: object
properties:
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@
* version: 2023-10-31
*/

import type { z } from '@kbn/zod/v4';
import { lazySchema } from '@kbn/zod/v4';
import { z, lazySchema } from '@kbn/zod/v4';

import { SetAlertAssigneesBody } from '../model/set_alert_assignees_body.gen';

export const SetAlertAssigneesRequestBody = lazySchema(() => SetAlertAssigneesBody);
export type SetAlertAssigneesRequestBody = z.infer<typeof SetAlertAssigneesRequestBody>;
export type SetAlertAssigneesRequestBodyInput = z.input<typeof SetAlertAssigneesRequestBody>;

/**
* Elasticsearch update by query response
*/
export const SetAlertAssigneesResponse = lazySchema(() => z.object({}).catchall(z.unknown()));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PhilippeOberti the scripts keep adding this in. Could you confirm this is ok?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm honestly not sure if it's ok, but looking at a neighbor's file, I see this for alert tags:

export const SetAlertTagsResponse = lazySchema(() => z.object({}).catchall(z.unknown()));

Introduced in this recent PR. So I'm guessing the answer is yes it's ok do to it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is this same example for alert status:

export const SetAlertsStatusResponse = lazySchema(() => z.object({}).catchall(z.unknown()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI lazySchema() helper was introduced in @kbn/openapi-generator in #264125. This is an action item to mitigate significantly increased Kibana idle memory consumption.

Please let me know if some functionality doesn't work because of lazySchema() helper. The helper should be transparent for functionality. And our tests didn't reveal issues.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PhilippeOberti I'm waiting on green to merge after confirming with Maxim. Let me know if you feel any changes should be made and I'm happy to follow up.

export type SetAlertAssigneesResponse = z.infer<typeof SetAlertAssigneesResponse>;
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ paths:
$ref: '../model/set_alert_assignees_body.schema.yaml#/components/examples/SetAlertAssigneesBodyRemove'
responses:
200:
description: Indicates a successful call.
description: |
Indicates a successful call. The body matches an Elasticsearch update-by-query response
(for example `took`, `updated`, `failures`).
content:
application/json:
description: Elasticsearch update by query or update by IDs response
schema:
type: object
additionalProperties: true
description: Elasticsearch update by query response
examples:
add:
value:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
import { replaceParams } from '@kbn/openapi-common/shared';
import { catchAxiosErrorFormatAndThrow } from '@kbn/securitysolution-utils';

import type { SetAlertAssigneesRequestBodyInput } from './detection_engine/alert_assignees/set_alert_assignees_route.gen';
import type {
SetAlertAssigneesRequestBodyInput,
SetAlertAssigneesResponse,
} from './detection_engine/alert_assignees/set_alert_assignees_route.gen';
import type {
SetAlertTagsRequestBodyInput,
SetAlertTagsResponse,
Expand Down Expand Up @@ -3234,7 +3237,7 @@ matching documents, and inspect execution logs. Pair `invocationCount` and `time
async setAlertAssignees(props: SetAlertAssigneesProps) {
this.log.info(`${new Date().toISOString()} Calling API SetAlertAssignees`);
return this.kbnClient
.request({
.request<SetAlertAssigneesResponse>({
path: '/api/detection_engine/signals/assignees',
headers: {
[ELASTIC_HTTP_VERSION_HEADER]: '2023-10-31',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3847,7 +3847,6 @@ paths:
'200':
content:
application/json:
description: Elasticsearch update by query or update by IDs response
examples:
add:
value:
Expand All @@ -3866,7 +3865,15 @@ paths:
total: 1
updated: 1
version_conflicts: 0
description: Indicates a successful call.
schema:
additionalProperties: true
description: Elasticsearch update by query response
type: object
description: >
Indicates a successful call. The body matches an Elasticsearch
update-by-query response

(for example `took`, `updated`, `failures`).
'400':
content:
application/json:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3459,7 +3459,6 @@ paths:
'200':
content:
application/json:
description: Elasticsearch update by query or update by IDs response
examples:
add:
value:
Expand All @@ -3478,7 +3477,15 @@ paths:
total: 1
updated: 1
version_conflicts: 0
description: Indicates a successful call.
schema:
additionalProperties: true
description: Elasticsearch update by query response
type: object
description: >
Indicates a successful call. The body matches an Elasticsearch
update-by-query response

(for example `took`, `updated`, `failures`).
'400':
content:
application/json:
Expand Down
Loading