Add nmos::validate_node_settings/validate_registry_settings#2
Merged
jonathan-r-thorpe merged 1 commit intoJun 1, 2026
Conversation
Adds runtime validation of the known properties in nmos::settings, so that problems in user-supplied config.json (or command-line settings) are reported clearly up front instead of as bare json_exceptions later from field accessors. Validation is implemented as JSON schemas embedded in the source, composed via cross-schema $refs and run through the existing cpprest json_validator. Errors are reported as web::json::json_exception with a JSON pointer to the offending key and a description of the failed constraint, e.g. JSON error: schema validation failed at /ptp_domain_number - instance exceeds maximum of 127 JSON - 200 A fragment of NMOS value-type definitions (uuid, rational, interlaceMode, colorspace, transferCharacteristic, colorSampling, tags, ...) is exposed via nmos::details::settings_definitions_schema() so that application code can compose its own settings JSON schema and reuse the same canonical types. nmos-cpp-node uses this to implement impl::validate_node_settings for its additional impl::fields::* settings. Both example apps now validate settings (and abort with a clear error) before inserting run-time defaults and before any other field access.
41b6a58
into
jonathan-r-thorpe:nmos-mxl-test
10 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds runtime validation of the known properties in
nmos::settings, so that problems in user-suppliedconfig.json(or command-line settings) are reported clearly up front instead of as barejson_exceptions later from field accessors. Validation is implemented as JSON schemas embedded in the source, composed via cross-schema$refsand run through the existing cpprestjson_validator. Errors are reported asweb::json::json_exceptionwith a JSON pointer to the offending key and a description of the failed constraint, e.g.A fragment of NMOS value-type definitions (uuid, rational, interlaceMode, colorspace, transferCharacteristic, colorSampling, tags, ...) is exposed via
nmos::details::settings_definitions_schema()so that application code can compose its own settings JSON schema and reuse the same canonical types. nmos-cpp-node uses this to implementvalidate_node_implementation_settingsfor its additionalimpl::fields::*settings.Both example apps now validate settings (and abort with a clear error) before inserting run-time defaults and before any other field access.