[openstreetmap/openstreetmap-website] Added JSON support to user preferences (#3164)
Andy Allan
notifications at github.com
Wed Apr 7 09:43:37 UTC 2021
@gravitystorm requested changes on this pull request.
This PR also needs tests. Similarly to the previous JSON-response PRs, it doesn't need to duplicate every test of the XML output, but just enough to ensure that the routes exist, and that when json is requested a suitable json-formatted response is received.
Have a look at test/controllers/api/users_controller_test.rb and search for 'json' to see what I mean.
> @@ -0,0 +1 @@
+json.partial! @user_preferences
This should also contain the `root_elements`, similar to the XML response. This is already implemented for e.g. showing relations - see https://github.com/openstreetmap/openstreetmap-website/blob/master/app/views/api/relations/show.json.jbuilder
When those are included, it becomes clearer that there needs to be a root `preferences` (n.b. plural) key, to match the naming of the `<preferences>` element in the XML response.
So something like this:
```
{
"version": "0.6",
"generator": "OpenStreetMap server",
"copyright": "OpenStreetMap and contributors",
"attribution": "http://www.openstreetmap.org/copyright",
"license": "http://opendatacommons.org/licenses/odbl/1-0/",
"preferences": {
"foo": "bar",
"another_pref": "something else",
"more preferences": "go here"
}
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3164#pullrequestreview-629801732
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20210407/8d5354c8/attachment.htm>
More information about the rails-dev
mailing list