Fix: emit warning for invalid suggestions

This commit is contained in:
Pieter Vander Vennet 2024-04-23 21:42:35 +02:00
parent 578f638749
commit 56ba426ab5
6 changed files with 5 additions and 6 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "mapcomplete", "name": "mapcomplete",
"version": "0.42.2", "version": "0.42.3",
"repository": "https://github.com/pietervdvn/MapComplete", "repository": "https://github.com/pietervdvn/MapComplete",
"description": "A small website to edit OSM easily", "description": "A small website to edit OSM easily",
"bugs": "https://github.com/pietervdvn/MapComplete/issues", "bugs": "https://github.com/pietervdvn/MapComplete/issues",

View file

@ -207,6 +207,9 @@ function extractHintsFrom(
validators: Validators, validators: Validators,
Constants: Constants, 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 return hints
} }

View file

@ -28,7 +28,7 @@ export default interface PointRenderingConfigJson {
/** /**
* question: At what location should this icon be shown? * question: At what location should this icon be shown?
* multianswer: true * 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: ( location: (
| "point" | "point"

View file

@ -33,7 +33,6 @@
} }
state.setValueAt(path, values) state.setValueAt(path, values)
}) })
const config = new TagRenderingConfig(configJson) const config = new TagRenderingConfig(configJson)
</script> </script>

View file

@ -1629,7 +1629,6 @@
"if": "value=projected_centerpoint", "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" "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", "if": "value=polygon_centroid",
"then": "Show an icon at a polygon centroid (but not if it is a way)" "then": "Show an icon at a polygon centroid (but not if it is a way)"

View file

@ -3597,7 +3597,6 @@
"if": "value=projected_centerpoint", "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" "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", "if": "value=polygon_centroid",
"then": "Show an icon at a polygon centroid (but not if it is a way)" "then": "Show an icon at a polygon centroid (but not if it is a way)"
@ -23954,7 +23953,6 @@
"if": "value=projected_centerpoint", "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" "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", "if": "value=polygon_centroid",
"then": "Show an icon at a polygon centroid (but not if it is a way)" "then": "Show an icon at a polygon centroid (but not if it is a way)"