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

[Security Solution] PoC of the Detection Engine health API #157155

Merged
merged 11 commits into from
Jun 14, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Either } from 'fp-ts/lib/Either';
* Types the IsoDateString as:
* - A string that is an ISOString
*/
export type IsoDateString = t.TypeOf<typeof IsoDateString>;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think both IsoDateString and IsoDateStringC represent the same type, we can use either of them interchangeably, I wonder if is there any reason behind introducing this new export type IsoDateString = t.TypeOf<typeof IsoDateString>; ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@WafaaNasr I think ideally we should delete IsoDateStringC and use IsoDateString as the type instead. TypeScript aliases allow to have a type and a constant with the same name -- this is useful when they represent conceptually the same thing, in this case, a schema and its corresponding type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But with the upcoming adoption of OpenAPI we might end up getting rid of all the io-ts schemas, so I didn't bother with refactoring further.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, Appreciate your explanation! thanks @banderror

export const IsoDateString = new t.Type<string, string, unknown>(
'IsoDateString',
t.string.is,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const ALLOW_FIELDS = [
'alert.attributes.snoozeSchedule.duration',
'alert.attributes.alertTypeId',
'alert.attributes.enabled',
'alert.attributes.params.*',
'alert.attributes.params.*', // TODO: https://github.com/elastic/kibana/issues/159602
'alert.attributes.params.immutable', // TODO: Remove after addressing https://github.com/elastic/kibana/issues/159602
];

const ALLOW_AGG_TYPES = ['terms', 'composite', 'nested', 'filter'];
Expand Down
Loading