Skip to content

Commit e1a2fc5

Browse files
committed
support discarding tags, not just keys
1 parent f15c5a2 commit e1a2fc5

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

lib/build.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -668,15 +668,20 @@ function generateTaginfo(presets, fields, deprecated, discarded, tstrings, proje
668668
});
669669

670670
if (!discarded) discarded = {};
671-
Object.keys(discarded).forEach(key => {
671+
for (const key in discarded) {
672672
let description = '🄳🄳 (discarded tag)';
673-
/** @type {TaginfoTag} */
674-
let tag = {
675-
key,
676-
description: [description]
677-
};
678-
coalesceTags(taginfo, tag);
679-
});
673+
if (discarded[key] === true) {
674+
// key=*
675+
let tag = { key, description: [description] };
676+
coalesceTags(taginfo, tag);
677+
} else {
678+
// key=value
679+
for (const value in discarded[key]) {
680+
const tag = { key, value, description: [description] };
681+
coalesceTags(taginfo, tag);
682+
}
683+
}
684+
}
680685

681686
taginfo.tags.forEach(elem => {
682687
if (elem.description) {

schemas/discarded.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
"$schema": "http://json-schema.org/draft-07/schema#",
33
"$id": "https://github.com/ideditor/schema-builder/raw/main/schemas/discarded.json",
44
"title": "Discarded tags",
5-
"description": "Keys of tags to be deleted when editing features.",
5+
"description": "Keys or tags to be deleted when editing features.",
66
"type": "object",
77
"additionalProperties": {
8-
"type": "boolean"
8+
"anyOf": [
9+
{ "type": "boolean", "enum": [true] },
10+
{
11+
"type": "object",
12+
"additionalProperties": { "type": "boolean", "enum": [true] },
13+
"minProperties": 1
14+
}
15+
]
916
}
1017
}

0 commit comments

Comments
 (0)