-
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
[Security Solution][Alerts] Remove legacy rules schema #137605
Merged
marshallmain
merged 19 commits into
elastic:main
from
marshallmain:remove-legacy-rules-schema
Sep 13, 2022
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
845f152
Remove legacy rules schema
marshallmain 38317c1
Remove RulesSchema from cypress test
marshallmain 07c2e3c
Merge branch 'main' into remove-legacy-rules-schema
marshallmain 4c01f5b
Fix ml rule API test mock
marshallmain 7a79e6e
Fix type error
marshallmain 44ab4a9
Merge branch 'main' into remove-legacy-rules-schema
marshallmain 5a0a141
Explicitly specify undefined fields in response mocks
marshallmain 63f7ed1
Merge branch 'main' into remove-legacy-rules-schema
marshallmain b64f9fa
Fix types
marshallmain 9b8ffc6
Remove undefined properties so expect doesn't mess it up
marshallmain 9ca181f
Use more specific types and rename newTransformValidate
marshallmain 17cddda
Fix types in schema tests
marshallmain 147b8bd
Merge branch 'main' into remove-legacy-rules-schema
marshallmain f43bedc
Merge branch 'main' into remove-legacy-rules-schema
marshallmain 2e7f0bc
Merge branch 'main' into remove-legacy-rules-schema
kibanamachine 5d3bd8a
Review comments - explicit return types, better removeServerGenerated…
marshallmain 0ecb956
Re-add deleted test with modified assertion
marshallmain 560bb8e
Merge branch 'main' into remove-legacy-rules-schema
marshallmain 1649b84
Merge branch 'main' of github.com:elastic/kibana into remove-legacy-r…
marshallmain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
After the changes, now we have
rules_schema.mocks.ts
andrules_schema.test.ts
under both directories:request
andresponse
. Some of the tests underresponse
have been deleted.request
folder?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.
The tests and mocks in each folder still correspond to the
request
andresponse
schemas respectively. It definitely deserves to be reorganized, but I tried to avoid doing reorganization at the same time as the more technical changes.request/rule_schemas.test.ts
is focused on testing thecreateRulesSchema
- we don't have independent tests forupdateRulesSchema
at this point, but it's almost identical tocreateRulesSchema
. Similarly the mocks inrequest/rule_schemas.mock.ts
are all for thecreate
schemas.Since
request/rule_schemas.ts
is where all of the core schema logic lives, it ends up being the source for the newresponse
schemas and replacesresponse/rules_schema.ts
- which is simply deleted. However, I keptresponse/rules_schema.test.ts
andresponse/rules_schema.mock.ts
and updated them to use the new schemas for better assurance that the switch over to the new schema isn't breaking things.I think we can consolidate by moving most of
request/rule_schemas.ts
tocommon/rule_schemas.ts
and better separating the "base" and "type specific" schema logic from create, update, response, etc. This way we can keep request and response schemas organized into their own sections, and also remove the dependency ofresponse
onrequest/rule_schemas.ts
.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.
Great, thank you for clarifying this! Could you please add a few comments to those files to explain this:
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.
++ Makes total sense. I added this to #138606 as a sub-task.