mmd-osm left a comment (openstreetmap/openstreetmap-website#5973)

I tried a few variations to have `if-unused` on the same level as it is in the 
XML version. This turned out to be tricky. It would require us to introduce 
another `elements` array that would have to be added to create and modify 
actions as well for the sake of consistency.

<details>
<summary>(expand me)</summary>

```JSON
    "delete": {
      "if-unused": true,
      "elements": [
        {
          "type": "relation",
          "id": 18320662,
          "version": 1,
          "changeset": 159556552
        },
        {
          "type": "way",
          "id": 1338869356,
          "version": 1,
          "changeset": 159556552
        },
```
</details>

All in all, this seems rather ugly and I wouldn't recommend it. Also, it 
doesn't address the issue that some elements could have "if-unused": true, 
while other could have "if-unused": false. 

I see two options here: we could add it as an  "options" property on global 
level. Besides, "if-used" could also be added to each delete element, like I've 
mentioned in my previous post. I'm a bit undecided if we should support both, 
and allow the property on the delete element level to override the global 
option. Maybe that's over-engineering, and having only a global property would 
be just fine.

I'm demo'ing both variants in the example below:

```JSON
{
  "version": "0.6",
  "generator": "demo",
  "options": {
    "close_changeset_after_uploading": true,
    "if-unused": true
  },
  "osmChange": {
    "create": [
      {
        "type": "node",
        "id": -1,
        "lat": 81.0714,
        "lon": -139.0956,
        "changeset": 159556552,
        "tags": {
          "man_made": "mast",
          "name": "Principal"
        }
      }
    ],
    "modify": [
      {
        "type": "node",
        "id": 12394725038,
        "version": 3,
        "lat": -50.2701,
        "lon": 131.176,
        "changeset": 159556552,
        "tags": {
          "man_made": "mast",
          "name": "Future"
        }
      }
    ],
    "delete": [
      {
        "type": "relation",
        "id": 18320662,
        "version": 1,
        "changeset": 159556552,
        "if-unused": true
      },
      {
        "type": "way",
        "id": 1338869356,
        "version": 1,
        "changeset": 159556552,
        "if-unused": false
      },
      {
        "type": "node",
        "id": 12394725046,
        "version": 1,
        "changeset": 159556552,
        "if-used": true
      }
    ]
  }
}

```

An (optional) `options` property would also be a good place to store additional 
instructions, like "close the changeset after uploading". The options property 
isn't relevant for the download and can be omitted. The idea is to have one 
format that's fit for both upload and download scenarios.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5973#issuecomment-2847798724
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/5973/c2847798...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to