Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SecuritySolution] Fix behavior of pinnend events and comments on unsaved timelines #178212

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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { ErrorSchema } from './error_schema';

export const BareNoteSchema = runtimeTypes.intersection([
runtimeTypes.type({
timelineId: unionWithNullType(runtimeTypes.string),
timelineId: runtimeTypes.string,
}),
runtimeTypes.partial({
eventId: unionWithNullType(runtimeTypes.string),
Expand All @@ -51,9 +51,6 @@ export const NoteRuntimeType = runtimeTypes.intersection([
noteId: runtimeTypes.string,
version: runtimeTypes.string,
}),
runtimeTypes.partial({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

timelineVersion is obsolete now.

timelineVersion: unionWithNullType(runtimeTypes.string),
}),
]);

export type Note = runtimeTypes.TypeOf<typeof NoteRuntimeType>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ components:
type: object
properties:
columns:
$ref: '#/components/schemas/ColumnHeaderResult'
$ref: '#/components/schemas/ColumnHeaderResult'
created:
type: number
createdBy:
Expand Down Expand Up @@ -244,19 +244,13 @@ components:
type: string
version:
type: string
timelineVersion:
nullable: true
type: string
GlobalNote:
type: object
properties:
noteId:
type: string
version:
type: string
timelineVersion:
nullable: true
type: string
note:
type: string
timelineId:
Expand All @@ -278,8 +272,6 @@ components:
type: string
version:
type: string
timelineVersion:
type: string
RowRendererId:
type: string
enum:
Expand Down Expand Up @@ -384,8 +376,6 @@ components:
type: string
version:
type: string
timelineVersion:
type: string
Sort:
type: object
properties:
Expand Down Expand Up @@ -415,30 +405,30 @@ components:
description: The status of the timeline. Valid values are `active`, `draft`, and `immutable`.
ImportTimelines:
allOf:
- $ref: '#/components/schemas/SavedTimeline'
- type: object
properties:
savedObjectId:
type: string
nullable: true
version:
- $ref: '#/components/schemas/SavedTimeline'
- type: object
properties:
savedObjectId:
type: string
nullable: true
version:
type: string
nullable: true
globalNotes:
nullable: true
type: array
items:
$ref: '#/components/schemas/BareNote'
eventNotes:
nullable: true
type: array
items:
$ref: '#/components/schemas/BareNote'
pinnedEventIds:
nullable: true
type: array
items:
type: string
nullable: true
globalNotes:
nullable: true
type: array
items:
$ref: '#/components/schemas/BareNote'
eventNotes:
nullable: true
type: array
items:
$ref: '#/components/schemas/BareNote'
pinnedEventIds:
nullable: true
type: array
items:
type: string
ImportTimelineResult:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.0
info:
title: Elastic Security - Timeline - Notes API
version: 8.9.0
version: 8.14.0
externalDocs:
url: https://www.elastic.co/guide/en/security/current/timeline-api-update.html
description: Documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export const pinnedEventIds = unionWithNullType(runtimeTypes.array(runtimeTypes.
export const persistPinnedEventSchema = runtimeTypes.intersection([
runtimeTypes.type({
eventId: runtimeTypes.string,
timelineId: runtimeTypes.string,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here, timelineId is not optional anymore

}),
runtimeTypes.partial({
pinnedEventId: unionWithNullType(runtimeTypes.string),
timelineId: unionWithNullType(runtimeTypes.string),
}),
]);

Expand Down Expand Up @@ -51,9 +51,6 @@ export const PinnedEventRuntimeType = runtimeTypes.intersection([
version: runtimeTypes.string,
}),
BarePinnedEventType,
runtimeTypes.partial({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And here as well, no more need for timelineVersion

timelineVersion: unionWithNullType(runtimeTypes.string),
}),
]);

export interface PinnedEvent extends runtimeTypes.TypeOf<typeof PinnedEventRuntimeType> {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.0
info:
title: Elastic Security - Timeline - Pinned Event API (https://www.elastic.co/guide/en/security/current/_pin_an_event_to_an_existing_timeline.html)
version: 8.9.0
version: 8.14.0
servers:
- url: 'http://{kibana_host}:{port}'
variables:
Expand Down Expand Up @@ -33,7 +33,6 @@ paths:
nullable: true
timelineId:
type: string
nullable: true
responses:
200:
description: Indicate the event was successfully pinned in the timeline.
Expand All @@ -55,4 +54,4 @@ paths:
message:
type: string
required:
- data
- data
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { unionWithNullType } from '../../../utility_types';
*/
const SavedNoteRuntimeType = runtimeTypes.intersection([
runtimeTypes.type({
timelineId: unionWithNullType(runtimeTypes.string),
timelineId: runtimeTypes.string,
}),
runtimeTypes.partial({
eventId: unionWithNullType(runtimeTypes.string),
Expand All @@ -39,11 +39,6 @@ export const SavedObjectNoteRuntimeType = runtimeTypes.intersection([
}),
runtimeTypes.partial({
noteId: runtimeTypes.string,
timelineVersion: runtimeTypes.union([
runtimeTypes.string,
runtimeTypes.null,
runtimeTypes.undefined,
]),
}),
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const SavedObjectPinnedEventRuntimeType = runtimeTypes.intersection([
}),
runtimeTypes.partial({
pinnedEventId: unionWithNullType(runtimeTypes.string),
timelineVersion: unionWithNullType(runtimeTypes.string),
}),
]);

Expand Down
Loading