Skip to content

Commit b7c2e57

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

File tree

5 files changed

+35
-19
lines changed

5 files changed

+35
-19
lines changed

Development/cmake/NmosCppLibraries.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ set(NMOS_IS13_V1_0_SCHEMAS_JSON
700700
third_party/is-13/${NMOS_IS13_V1_0_TAG}/APIs/schemas/error.json
701701
third_party/is-13/${NMOS_IS13_V1_0_TAG}/APIs/schemas/resource_core.json
702702
third_party/is-13/${NMOS_IS13_V1_0_TAG}/APIs/schemas/resource_core_patch.json
703-
third_party/is-13/${NMOS_IS13_V1_0_TAG}/APIs/schemas/resource_cores.json
703+
third_party/is-13/${NMOS_IS13_V1_0_TAG}/APIs/schemas/resource-list.json
704704
)
705705

706706
set(NMOS_IS13_SCHEMAS_JSON_MATCH "third_party/is-13/([^/]+)/APIs/schemas/([^;]+)\\.json")

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

Development/nmos/is13_schemas/is13_schemas.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace nmos
1414
extern const char* error;
1515
extern const char* resource_core;
1616
extern const char* resource_core_patch;
17-
extern const char* resource_cores;
17+
extern const char* resource_list;
1818
}
1919
}
2020
}
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)