Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upcoming schema change in id-tagging-schema repository #452

Closed
tyrasd opened this issue Sep 29, 2022 · 5 comments
Closed

upcoming schema change in id-tagging-schema repository #452

tyrasd opened this issue Sep 29, 2022 · 5 comments
Labels
data Data processing and presets
Milestone

Comments

@tyrasd
Copy link

tyrasd commented Sep 29, 2022

Hi. As you are using the data from the id-tagging-schema repository, I'd like to notify you about some upcoming changes to the json schema used by it. See https://github.com/ideditor/schema-builder/blob/main/CHANGELOG.md#510 and openstreetmap/id-tagging-schema#598.

There are two changes which I would consider breaking:

  • There is a new colour field type, which should be pretty self-explanatory and can be handled like a combo field if no dedicated color input method is available or needed.
  • The schema now allows to cross-reference strings in presets and fields. This is intended used, for example, when there exist regional variants of a preset: By cross-referencing the name of the original preset, translators don't need to re-translate the same preset over and over again. Strings that are cross-referenced are missing in the dist/translations data, and are instead included in the presets[.min].json (or fields[.min].json) and use the same curly-bracket syntax that is used to cross-reference fields of preset (e.g. "label": "{building/levels}" in the building/levels_building field means that the field should use the same label as the building/levels field). The following strings can be cross-referenced:
    • a preset's name (if used, this implies that aliases and terms should also be used from the other preset)
    • a field's label (if used, this implies that the terms should also be used from the other field)
    • a field's placeholder
    • a field's strings (which used a dedicated property stringsCrossReference in order to keep the schema change to a minimum)

Examples:

field building/levels_building.json

{
    "key": "building:levels",
    "type": "number",
    "minValue": 0,
    "label": "{building/levels}",
    "placeholder": "{building/levels}",
    "prerequisiteTag": {
        "key": "building",
        "valueNot": "no"
    }
}

field payment_multi_fee.json

{
    "key": "payment:",
    "type": "multiCombo",
    "label": "{payment_multi}",
    "prerequisiteTag": {
        "key": "fee",
        "valueNot": "no"
    },
    "options": […],
    "stringsCrossReference": "{payment_multi}"
}

preset highway/motorway_link-US-CA.json

{
    "name": "{highway/motorway_link}",
    "icon": "iD-highway-motorway-link",
    "fields": [],
    "moreFields": [],
    "geometry": [
        "line"
    ],
    "tags": {
        "highway": "motorway_link"
    },
    "locationSet": {
        "include": [
            "ca",
            "us"
        ]
    }
}

This change will likely already affect the next version of released iD presets in a couple of weeks.

@Zverik
Copy link
Owner

Zverik commented Oct 2, 2022

Hi Martin, thanks for the heads up! It looks like the PR contents are different from what you're writing here: https://github.com/openstreetmap/id-tagging-schema/pull/598/files#diff-9b5f2c6ca12ef16831a653586844a31e069e942d407233afb6ccc6b270782027L2

@Zverik Zverik added the data Data processing and presets label Oct 2, 2022
@Zverik Zverik added this to the 2.1 milestone Oct 2, 2022
@tordans
Copy link

tordans commented Oct 2, 2022

Quick note: the schema (Martin's link) is in a different Repo than the data (your link). Both rely on eachother.

@Zverik
Copy link
Owner

Zverik commented Oct 2, 2022

I know, but the pull request is his, and if it is correct, then the documentation is wrong (and the implementation would be harder).

@tyrasd
Copy link
Author

tyrasd commented Oct 3, 2022

Right, the PR in the id-tagging-schema repository was incorrect. For these cross-references, one must use the same identifiers as in the fields and moreFields section (i.e. the key of the respective field or preset in the dist/fields.json or dist/presets.json output). Thanks for spotting that @Zverik

@Zverik
Copy link
Owner

Zverik commented May 21, 2023

Done in 3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data Data processing and presets
Projects
Status: Done
Development

No branches or pull requests

3 participants