Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of IS-13 NMOS Annotation API #331

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

garethsb
Copy link
Contributor

⚠️ Ink isn't dry on the IS-13 spec, but here's an implementation.

@garethsb garethsb changed the title Implementation of IS-13 NMOS Read/Write Node API Implementation of IS-13 NMOS Annotation API May 22, 2023
@garethsb
Copy link
Contributor Author

Current annotation_patch_merger has three arguments:

  1. const nmos::resource& resource - the IS-04 resource that is being PATCHed
  2. web::json::value& value - contains the annotation properties from that resource, modifiable by the callback
  3. const web::json::value& patch - contains the body of the PATCH request, which is guaranteed valid per the schema

The behaviour is that the callback is expected to update the value with the patch, and then the calling function updates the resource from the updated value.

Passing read-only resource and a writable value ensures that the callback cannot update other properties than label, description and tags, but that it has access to the full resource to determine semantic validity.

However, the implementation is still a bit complicated. The callback might want to proceed to...

  • reject the PATCH request completely if it attempts to change to read-only properties e.g. because the whole resource is read-only (Sources and Flows in dynamic Nodes), or because certain tags are read-only such as BCP-002-02 Asset Distinguishing Information or vendor-specific tags
  • reject the PATCH request completely if the values are unacceptable for this particular resource, such as being too large for persistent storage or not meeting format for particular tag
  • merge the patch
  • apply default values if the PATCH request removed/reset values that cannot be omitted per spec or particular resource
  • reject the PATCH request completely if the final values are unacceptable

@garethsb
Copy link
Contributor Author

As @jonathan-r-thorpe suggested, nmos::details::is_read_only_tag is now an overridable predicate, and default values can also be specified declaratively. This is demonstrated by nmos-cpp-node/node_implementation.cpp for the Node and Device tags specified via config.json node_tags and device_tags.

garethsb and others added 2 commits August 2, 2023 23:05
# Conflicts:
#	Development/cmake/NmosCppLibraries.cmake
#	Development/nmos-cpp-node/config.json
#	Development/nmos-cpp-node/node_implementation.cpp
#	Development/nmos/json_schema.cpp
#	Development/nmos/json_schema.h
#	Development/nmos/node_server.cpp
#	Development/nmos/node_server.h
#	Development/nmos/settings.h
#	Development/third_party/README.md
#	README.md
@garethsb
Copy link
Contributor Author

garethsb commented Jul 1, 2024

@jonathan-r-thorpe, @lo-simon, I've just attempted to merge master into this rwnode branch, so let's keep an eye on the tests :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant