Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#### :white_check_mark: Validation
* Don't error on features with a sole `note` tag ([#11522])
#### :bug: Bugfixes
* Fix some gpx/geojson properties not visible, such as numbers or complex data structures ([#11636], thanks [@k-yle])
#### :earth_asia: Localization
#### :hourglass: Performance
#### :mortar_board: Walkthrough / Help
Expand All @@ -51,6 +52,7 @@


[#11522]: https://github.com/openstreetmap/iD/issues/11522
[#11636]: https://github.com/openstreetmap/iD/pull/11636

# v2.37.3
##### 2025-10-31
Expand All @@ -65,7 +67,7 @@
# v2.37.2
##### 2025-10-30

* Correctly resolve subtitles of NSI presets when base preset has a crossreferenced string ([#11527])

Check failure on line 70 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / Check for spelling errors

crossreferenced ==> cross-referenced

Check failure on line 70 in CHANGELOG.md

View workflow job for this annotation

GitHub Actions / Check for spelling errors

crossreferenced ==> cross-referenced

[#11527]: https://github.com/openstreetmap/iD/issues/11527

Expand Down
4 changes: 2 additions & 2 deletions modules/ui/data_editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { t } from '../core/localizer';
import { modeBrowse } from '../modes/browse';
import { svgIcon } from '../svg/icon';

import { stringifyProperties } from '../util/object';
import { uiDataHeader } from './data_header';
import { uiSectionRawTagEditor } from './sections/raw_tag_editor';

Expand Down Expand Up @@ -64,7 +64,7 @@ export function uiDataEditor(context) {
.attr('class', 'raw-tag-editor data-editor')
.merge(rte)
.call(rawTagEditor
.tags((_datum && _datum.properties) || {})
.tags(stringifyProperties(_datum?.properties || {}))
.state('hover')
.render
)
Expand Down
2 changes: 1 addition & 1 deletion modules/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export { utilHashcode } from './util';
export { utilHighlightEntities } from './util';
export { utilKeybinding } from './keybinding';
export { utilNoAuto } from './util';
export { utilObjectOmit, utilCheckTagDictionary } from './object';
export { utilObjectOmit, utilCheckTagDictionary, stringifyProperties } from './object';
export { utilCompareIDs } from './util';
export { utilOldestID } from './util';
export { utilPrefixCSSProperty } from './util';
Expand Down
25 changes: 25 additions & 0 deletions modules/util/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,28 @@ export function utilCheckTagDictionary(tags, tagDictionary) {
}
return undefined;
}

/**
* converts every value in an object to a string, if
* it's not already a string.
* @param {Record<string, unknown>} object
*/
export function stringifyProperties(object) {
/** @type {Tags} */
const tags = {};
for (const key in object) {
switch (typeof object[key]) {
case 'undefined':
break; // skip property
case 'string':
tags[key] = object[key];
break;
default:
tags[key] = JSON.stringify(
object[key],
(_, value) => typeof value === 'bigint' ? value.toString() : value
);
}
}
return tags;
}
23 changes: 23 additions & 0 deletions test/spec/util/object.js → test/spec/util/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,26 @@ describe('iD.utilCheckTagDictionary', () => {
expect(iD.utilCheckTagDictionary({ surface: 'paved' }, dictionary)).toBe(0);
});
});

describe('stringifyProperties', () => {
it('converts object properties to a string', () => {
const input = {
a: 'a',
b: 1,
c: null,
d: undefined,
e: { f: 1 },
g: [1, 2n],
h: 1n,
};
expect(iD.stringifyProperties(input)).toStrictEqual({
a: 'a',
b: '1',
c: 'null',
// d (undefined) is skipped
e: '{"f":1}',
g: '[1,"2"]',
h: '"1"',
});
});
});