[openstreetmap/openstreetmap-website] JSON output added to changeset(s) endpoints (PR #3495)

mmd notifications at github.com
Sat Mar 12 11:32:12 UTC 2022


I think it might be worthwhile comparing different options for a single changeset in `changeset.json.jbuilder`:

#### Option 1: Put single changeset in changesets array:

```ruby
json.partial! "api/root_attributes"

json.changesets([@changeset]) do |changeset|
  json.partial! changeset
end
```
(see example above)

#### Option 2: changeset element with single chageset

```ruby
json.partial! "api/root_attributes"

json.changeset do
  json.partial! @changeset
end
```

```json
{
  "version": "0.6",
  "generator": "OpenStreetMap server",
  "copyright": "OpenStreetMap and contributors",
  "attribution": "http://www.openstreetmap.org/copyright",
  "license": "http://opendatacommons.org/licenses/odbl/1-0/",
  "changeset": {
    "id": 1874552,
    "created_at": "2021-01-23T22:01:04Z",
    "open": false,
    "comments_count": 0,
    "changes_count": 260,
    "closed_at": "2021-01-23T22:01:13Z",
    "min_lat": -12.2373657,
    "min_lon": -45.9127416,
    "max_lat": 13.8360116,
    "max_lon": -25.2032019,
    "uid": 2,
    "user": "mmd3",
    "tags": {
      "created_by": "JOSM/1.5 (17473)"
    },
    "comments": []
  }
}
```

#### Option 3: Merge changeset attributes in higher level element:

```ruby
json.partial! "api/root_attributes"

json.partial! @changeset
```

```json
{
  "version": "0.6",
  "generator": "OpenStreetMap server",
  "copyright": "OpenStreetMap and contributors",
  "attribution": "http://www.openstreetmap.org/copyright",
  "license": "http://opendatacommons.org/licenses/odbl/1-0/",
  "id": 1874553,
  "created_at": "2021-01-23T22:01:41Z",
  "open": false,
  "comments_count": 2,
  "changes_count": 10000,
  "closed_at": "2021-01-23T23:05:28Z",
  "min_lat": -13.6479226,
  "min_lon": -62.78181,
  "max_lat": 22.8223133,
  "max_lon": -24.9335172,
  "uid": 2,
  "user": "mmd3",
  "tags": {
    "created_by": "JOSM/1.5 (17473)"
  }
}
```

Option 1 is the one currently implemented. I'm not sure which of those options would make most sense here. 



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

Message ID: <openstreetmap/openstreetmap-website/pull/3495/c1065866706 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220312/d11b49df/attachment.htm>


More information about the rails-dev mailing list