Fix problem with validation (#225334)

In this fix https://github.com/elastic/kibana/pull/224961 we introduced
the possibility of the data property to be null, but it can also be
empty. This PR does that.
This commit is contained in:
Sonia Sanz Vivas 2025-06-26 09:54:37 +02:00 committed by GitHub
parent e78d4faaa5
commit 0a2ae4bfe6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -123,8 +123,10 @@ export const UsageMetricsAutoOpsResponseSchema = {
schema.object({
name: schema.string(),
error: schema.nullable(schema.string()),
data: schema.nullable(
schema.arrayOf(schema.arrayOf(schema.number(), { minSize: 2, maxSize: 2 }))
data: schema.maybe(
schema.nullable(
schema.arrayOf(schema.arrayOf(schema.number(), { minSize: 2, maxSize: 2 }))
)
),
})
)

View file

@ -190,7 +190,7 @@ describe('registerUsageMetricsRoute', () => {
});
});
describe('when metric type data is null', () => {
describe('when metric type data is null or not present', () => {
beforeEach(() => {
jest.spyOn(DataUsageService.prototype, 'getMetrics').mockResolvedValue({
ingest_rate: [
@ -220,7 +220,6 @@ describe('registerUsageMetricsRoute', () => {
{
name: '.ds-2',
error: null,
data: null,
},
],
search_vcu: [],