Skip to content

Commit c92ceb1

Browse files
committed
Update per AMWA-TV/is-13#21
1 parent 674bb36 commit c92ceb1

File tree

3 files changed

+33
-17
lines changed

3 files changed

+33
-17
lines changed

Development/nmos/annotation_api.cpp

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,28 @@ namespace nmos
248248

249249
size_t count = 0;
250250

251-
set_reply(res, status_codes::OK,
252-
web::json::serialize_array(resources
253-
| boost::adaptors::filtered(match)
254-
| boost::adaptors::transformed(
255-
[&count](const nmos::resources::value_type& resource) { ++count; return nmos::make_annotation_response(resource); }
256-
)),
257-
web::http::details::mime_types::application_json);
251+
// experimental extension, to support human-readable HTML rendering of NMOS responses
252+
if (experimental::details::is_html_response_preferred(req, web::http::details::mime_types::application_json))
253+
{
254+
set_reply(res, status_codes::OK,
255+
web::json::serialize_array(resources
256+
| boost::adaptors::filtered(match)
257+
| boost::adaptors::transformed(
258+
[&count, &req](const nmos::resource& resource) { ++count; return experimental::details::make_html_response_a_tag(resource.id + U("/"), req); }
259+
)),
260+
web::http::details::mime_types::application_json);
261+
}
262+
else
263+
{
264+
set_reply(res, status_codes::OK,
265+
web::json::serialize_array(resources
266+
| boost::adaptors::filtered(match)
267+
| boost::adaptors::transformed(
268+
[&count](const nmos::resource& resource) { ++count; return value(resource.id + U("/")); }
269+
)
270+
),
271+
web::http::details::mime_types::application_json);
272+
}
258273

259274
slog::log<slog::severities::info>(gate, SLOG_FLF) << "Returning " << count << " matching " << resourceType;
260275

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema",
3+
"type": "array",
4+
"description": "List of resource ID paths",
5+
"title": "Resources base resource",
6+
"items": {
7+
"type": "string",
8+
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/$"
9+
},
10+
"uniqueItems": true
11+
}

Development/third_party/is-13/v1.0-dev/APIs/schemas/resource_cores.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)