-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ResponseOps][Cases] Register
forwardCompatibility
schema for the C…
…ases SO (#198498) ## Summary Summarize your PR. If it involves visual changes include a screenshot or gif. ### Checklist Delete any items that are not applicable to this PR. - [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 ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
18a0933
commit 9fdc042
Showing
6 changed files
with
131 additions
and
40 deletions.
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
10 changes: 10 additions & 0 deletions
10
x-pack/plugins/cases/server/saved_object_types/cases/schemas/index.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export * from './latest'; | ||
|
||
export { casesSchema as casesSchemaV1 } from './v1'; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/cases/server/saved_object_types/cases/schemas/latest.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export * from './v1'; |
71 changes: 71 additions & 0 deletions
71
x-pack/plugins/cases/server/saved_object_types/cases/schemas/v1.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { schema } from '@kbn/config-schema'; | ||
|
||
const UserSchema = schema.object({ | ||
email: schema.nullable(schema.string()), | ||
full_name: schema.nullable(schema.string()), | ||
username: schema.nullable(schema.string()), | ||
profile_uid: schema.nullable(schema.string()), | ||
}); | ||
|
||
const UserProfileSchema = schema.object({ uid: schema.string() }); | ||
|
||
const ConnectorSchema = schema.object({ | ||
name: schema.string(), | ||
type: schema.string(), | ||
fields: schema.arrayOf(schema.object({ key: schema.string(), value: schema.string() })), | ||
}); | ||
|
||
const ExternalServiceSchema = schema.object({ | ||
connector_name: schema.string(), | ||
external_id: schema.string(), | ||
external_title: schema.string(), | ||
external_url: schema.string(), | ||
pushed_at: schema.string(), | ||
pushed_by: UserSchema, | ||
}); | ||
|
||
const SettingsSchema = schema.object({ syncAlerts: schema.boolean() }); | ||
|
||
const CustomFieldsSchema = schema.arrayOf( | ||
schema.object({ | ||
key: schema.string(), | ||
type: schema.string(), | ||
value: schema.nullable(schema.any()), | ||
}) | ||
); | ||
|
||
export const casesSchema = schema.object({ | ||
assignees: schema.arrayOf(UserProfileSchema), | ||
category: schema.maybe(schema.nullable(schema.string())), | ||
closed_at: schema.nullable(schema.string()), | ||
closed_by: schema.nullable(UserSchema), | ||
created_at: schema.string(), | ||
created_by: UserSchema, | ||
connector: ConnectorSchema, | ||
customFields: schema.maybe(schema.nullable(CustomFieldsSchema)), | ||
description: schema.string(), | ||
duration: schema.nullable(schema.number()), | ||
external_service: schema.nullable(ExternalServiceSchema), | ||
owner: schema.string(), | ||
settings: SettingsSchema, | ||
severity: schema.oneOf([ | ||
schema.literal(10), | ||
schema.literal(20), | ||
schema.literal(30), | ||
schema.literal(40), | ||
]), | ||
status: schema.oneOf([schema.literal(0), schema.literal(10), schema.literal(20)]), | ||
tags: schema.arrayOf(schema.string()), | ||
title: schema.string(), | ||
total_alerts: schema.number(), | ||
total_comments: schema.number(), | ||
updated_at: schema.nullable(schema.string()), | ||
updated_by: schema.nullable(UserSchema), | ||
}); |