-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Threat Hunting Investigations] Migrate all timeline routes to OpenAPI types #190238
[Threat Hunting Investigations] Migrate all timeline routes to OpenAPI types #190238
Conversation
Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm (but mostly ci) 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defend Workflows LGTM 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janmonschke Thanks for addressing my previous comments and integrating generated Zod types into the code 🙏
I left some non critical comments. Feel free to reach me if it's necessary to discuss them.
.../plugins/security_solution/common/api/timeline/copy_timeline/copy_timeline_route.schema.yaml
Outdated
Show resolved
Hide resolved
.../plugins/security_solution/common/api/timeline/copy_timeline/copy_timeline_route.schema.yaml
Outdated
Show resolved
Hide resolved
...ck/plugins/security_solution/common/api/timeline/get_timeline/get_timeline_route.schema.yaml
Show resolved
Hide resolved
@@ -306,6 +357,11 @@ export const SortFieldTimeline = z.enum(['title', 'description', 'updated', 'cre | |||
export type SortFieldTimelineEnum = typeof SortFieldTimeline.enum; | |||
export const SortFieldTimelineEnum = SortFieldTimeline.enum; | |||
|
|||
export type SortDirection = z.infer<typeof SortDirection>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Interesting if we could reuse SortDirection
for consistency. I see pros and cons in that. The point if it's not reused it should be namespaced to TimelineSortDirection
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point but it would mean rename a bunch more types in this file and then all over security solution. We could think of, in a future PR, to streamline usage of these types. I see occurrences of asc
and desc
and enums for these, all over security solution, not just in timeline.
...ns/security_solution/common/api/timeline/resolve_timeline/resolve_timeline_route.schema.yaml
Show resolved
Hide resolved
x-pack/plugins/security_solution/public/timelines/containers/all/index.tsx
Show resolved
Hide resolved
x-pack/plugins/security_solution/server/lib/timeline/routes/timelines/get_timelines/index.ts
Outdated
Show resolved
Hide resolved
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @janmonschke |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janmonschke Thanks for addressing my comments 👍
…I types (elastic#190238) fixes: elastic/security-team#10235 fixes: elastic/security-team#10237 This is the final PR for migrating over all timeline-related schemas and types to the new generated zod schemas from our OpenAPI specs. (see elastic/security-team#10110) On top of moving to the new schemas/types, this PR also cleans up usage of now outdated types. I'm aware of the size of this PR but rest assured, the changes are easy to review and for most teams, only a handful of files need to be reviewed: ```markdown * x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_solution_integrations.ts * x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/api/get_prebuilt_rules_and_timelines_status/get_prebuilt_rules_and_timelines_status_route.ts * x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/perform_timelines_installation.ts * x-pack/test/security_solution_cypress/cypress/objects/timeline.ts * x-pack/test/security_solution_cypress/cypress/objects/timeline.ts * x-pack/test/security_solution_cypress/cypress/tasks/api_calls/timelines.ts ``` - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Elastic Machine <[email protected]> (cherry picked from commit 0078960)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…OpenAPI types (#190238) (#194606) # Backport This will backport the following commits from `main` to `8.x`: - [[Threat Hunting Investigations] Migrate all timeline routes to OpenAPI types (#190238)](#190238) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Jan Monschke","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-09-30T18:55:23Z","message":"[Threat Hunting Investigations] Migrate all timeline routes to OpenAPI types (#190238)\n\n## Summary\r\n\r\nfixes: https://github.com/elastic/security-team/issues/10235\r\nfixes: https://github.com/elastic/security-team/issues/10237\r\n\r\nThis is the final PR for migrating over all timeline-related schemas and\r\ntypes to the new generated zod schemas from our OpenAPI specs. (see\r\nhttps://github.com/elastic/security-team/issues/10110)\r\nOn top of moving to the new schemas/types, this PR also cleans up usage\r\nof now outdated types.\r\n\r\nI'm aware of the size of this PR but rest assured, the changes are easy\r\nto review and for most teams, only a handful of files need to be\r\nreviewed:\r\n\r\n```markdown\r\n### elastic/security-defend-workflows\r\n\r\n* x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_solution_integrations.ts\r\n\r\n### elastic/security-detection-rule-management\r\n\r\n* x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/api/get_prebuilt_rules_and_timelines_status/get_prebuilt_rules_and_timelines_status_route.ts\r\n* x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/perform_timelines_installation.ts\r\n\r\n### elastic/security-detections-response\r\n\r\n* x-pack/test/security_solution_cypress/cypress/objects/timeline.ts\r\n\r\n### elastic/security-engineering-productivity\r\n\r\n* x-pack/test/security_solution_cypress/cypress/objects/timeline.ts\r\n* x-pack/test/security_solution_cypress/cypress/tasks/api_calls/timelines.ts\r\n```\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"00789609ad663efffd7b3997ca773fe3ea5511e2","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","v9.0.0","Team:Threat Hunting:Investigations","v8.16.0"],"number":190238,"url":"https://github.com/elastic/kibana/pull/190238","mergeCommit":{"message":"[Threat Hunting Investigations] Migrate all timeline routes to OpenAPI types (#190238)\n\n## Summary\r\n\r\nfixes: https://github.com/elastic/security-team/issues/10235\r\nfixes: https://github.com/elastic/security-team/issues/10237\r\n\r\nThis is the final PR for migrating over all timeline-related schemas and\r\ntypes to the new generated zod schemas from our OpenAPI specs. (see\r\nhttps://github.com/elastic/security-team/issues/10110)\r\nOn top of moving to the new schemas/types, this PR also cleans up usage\r\nof now outdated types.\r\n\r\nI'm aware of the size of this PR but rest assured, the changes are easy\r\nto review and for most teams, only a handful of files need to be\r\nreviewed:\r\n\r\n```markdown\r\n### elastic/security-defend-workflows\r\n\r\n* x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_solution_integrations.ts\r\n\r\n### elastic/security-detection-rule-management\r\n\r\n* x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/api/get_prebuilt_rules_and_timelines_status/get_prebuilt_rules_and_timelines_status_route.ts\r\n* x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/perform_timelines_installation.ts\r\n\r\n### elastic/security-detections-response\r\n\r\n* x-pack/test/security_solution_cypress/cypress/objects/timeline.ts\r\n\r\n### elastic/security-engineering-productivity\r\n\r\n* x-pack/test/security_solution_cypress/cypress/objects/timeline.ts\r\n* x-pack/test/security_solution_cypress/cypress/tasks/api_calls/timelines.ts\r\n```\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"00789609ad663efffd7b3997ca773fe3ea5511e2"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/190238","number":190238,"mergeCommit":{"message":"[Threat Hunting Investigations] Migrate all timeline routes to OpenAPI types (#190238)\n\n## Summary\r\n\r\nfixes: https://github.com/elastic/security-team/issues/10235\r\nfixes: https://github.com/elastic/security-team/issues/10237\r\n\r\nThis is the final PR for migrating over all timeline-related schemas and\r\ntypes to the new generated zod schemas from our OpenAPI specs. (see\r\nhttps://github.com/elastic/security-team/issues/10110)\r\nOn top of moving to the new schemas/types, this PR also cleans up usage\r\nof now outdated types.\r\n\r\nI'm aware of the size of this PR but rest assured, the changes are easy\r\nto review and for most teams, only a handful of files need to be\r\nreviewed:\r\n\r\n```markdown\r\n### elastic/security-defend-workflows\r\n\r\n* x-pack/test/security_solution_endpoint/apps/endpoint/endpoint_solution_integrations.ts\r\n\r\n### elastic/security-detection-rule-management\r\n\r\n* x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/api/get_prebuilt_rules_and_timelines_status/get_prebuilt_rules_and_timelines_status_route.ts\r\n* x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/logic/perform_timelines_installation.ts\r\n\r\n### elastic/security-detections-response\r\n\r\n* x-pack/test/security_solution_cypress/cypress/objects/timeline.ts\r\n\r\n### elastic/security-engineering-productivity\r\n\r\n* x-pack/test/security_solution_cypress/cypress/objects/timeline.ts\r\n* x-pack/test/security_solution_cypress/cypress/tasks/api_calls/timelines.ts\r\n```\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"00789609ad663efffd7b3997ca773fe3ea5511e2"}},{"branch":"8.x","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
Summary
fixes: https://github.com/elastic/security-team/issues/10235
fixes: https://github.com/elastic/security-team/issues/10237
This is the final PR for migrating over all timeline-related schemas and types to the new generated zod schemas from our OpenAPI specs. (see https://github.com/elastic/security-team/issues/10110)
On top of moving to the new schemas/types, this PR also cleans up usage of now outdated types.
I'm aware of the size of this PR but rest assured, the changes are easy to review and for most teams, only a handful of files need to be reviewed:
Checklist