Don't enumerate all the values of radio fields in taginfo.json

(closes #5715)

Because for these fields, the `keys` property already contains all the values
This commit is contained in:
Bryan Housel
2019-01-17 00:24:40 -05:00
parent 3e12a85fa1
commit ed1b32682a
2 changed files with 11 additions and 41 deletions

View File

@@ -385,9 +385,10 @@ function generateTaginfo(presets, fields) {
_forEach(fields, function(field) {
var keys = field.keys || [ field.key ] || [];
var isRadio = (field.type === 'radio' || field.type === 'structureRadio');
keys.forEach(function(key) {
if (field.strings && field.strings.options) {
if (field.strings && field.strings.options && !isRadio) {
var values = Object.keys(field.strings.options);
values.forEach(function(value) {
if (value === 'undefined' || value === '*' || value === '') return;
@@ -482,7 +483,7 @@ function validatePresetFields(presets, fields) {
for (var presetID in presets) {
var preset = presets[presetID];
if (preset.fields) {
// since `moreFields` is available, check that `fields` doesn't get too cluttered
// since `moreFields` is available, check that `fields` doesn't get too cluttered
var fieldCount = Object.keys(preset.fields).length;
if (fieldCount > maxFieldsBeforeError) {
console.error(fieldCount + ' values in "fields" of "' + preset.name + '" (' + presetID + '). Limit: ' + maxFieldsBeforeError + '. Please move lower-priority fields to "moreFields".');

View File

@@ -7168,7 +7168,7 @@
{"key": "boundary", "description": "🄵 Type"},
{"key": "brand", "description": "🄵 Brand"},
{"key": "brewery", "description": "🄵 Draft Beers"},
{"key": "bridge", "description": "🄵 Type"},
{"key": "bridge", "description": "🄵 Type, 🄵 Structure"},
{"key": "building:material", "description": "🄵 Material"},
{"key": "bunker_type", "description": "🄵 Type"},
{"key": "cables", "description": "🄵 Cables"},
@@ -7229,7 +7229,7 @@
{"key": "crossing", "description": "🄵 Type"},
{"key": "cuisine", "description": "🄵 Cuisines"},
{"key": "currency:", "description": "🄵 Currency Types"},
{"key": "cutting", "description": "🄵 Type"},
{"key": "cutting", "description": "🄵 Type, 🄵 Structure"},
{"key": "cycle_network", "description": "🄵 Network"},
{"key": "cycleway:left", "value": "none", "description": "🄵 Bike Lanes"},
{"key": "cycleway:left", "value": "lane", "description": "🄵 Bike Lanes"},
@@ -7333,7 +7333,7 @@
{"key": "electrified", "value": "no", "description": "🄵 Electrification"},
{"key": "ele", "description": "🄵 Elevation"},
{"key": "email", "description": "🄵 Email"},
{"key": "embankment", "description": "🄵 Type"},
{"key": "embankment", "description": "🄵 Type, 🄵 Structure"},
{"key": "emergency", "description": "🄵 Emergency"},
{"key": "enforcement", "description": "🄵 Type"},
{"key": "except", "description": "🄵 Exceptions"},
@@ -7358,21 +7358,15 @@
{"key": "fitness_station", "description": "🄵 Equipment Type"},
{"key": "fixme", "description": "🄵 Fix Me"},
{"key": "flag:type", "description": "🄵 Flag Type"},
{"key": "ford", "description": "🄵 Type"},
{"key": "ford", "description": "🄵 Type, 🄵 Structure"},
{"key": "frequency", "description": "🄵 Operating Frequency"},
{"key": "from", "description": "🄵 From"},
{"key": "fuel:", "description": "🄵 Fuel Types"},
{"key": "fuel", "description": "🄵 Fuel"},
{"key": "gauge", "description": "🄵 Gauge"},
{"key": "male", "value": "male", "description": "🄵 Gender"},
{"key": "male", "value": "female", "description": "🄵 Gender"},
{"key": "male", "value": "unisex", "description": "🄵 Gender"},
{"key": "female", "value": "male", "description": "🄵 Gender"},
{"key": "female", "value": "female", "description": "🄵 Gender"},
{"key": "female", "value": "unisex", "description": "🄵 Gender"},
{"key": "unisex", "value": "male", "description": "🄵 Gender"},
{"key": "unisex", "value": "female", "description": "🄵 Gender"},
{"key": "unisex", "value": "unisex", "description": "🄵 Gender"},
{"key": "male", "description": "🄵 Gender"},
{"key": "female", "description": "🄵 Gender"},
{"key": "unisex", "description": "🄵 Gender"},
{"key": "generator:method", "description": "🄵 Method"},
{"key": "generator:output:electricity", "description": "🄵 Power Output"},
{"key": "generator:source", "description": "🄵 Source"},
@@ -7979,31 +7973,7 @@
{"key": "step_count", "description": "🄵 Number of Steps"},
{"key": "stop", "value": "all", "description": "🄵 Stop Type"},
{"key": "stop", "value": "minor", "description": "🄵 Stop Type"},
{"key": "tunnel", "value": "tunnel", "description": "🄵 Structure"},
{"key": "bridge", "value": "bridge", "description": "🄵 Structure"},
{"key": "bridge", "value": "tunnel", "description": "🄵 Structure"},
{"key": "bridge", "value": "embankment", "description": "🄵 Structure"},
{"key": "bridge", "value": "cutting", "description": "🄵 Structure"},
{"key": "bridge", "value": "ford", "description": "🄵 Structure"},
{"key": "tunnel", "value": "bridge", "description": "🄵 Structure"},
{"key": "tunnel", "value": "embankment", "description": "🄵 Structure"},
{"key": "tunnel", "value": "cutting", "description": "🄵 Structure"},
{"key": "tunnel", "value": "ford", "description": "🄵 Structure"},
{"key": "embankment", "value": "bridge", "description": "🄵 Structure"},
{"key": "embankment", "value": "tunnel", "description": "🄵 Structure"},
{"key": "embankment", "value": "embankment", "description": "🄵 Structure"},
{"key": "embankment", "value": "cutting", "description": "🄵 Structure"},
{"key": "embankment", "value": "ford", "description": "🄵 Structure"},
{"key": "cutting", "value": "bridge", "description": "🄵 Structure"},
{"key": "cutting", "value": "tunnel", "description": "🄵 Structure"},
{"key": "cutting", "value": "embankment", "description": "🄵 Structure"},
{"key": "cutting", "value": "cutting", "description": "🄵 Structure"},
{"key": "cutting", "value": "ford", "description": "🄵 Structure"},
{"key": "ford", "value": "bridge", "description": "🄵 Structure"},
{"key": "ford", "value": "tunnel", "description": "🄵 Structure"},
{"key": "ford", "value": "embankment", "description": "🄵 Structure"},
{"key": "ford", "value": "cutting", "description": "🄵 Structure"},
{"key": "ford", "value": "ford", "description": "🄵 Structure"},
{"key": "tunnel", "description": "🄵 Structure, 🄵 Type"},
{"key": "studio", "description": "🄵 Type"},
{"key": "substance", "description": "🄵 Substance"},
{"key": "substation", "description": "🄵 Type"},
@@ -8133,7 +8103,6 @@
{"key": "transformer", "value": "auxiliary", "description": "🄵 Type"},
{"key": "transformer", "value": "yes", "description": "🄵 Type"},
{"key": "trees", "description": "🄵 Trees"},
{"key": "tunnel", "description": "🄵 Type"},
{"key": "usage", "value": "main", "description": "🄵 Usage Type"},
{"key": "usage", "value": "branch", "description": "🄵 Usage Type"},
{"key": "usage", "value": "industrial", "description": "🄵 Usage Type"},