From 56ba426ab5bb2f10ac38776728a67ff4558e0cfa Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 23 Apr 2024 21:42:35 +0200 Subject: [PATCH] Fix: emit warning for invalid suggestions --- package.json | 2 +- scripts/fixSchemas.ts | 3 +++ src/Models/ThemeConfig/Json/PointRenderingConfigJson.ts | 2 +- src/UI/Studio/ArrayMultiAnswer.svelte | 1 - src/assets/schemas/layerconfigmeta.json | 1 - src/assets/schemas/layoutconfigmeta.json | 2 -- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 46841a498..db471b508 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mapcomplete", - "version": "0.42.2", + "version": "0.42.3", "repository": "https://github.com/pietervdvn/MapComplete", "description": "A small website to edit OSM easily", "bugs": "https://github.com/pietervdvn/MapComplete/issues", diff --git a/scripts/fixSchemas.ts b/scripts/fixSchemas.ts index be59de023..261dd8fb5 100644 --- a/scripts/fixSchemas.ts +++ b/scripts/fixSchemas.ts @@ -207,6 +207,9 @@ function extractHintsFrom( validators: Validators, Constants: Constants, }) + if(hints["suggestions"]?.indexOf(null) >= 0){ + throw "A suggestion generated 'null' for "+path.join(".")+". Check the docstring, specifically 'suggestions'. Pay attention to double commas" + } } return hints } diff --git a/src/Models/ThemeConfig/Json/PointRenderingConfigJson.ts b/src/Models/ThemeConfig/Json/PointRenderingConfigJson.ts index e423ffcdb..5a3cce487 100644 --- a/src/Models/ThemeConfig/Json/PointRenderingConfigJson.ts +++ b/src/Models/ThemeConfig/Json/PointRenderingConfigJson.ts @@ -28,7 +28,7 @@ export default interface PointRenderingConfigJson { /** * question: At what location should this icon be shown? * multianswer: true - * suggestions: return [{if: "value=point",then: "Show an icon for point (node) objects"},{if: "value=centroid",then: "Show an icon for line or polygon (way) objects at their centroid location"}, {if: "value=start",then: "Show an icon for line (way) objects at the start"},{if: "value=end",then: "Show an icon for line (way) object at the end"},{if: "value=projected_centerpoint",then: "Show an icon for line (way) object near the centroid location, but moved onto the line. Does not show an item on polygons"}, ,{if: "value=polygon_centroid",then: "Show an icon at a polygon centroid (but not if it is a way)"}] + * suggestions: return [{if: "value=point",then: "Show an icon for point (node) objects"},{if: "value=centroid",then: "Show an icon for line or polygon (way) objects at their centroid location"}, {if: "value=start",then: "Show an icon for line (way) objects at the start"},{if: "value=end",then: "Show an icon for line (way) object at the end"},{if: "value=projected_centerpoint",then: "Show an icon for line (way) object near the centroid location, but moved onto the line. Does not show an item on polygons"}, {if: "value=polygon_centroid",then: "Show an icon at a polygon centroid (but not if it is a way)"}] */ location: ( | "point" diff --git a/src/UI/Studio/ArrayMultiAnswer.svelte b/src/UI/Studio/ArrayMultiAnswer.svelte index 65c0410f8..656731616 100644 --- a/src/UI/Studio/ArrayMultiAnswer.svelte +++ b/src/UI/Studio/ArrayMultiAnswer.svelte @@ -33,7 +33,6 @@ } state.setValueAt(path, values) }) - const config = new TagRenderingConfig(configJson) diff --git a/src/assets/schemas/layerconfigmeta.json b/src/assets/schemas/layerconfigmeta.json index dc6e90e04..3c495011e 100644 --- a/src/assets/schemas/layerconfigmeta.json +++ b/src/assets/schemas/layerconfigmeta.json @@ -1629,7 +1629,6 @@ "if": "value=projected_centerpoint", "then": "Show an icon for line (way) object near the centroid location, but moved onto the line. Does not show an item on polygons" }, - null, { "if": "value=polygon_centroid", "then": "Show an icon at a polygon centroid (but not if it is a way)" diff --git a/src/assets/schemas/layoutconfigmeta.json b/src/assets/schemas/layoutconfigmeta.json index 3bbe20050..c0e38e783 100644 --- a/src/assets/schemas/layoutconfigmeta.json +++ b/src/assets/schemas/layoutconfigmeta.json @@ -3597,7 +3597,6 @@ "if": "value=projected_centerpoint", "then": "Show an icon for line (way) object near the centroid location, but moved onto the line. Does not show an item on polygons" }, - null, { "if": "value=polygon_centroid", "then": "Show an icon at a polygon centroid (but not if it is a way)" @@ -23954,7 +23953,6 @@ "if": "value=projected_centerpoint", "then": "Show an icon for line (way) object near the centroid location, but moved onto the line. Does not show an item on polygons" }, - null, { "if": "value=polygon_centroid", "then": "Show an icon at a polygon centroid (but not if it is a way)"