Template Struct OpaqueObjectField
Defined in File contract.hpp
Struct Documentation
-
template<class Class>
struct OpaqueObjectField Binds a JSON key to a
nlohmann::jsonstruct member that carries an “any-JSON-object whose shape is runtime-dependent” payload.Visitor behaviour:
JsonWriter - writes the member value as-is (no introspection / no type tagging).
JsonReader - accepts any JSON object value; rejects scalars, arrays, and null with a FieldError; absent fields leave the member at its default (empty object).
SchemaWriter - emits
{type:object, additionalProperties:true, x-medkit-opaque:true}and marks the field required (opaque fields are not wrapped in std::optional).
Use for fields whose shape depends on runtime context: live ROS message payloads, action results, plugin-provided data. NEVER brace-initialize directly - construct via the opaque_object() factory.
Public Types
-
using opaque_object_tag = void
Detection tag picked up by
is_opaque_object_fieldSFINAE.