Skip to content

Commit 6225ecb

Browse files
authored
taginfo manifest - more accurate listing of supported keys (#331)
* taginfo - more accurate listing of supported keys specify in docs that multiCombo and manyCombo are not expected to support freeform values do not claim that suffix from multiCombo is supported key do not claim that multiCombo, manyCombo, check, defaultCheck, onewayCheck are supporting freeform values if field disabled autoSuggestion and customValues - do not list it as supporting freeform values fixes #273 but properly - require also customValues to be false fixes #286 * record also yes and no (where applicable) values of checkboxes
1 parent 55853c3 commit 6225ecb

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

β€ŽREADME.mdβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,9 @@ A string specifying the UI and behavior of the field. Must be one of the followi
519519
* `combo` - Dropdown field for picking one option out of many (e.g. `surface=*`)
520520
* `typeCombo` - Dropdown field picking a specific type from a generic category key<br/>
521521
(e.g. `waterway=*`. If unset, tag will be `waterway=yes`, but dropdown contains options like `stream`, `ditch`, `river`)
522-
* `multiCombo` - Dropdown field for adding `yes` values to multiple keys with the same prefix (a common multikey)<br/>
523-
(e.g. `recycling:*` -> `recycling:glass=yes`, `recycling:paper=yes`, etc.)
524-
* `manyCombo` - Dropdown field for adding `yes` values to many different keys<br/>
522+
* `multiCombo` - Dropdown field for adding `yes` value to multiple keys with the same prefix (a common multikey) and suffixes selected among specified options<br/>
523+
(e.g. `recycling:*` as prefix and `glass`, `paper` as suffixes -> `recycling:glass=yes`, `recycling:paper=yes`)
524+
* `manyCombo` - Dropdown field for adding `yes` values to many different keys from a specified list<br/>
525525
(e.g. `bus`, `tram`, `train` -> `bus=yes`, `tram=yes`, etc.)
526526
* `networkCombo` - Dropdown field that helps users pick a route `network` tag (localized for editing location)
527527
* `semiCombo` - Dropdown field for adding multiple values to a semicolon-delimited list<br/>

β€Žlib/build.jsβ€Ž

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,18 @@ function generateTaginfo(presets, fields, deprecated, discarded, tstrings, proje
676676
}
677677
tag.description = [ `πŸ„΅ ${label}` ];
678678

679-
coalesceTags(taginfo, tag);
679+
if (areAnyFreeFormTagsAcceptedInField(field)) {
680+
coalesceTags(taginfo, tag);
681+
}
682+
let yesTag = { ...tag, value: 'yes', description: [`πŸ„΅πŸ…… ${label}: yes`] };
683+
let noTag = { ...tag, value: 'no', description: [`πŸ„΅πŸ…… ${label}: no`] };
684+
if (field.type === 'defaultCheck') {
685+
coalesceTags(taginfo, yesTag);
686+
}
687+
if (field.type === 'check' || field.type === 'onewayCheck') {
688+
coalesceTags(taginfo, yesTag);
689+
coalesceTags(taginfo, noTag);
690+
}
680691

681692
if (field.options && !isRadio && field.type !== 'manyCombo') {
682693
field.options.forEach(value => {
@@ -749,6 +760,15 @@ function generateTaginfo(presets, fields, deprecated, discarded, tstrings, proje
749760
}
750761
});
751762

763+
function areAnyFreeFormTagsAcceptedInField(field) {
764+
if (['multiCombo', 'manyCombo', 'check', 'defaultCheck', 'onewayCheck'].includes(field.type)) {
765+
return false;
766+
}
767+
if (field.autoSuggestion === false && field.customValues === false) {
768+
return false;
769+
}
770+
return true;
771+
}
752772

753773
/**
754774
* @param {TaginfoSchema} taginfo

0 commit comments

Comments
Β (0)