<p></p>
<p><b>@mattfbacon</b> requested changes on this pull request.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4159#discussion_r1292045803">test/controllers/api/capabilities_controller_test.rb</a>:</p>
<pre style='color:#555'>> +      assert_equal Settings.api_version, js["version"]
+      assert_equal Settings.generator, js["generator"]
+      assert_equal Settings.api_version, js["api"]["version"]["minimum"]
+      assert_equal Settings.api_version, js["api"]["version"]["maximum"]
+      assert_equal Settings.max_request_area, js["api"]["area"]["maximum"]
+      assert_equal Settings.max_note_request_area, js["api"]["note_area"]["maximum"]
+      assert_equal Settings.tracepoints_per_page, js["api"]["tracepoints"]["per_page"]
+      assert_equal Changeset::MAX_ELEMENTS, js["api"]["changesets"]["maximum_elements"]
+      assert_equal Settings.default_changeset_query_limit, js["api"]["changesets"]["default_query_limit"]
+      assert_equal Settings.max_changeset_query_limit, js["api"]["changesets"]["maximum_query_limit"]
+      assert_equal Settings.max_number_of_relation_members, js["api"]["relationmembers"]["maximum"]
+      assert_equal "online", js["api"]["status"]["database"]
+      assert_equal "online", js["api"]["status"]["api"]
+      assert_equal "online", js["api"]["status"]["gpx"]
+      assert_equal Settings.imagery_blacklist.length, js["policy"]["imagery"]["blacklist"].length
+    end
</pre>
<p dir="auto">These tests generally look good, but they implicitly allow adding more keys to the JSON without changing the tests, which may not be desirable. If you constructed the object that we expect and then compared it with <code class="notranslate">js</code>, that might work better to test against added keys.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4159#discussion_r1292047330">test/controllers/api/capabilities_controller_test.rb</a>:</p>
<pre style='color:#555'>>        assert_recognizes(
         { :controller => "api/capabilities", :action => "show" },
         { :path => "/api/0.6/capabilities", :method => :get }
</pre>
<p dir="auto">Should there be another <code class="notranslate">assert_recognizes</code> here for the JSON route?</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4159#discussion_r1292047715">app/views/api/capabilities/show.json.jbuilder</a>:</p>
<pre style='color:#555'>> +    json.seconds Settings.api_timeout
+  end
+  json.status do
+    json.database @database_status
+    json.api @api_status
+    json.gpx @gpx_status
+  end
+end
+
+json.policy do
+  json.imagery do
+    json.blacklist(Settings.imagery_blacklist) do |url_regex|
+      json.regex url_regex.to_s
+    end
+  end
+end
</pre>
<p dir="auto">This looks good as a verbatim copy of the XML builder (though I haven't looked at it in depth), but I wonder it it would be possible to consolidate this JSON generation and the XML generation into a single "data generation" step which would create a Ruby data structure, followed by a serialization step which could dynamically choose the format: JSON or XML.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4159#pullrequestreview-1574758485">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLMLFH7MIZXUB5FOZK3XU36MVANCNFSM6AAAAAA3NUPIKU">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLN6GL4RC5ZPPIZ2AATXU36MVA5CNFSM6AAAAAA3NUPIKWWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTS53TUFK.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/4159/review/1574758485</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/4159#pullrequestreview-1574758485",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/4159#pullrequestreview-1574758485",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>