[8.16][Fleet] fix schema validation when updating package policy (#214770)

Backport https://github.com/elastic/kibana/pull/214571

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Julia Bardi 2025-03-25 08:39:55 +01:00 committed by GitHub
parent 52d1c98c9f
commit 6272be63eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 9 deletions

View file

@ -3191,11 +3191,13 @@ describe('Package policy service', () => {
beforeEach(() => {
context = xpackMocks.createRequestHandlerContext();
request = httpServerMock.createKibanaRequest();
appContextService.start(createAppContextStartContractMock());
});
afterEach(() => {
jest.clearAllMocks();
callbackCallingOrder.length = 0;
appContextService.stop();
});
it('should call external callbacks in expected order', async () => {

View file

@ -261,15 +261,19 @@ export const PackagePolicySchema = schema.object({
updated_by: schema.string(),
created_at: schema.string(),
created_by: schema.string(),
elasticsearch: schema.maybe(
schema.object({
privileges: schema.maybe(
schema.object({
cluster: schema.maybe(schema.arrayOf(schema.string())),
})
),
})
),
elasticsearch: schema
.maybe(
schema.object({
privileges: schema.maybe(
schema.object({
cluster: schema.maybe(schema.arrayOf(schema.string())),
})
),
})
)
.extendsDeep({
unknowns: 'allow',
}),
inputs: schema.arrayOf(
schema.object({
...PackagePolicyInputsSchema,