Skip to content

Commit 16e1598

Browse files
[Security Solution][Case] Improve ServiceConnectorCaseParams type (#80109)
Co-authored-by: Kibana Machine <[email protected]>
1 parent 755d63a commit 16e1598

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

x-pack/plugins/case/common/api/cases/case.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { NumberFromString } from '../saved_object';
1010
import { UserRT } from '../user';
1111
import { CommentResponseRt } from './comment';
1212
import { CasesStatusResponseRt } from './status';
13-
import { CaseConnectorRt, ESCaseConnector } from '../connectors';
13+
import { CaseConnectorRt, ESCaseConnector, ConnectorPartialFieldsRt } from '../connectors';
1414

1515
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
1616
export { ActionTypeExecutorResult } from '../../../../actions/server/types';
@@ -133,7 +133,7 @@ export const ServiceConnectorCommentParamsRt = rt.type({
133133
updatedBy: rt.union([ServiceConnectorUserParams, rt.null]),
134134
});
135135

136-
export const ServiceConnectorCaseParamsRt = rt.type({
136+
export const ServiceConnectorBasicCaseParamsRt = rt.type({
137137
comments: rt.union([rt.array(ServiceConnectorCommentParamsRt), rt.null]),
138138
createdAt: rt.string,
139139
createdBy: ServiceConnectorUserParams,
@@ -145,6 +145,11 @@ export const ServiceConnectorCaseParamsRt = rt.type({
145145
updatedBy: rt.union([ServiceConnectorUserParams, rt.null]),
146146
});
147147

148+
export const ServiceConnectorCaseParamsRt = rt.intersection([
149+
ServiceConnectorBasicCaseParamsRt,
150+
ConnectorPartialFieldsRt,
151+
]);
152+
148153
export const ServiceConnectorCaseResponseRt = rt.intersection([
149154
rt.type({
150155
title: rt.string,

x-pack/plugins/case/common/api/connectors/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ export const ConnectorFieldsRt = rt.union([
2020
rt.null,
2121
]);
2222

23+
export const ConnectorPartialFieldsRt = rt.partial({
24+
...JiraFieldsRT.props,
25+
...ResilientFieldsRT.props,
26+
...ServiceNowFieldsRT.props,
27+
});
28+
2329
export enum ConnectorTypes {
2430
jira = '.jira',
2531
resilient = '.resilient',

0 commit comments

Comments
 (0)