Skip to content

Commit

Permalink
[visulizations] adding schema to saved object mapping (#154514)
Browse files Browse the repository at this point in the history
## Summary

Removes remaining properties that are not searched on from the mapping
for the visualizations saved object and adds a schema definition to it.

part of #153070
  • Loading branch information
ppisljar authored May 3, 2023
1 parent 7f68428 commit b3aa580
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
"uptime-synthetics-api-key": "599319bedbfa287e8761e1ba49d536417a33fa13",
"url": "816fa15bfe460ce39108ed8095e60fdbfcc40f11",
"usage-counters": "f478b2668be350f5bdc08d9e1cf6fbce0e079f61",
"visualization": "55530e57ffe86bfd7c2a2b50461398c1f7a99e95",
"visualization": "cee4d02c56af349054642c6744bf9c471c1ad941",
"workplace_search_telemetry": "10e278fe9ae1396bfc36ae574bc387d7e696d43f",
}
`);
Expand Down
16 changes: 14 additions & 2 deletions src/plugins/visualizations/server/saved_objects/visualization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import { ANALYTICS_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server';
import { schema } from '@kbn/config-schema';
import { SavedObjectsType } from '@kbn/core/server';
import { MigrateFunctionsObject } from '@kbn/kibana-utils-plugin/common';
import { getAllMigrations } from '../migrations/visualization_saved_object_migrations';
Expand Down Expand Up @@ -37,12 +38,23 @@ export const getVisualizationSavedObjectType = (
dynamic: false, // declared here to prevent indexing root level attribute fields
properties: {
description: { type: 'text' },
title: { type: 'text' },
version: { type: 'integer' },
kibanaSavedObjectMeta: {
properties: {},
},
title: { type: 'text' },
version: { type: 'integer' },
},
},
schemas: {
'8.8.0': schema.object({
title: schema.string(),
description: schema.maybe(schema.string()),
version: schema.maybe(schema.number()),
kibanaSavedObjectMeta: schema.maybe(schema.object({ searchSourceJSON: schema.string() })),
uiStateJSON: schema.maybe(schema.string()),
visState: schema.maybe(schema.string()),
savedSearchRefName: schema.maybe(schema.string()),
}),
},
migrations: () => getAllMigrations(getSearchSourceMigrations()),
});

0 comments on commit b3aa580

Please sign in to comment.