From e0cab80dbef93d416e7e0373a9aed4d7a04f033f Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 18 Jul 2023 11:10:11 -0600 Subject: [PATCH] [maps] support null description in saved object (#162145) Part of https://github.com/elastic/kibana/issues/162069 > This happens in maps too and possibly other SOs that have null description (not sure if it were ever possible to have null description in maps.) It seems from the SOs that Bhavya sent that it was possible for visualizations. With this schema change the bug if fixed https://github.com/elastic/kibana/pull/162106 > Not sure if it makes sense to also do it in maps. @nreese wdyt? Add support for null description in maps saved object to be consistent with visualize saved objects. ### test instructions 1) Install web logs sample data set 2) export map 3) manually change ndjson, changing `description:""` to `description:null` 4) reimport map saved object 5) verify map can be opened --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/plugins/maps/common/content_management/v1/cm_services.ts | 2 +- x-pack/test/functional/fixtures/kbn_archiver/maps.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/common/content_management/v1/cm_services.ts b/x-pack/plugins/maps/common/content_management/v1/cm_services.ts index 65d2e3082da7d..ba849479776d5 100644 --- a/x-pack/plugins/maps/common/content_management/v1/cm_services.ts +++ b/x-pack/plugins/maps/common/content_management/v1/cm_services.ts @@ -16,7 +16,7 @@ import { const mapAttributesSchema = schema.object( { title: schema.string(), - description: schema.maybe(schema.string()), + description: schema.maybe(schema.nullable(schema.string())), mapStateJSON: schema.maybe(schema.string()), layerListJSON: schema.maybe(schema.string()), uiStateJSON: schema.maybe(schema.string()), diff --git a/x-pack/test/functional/fixtures/kbn_archiver/maps.json b/x-pack/test/functional/fixtures/kbn_archiver/maps.json index ae0b2be43f7de..318cb3c445186 100644 --- a/x-pack/test/functional/fixtures/kbn_archiver/maps.json +++ b/x-pack/test/functional/fixtures/kbn_archiver/maps.json @@ -77,7 +77,7 @@ { "attributes": { - "description": "", + "description": null, "layerListJSON": "[{\"id\":\"n1t6f\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"sourceDescriptor\":{\"id\":\"62eca1fc-fe42-11e8-8eb2-f2801f1b9fd1\",\"type\":\"ES_SEARCH\",\"geoField\":\"geometry\",\"limit\":2048,\"filterByMapBounds\":false,\"showTooltip\":true,\"tooltipProperties\":[\"name\"],\"applyGlobalQuery\":false,\"indexPatternRefName\":\"layer_1_source_index_pattern\",\"scalingType\":\"LIMIT\"},\"visible\":true,\"temporary\":false,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"fillColor\":{\"type\":\"DYNAMIC\",\"options\":{\"fieldMetaOptions\":{\"isEnabled\":false,\"sigma\":3},\"field\":{\"label\":\"max(prop1) group by meta_for_geo_shapes*.runtime_shape_name\",\"name\":\"__kbnjoin__max_of_prop1__855ccb86-fe42-11e8-8eb2-f2801f1b9fd1\",\"origin\":\"join\"},\"color\":\"Blues\"}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":10}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}}},\"temporary\":true,\"previousStyle\":null},\"type\":\"VECTOR\",\"joins\":[{\"leftField\":\"name\",\"right\":{\"id\":\"855ccb86-fe42-11e8-8eb2-f2801f1b9fd1\",\"indexPatternTitle\":\"meta_for_geo_shapes*\",\"term\":\"runtime_shape_name\",\"metrics\":[{\"type\":\"max\",\"field\":\"prop1\"}],\"applyGlobalQuery\":true,\"indexPatternRefName\":\"layer_1_join_0_index_pattern\",\"type\":\"ES_TERM_SOURCE\"}}]}]", "mapStateJSON": "{\"zoom\":3.02,\"center\":{\"lon\":77.33426,\"lat\":-0.04647},\"timeFilters\":{\"from\":\"now-17m\",\"to\":\"now\",\"mode\":\"quick\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":1000},\"settings\":{\"autoFitToDataBounds\":false}}", "title": "join example",