From e5daf06902a3eb50af7184d0713186aaaa2117d1 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 29 Oct 2026 06:21:50 +0100 Subject: [PATCH 01/60] feat(extensions): add Web of Things context extension Signed-off-by: Marc --- cloudevents/extensions/README.md | 1 + cloudevents/extensions/opcua.md | 91 +++++++- cloudevents/extensions/wot.md | 342 +++++++++++++++++++++++++++++++ 3 files changed, 431 insertions(+), 3 deletions(-) create mode 100644 cloudevents/extensions/wot.md diff --git a/cloudevents/extensions/README.md b/cloudevents/extensions/README.md index 0b66ea88d..8982d3699 100644 --- a/cloudevents/extensions/README.md +++ b/cloudevents/extensions/README.md @@ -53,3 +53,4 @@ for more information. - [Sampling](sampledrate.md) - [Sequence](sequence.md) - [Severity](severity.md) +- [Web of Things](wot.md) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 95954fb23..918584878 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -39,6 +39,31 @@ like a unified namespace path. MUST map to [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) field `MessageType`. +### WoT mapping + +When a CloudEvent uses both this extension and the +[WoT extension](./wot.md), the following mappings apply to data and event +messages: + +- `type` MUST follow the WoT extension's semantic event-type rules instead of + mapping to the native `MessageType`. +- `opcuamessagetype` MUST carry the native `MessageType`. +- `subject` MUST follow the WoT extension's affordance-pointer rules. +- `opcuadatasetwriterid` MUST carry the native `DataSetWriterId`; it MUST NOT + be appended to `subject`. +- For an event message, the `EventId` remains in the OPC UA event payload and + MUST NOT be appended to `subject`. +- `opcuapublisherid` MUST identify the native PublisherId. +- `opcuasequence` MUST carry the native `SequenceNumber`. The CloudEvents + `sequence` attribute, when present, MUST satisfy the independent ordering + requirements of the Sequence extension and MUST NOT be inferred from + `opcuasequence`. + +These conditional mappings replace only the conflicting OPC UA mappings above. +All other requirements in this extension remain applicable. A profile that +uses only part of this extension MUST NOT claim conformance to it unless the +profile satisfies every applicable requirement in this document. + ## Mapping of OPTIONAL Attributes ### datacontenttype @@ -57,6 +82,8 @@ those cases the attribute references the schema and is used for versioning. ### subject +When the WoT extension is not used, the following OPC UA mappings apply: + For metadata, event and data messages (type one of `ua-metadata`, `ua-keyframe`, `ua-deltaframe`, `ua-event`), `subject` MUST map to either [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) @@ -74,14 +101,17 @@ field `Timestamp`. ## Mapping for other extensions -The following well-known extensions attributes MUST be used for data messages and -event messages (type one of `ua-keyframe`, `ua-deltaframe`, `ua-event`). +For data and event messages, the following well-known extension attributes +apply when this extension is used without the WoT extension. When both +extensions are used, determine message type from `opcuamessagetype`. ### sequence Attribute as defined by [sequence extensions](./sequence.md) MUST map to [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) -field `SequenceNumber`. +field `SequenceNumber`, except when the WoT extension is also used. In that +case, `opcuasequence` maps to the native field and `sequence` has the +independent meaning defined by the Sequence extension. ### traceparent @@ -128,6 +158,61 @@ field `MetaDataVersion`. - REQUIRED if status is not _Good_ - MAY be omitted if status is _Good_ +### opcuapublisherid + +- Type: `String` +- Description: Identifies the OPC UA PubSub PublisherId. +- Constraints + - OPTIONAL + - If present, MUST use `:`. + - For `Byte`, `UInt16`, `UInt32` and `UInt64`, `` MUST be the + canonical unsigned decimal representation of the PublisherId. + - For `Guid`, `` MUST be the lowercase canonical UUID representation + of the PublisherId. + - For `String`, `` MUST be the unpadded base64url encoding of the + PublisherId's UTF-8 bytes. + - In combination with the WoT extension, REQUIRED for data and event + messages. + - MUST map to the Network Message Header `PublisherId`. + +### opcuadatasetwriterid + +- Type: `Integer` +- Description: Identifies the DataSetWriter that produced the DataSetMessage. +- Constraints + - OPTIONAL + - If present, MUST be in the range 0 to 65535, inclusive. + - In combination with the WoT extension, REQUIRED for data and event + messages. + - MUST map to the Data Set Message Header `DataSetWriterId`. + +### opcuamessagetype + +- Type: `String` +- Description: Carries the OPC UA PubSub DataSetMessage type when `type` + identifies a WoT semantic event type. +- Constraints + - OPTIONAL + - In combination with the WoT extension, REQUIRED for data and event + messages. + - MUST map to the Data Set Message Header `MessageType`. + - The value MUST be the native OPC UA message type, such as `ua-keyframe`, + `ua-deltaframe` or `ua-event`. + +### opcuasequence + +- Type: `Integer` +- Description: Carries the native DataSetMessage sequence counter without + assigning CloudEvents Sequence extension ordering semantics to it. +- Constraints + - OPTIONAL + - If present, MUST be in the range 0 to 65535, inclusive. + - In combination with the WoT extension, REQUIRED for keyframe, deltaframe + and event messages. + - MUST map to the Data Set Message Header `SequenceNumber`. + - MUST NOT be interpreted as a source-wide sequence unless it also + independently satisfies the Sequence extension's requirements. + ## General Constraints - OPC UA messages MUST use `binary-mode` of CloudEvents. diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md new file mode 100644 index 000000000..7c7e1308d --- /dev/null +++ b/cloudevents/extensions/wot.md @@ -0,0 +1,342 @@ +# Web of Things + +This extension identifies the [Web of Things Thing Description][TD] (TD) that +describes the interaction associated with a CloudEvent. It separates the +Thing's identity, the selected TD representation, its revision and +verification of its bytes. The selected representation can be the authored TD +or a resolved TD derived from it. + +The extension also defines a convention for event types derived from a +[Thing Model][TM] (TM), affordance subjects and the relationship between a TD +and the payload schema. It does not define a transport binding, provision a +Thing, or require a particular registry implementation. + +## Notational Conventions + +As with the main [CloudEvents specification](../spec.md), the key words "MUST", +"MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", +"RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as +described in [RFC 2119](https://tools.ietf.org/html/rfc2119). + +The scope of these key words is limited to events using this extension. An +attribute marked REQUIRED here is not REQUIRED in every CloudEvent. + +## Attributes + +### wotid + +- Type: `URI` +- Description: The stable WoT identity of the Thing described by the + referenced TD. It is not the location of a registry entry or the schema of + the CloudEvent's `data`. +- Constraints: + - REQUIRED + - MUST be a non-empty absolute URI. + - MUST equal the TD's `id` value when that member is present. + - A resolved TD MUST retain the authored TD's `id` when it is present. + - When the authored TD has no `id`, the Producer MUST use the stable WoT + identity assigned to it by its publication contract. A resolved TD for + that Thing MUST use the same identity. + - MUST NOT change merely because another revision of the same TD is + published. + +A URI used as an identity is not necessarily a document retrieval URL. A +Consumer MUST NOT assume that an arbitrary `wotid` can be fetched directly. +The deployment or publication profile defines the resolver and its lookup +scope. The identity can name either an authored TD or a resolved TD for the +same Thing; it does not select between those representations. + +### wottd + +- Type: `URI` +- Description: The location of the TD document view to use. It can identify + either the authored TD or a resolved TD. +- Constraints: + - OPTIONAL + - If present, MUST be a non-empty absolute URI. + - MUST identify the TD document, not registry metadata about the TD. + - The resolved document MUST have the `wotid` identity. + - If `wotversion` is also present, the selected document MUST be that exact + revision. + +`wottd` selects a representation; `wotid` identifies the Thing. A Producer +MAY set `wottd` to distinguish an authored TD from a resolved TD when both +are available under the same identity and revision. If it is absent, the +configured resolver selects the representation. A resolution scope that +matches more than one representation MUST be narrowed by the publication +profile or by `wottd`; a Consumer MUST NOT choose one arbitrarily. + +### wotversion + +- Type: `String` +- Description: The exact revision of the TD identified by `wotid`, within the + configured resolution scope and selected representation. This is a document + revision, not the CloudEvents `specversion`, the version of a WoT vocabulary + or the version of the wire-payload schema. +- Constraints: + - OPTIONAL + - If present, MUST be non-empty and MUST identify exactly one revision. + - MUST NOT be interpreted as a minimum acceptable version or a version range. + - MUST NOT be inferred from, or appended to, `wotid`. + - If absent, the Consumer MUST use the revision identified by `wottd`, when + present, or the default revision selected by the configured resolver. + - If `wottd` is present and the locator identifies a revision, that revision + MUST match `wotversion`. + +A publication profile MAY require `wotversion`. An exact revision is +RECOMMENDED when later interpretation of a stored event depends on the same +description. An unversioned reference can resolve differently after the +resolver's default changes; it does not pin the description that existed +when the event was produced. + +Version identifiers are opaque outside their governing publication contract. +A Consumer MUST NOT select the default by sorting identifiers or substitute +a different revision when the requested revision is unavailable. + +### wotdigest + +- Type: `String` +- Description: A digest of the selected authored or resolved TD document's + exact bytes, independent of its identity and retrieval location. +- Constraints: + - OPTIONAL + - If present, MUST have the form `sha-256:` followed by exactly 64 lowercase + hexadecimal characters. + - The hexadecimal value MUST be the SHA-256 digest of the TD document bytes + obtained after removing transport framing and content coding, but before + parsing or reserializing the document. + - When a Consumer uses the referenced TD to interpret the event, it MUST + verify a supplied digest before using that TD. + +The digest covers the selected TD representation, not the CloudEvent, its +payload, a registry metadata response or the documents referenced by the TD. +It does not require JSON-LD expansion or JSON canonicalization. Whitespace +changes can change the digest. + +When both `wotversion` and `wottd` are absent, `wotdigest` verifies the default +revision and representation selected by the resolver; it does not define a +search for some historical revision or representation having that digest. A +missing digest provides no byte-verification result. A matching digest is not +a signature and does not authenticate the Producer. + +## Resolving the Thing Description + +The Producer and Consumer MUST agree on the resolution scope out of band or +through their publication profile. That scope includes any registry, tenant +or Group selection needed to distinguish copies of the same WoT identity and, +where necessary, the authored and resolved representations. This extension +does not prescribe a discovery protocol. + +A Consumer using this extension to interpret `data` MUST resolve the selected +representation and revision without substituting a document with another +identity. It MUST retrieve the document view identified by `wottd` when that +attribute is present. Otherwise, it MUST use the configured resolver for +`wotid`, `wotversion` and the publication profile's representation selection. +An unavailable revision, ambiguous representation, mismatching TD `id`, +malformed digest or failed digest comparison MUST be treated as unresolved +description metadata. A Consumer MAY retain or forward the CloudEvent without +interpreting its payload; it MUST NOT report successful TD-based +interpretation using an unresolved reference. + +The [xRegistry WoT working draft][WoT Registry] describes one resolution +mechanism. It is a working draft, not a universal dependency of this extension. +In that draft: + +- `wotid` is the authored WoT identity, distinct from a registry Resource id. +- `wotversion`, when present, corresponds to the Resource's exact `versionid`. +- An unversioned Resource reference serves its configured default Version, + which is not necessarily the most recently created Version. +- The Consumer retrieves the TD document view, not the registry metadata view. + +The xRegistry WoT draft stores authored documents. A resolved TD can instead be +identified by `wottd` when a deployment publishes that representation as a +document view. A registry Resource URL MUST NOT be treated as the resolved TD +unless its document view actually returns that TD. + +The Consumer still needs a configured registry scope. A registry-wide identity +query can return more than one Resource; choosing the first match does not +establish which description the Producer meant. The same applies when a scope +can return both authored and resolved representations. + +## Mapping Core Context Attributes + +### type + +The Core [`type`](../spec.md#type) describes the semantic event type. A +Thing's identity in `wotid` is not its event type: two Things can produce +events described by the same model. + +For TM-derived publications, the Producer MUST select a governing TM and the +corresponding model-affordance path. When composition or derivation does not +identify one such mapping unambiguously, the publication configuration MUST +select it explicitly. A Producer MUST NOT infer that correspondence solely +from matching names or select the first TM link arbitrarily. + +The following naming convention constructs a reverse-DNS-prefixed type base +from an HTTPS TM identifier: + +1. Parse the absolute identifier without removing its path, query or fragment. + The authority MUST contain an ASCII DNS hostname with no empty labels or + trailing root dot, and MUST NOT contain user information. Other authorities, + including IP addresses, require an explicit base instead. +2. Lowercase the ASCII DNS hostname and reverse its labels. +3. Encode the identifier's exact suffix after the hostname, including any + explicit port, path, query and fragment, as one token using the encoding + below. +4. Append `.wot.` and that token to the reversed hostname. + +For other TM identifier schemes, or HTTPS identifiers not meeting these +conditions, the publication configuration MUST supply an explicit +reverse-DNS-prefixed base. That configuration MUST assign distinct bases to +distinct governing TMs in its type namespace. + +Append `.affordance.` and the encoded model-affordance path tokens to the +base. The model path is an [RFC 6901][JSON Pointer] JSON Pointer within the +TM that identifies an interaction affordance. Decode its JSON Pointer +escaping before encoding each token, and join the resulting tokens with `.`. + +For both uses of token encoding, encode the input's UTF-8 bytes. Leave only +ASCII letters, digits, `-` and `_` unescaped. Encode every other byte as `%` +followed by two uppercase hexadecimal digits. Represent an empty token as +`~`; a literal tilde is encoded as `%7E`. Dots and percent signs are escaped, +so a literal dot in a name cannot be confused with a path-token separator. +This encoding is part of the type String, not an instruction to dereference it. + +For example, TM `https://models.example.com/tm/pump` and model affordance +`/properties/processData` produce: + +```text +com.example.models.wot.%2Ftm%2Fpump.affordance.properties.processData +``` + +Changing the encoded TM suffix, governing base or model-affordance path +changes this derived type; changing only the hostname's letter case does not. +The Producer MUST NOT change that derivation merely because a different TD +instance or registry location is used. Versioning the payload schema is +separate from naming a semantic event type. + +A TD can be published without a governing TM. This extension does not invent +one: publications without a TM-derived type follow Core's producer-defined +type rules. A profile requiring TM-derived types MUST reject missing or +ambiguous model mappings rather than inventing a base. + +### subject + +The [`subject`](../spec.md#subject), when present, MUST be an RFC 6901 JSON +Pointer to the concrete interaction affordance within the referenced TD, +such as `/properties/processData` or `/events/alarm`. It is not a URI +fragment and MUST NOT be prefixed with `#`. + +The subject identifies an affordance, not an occurrence. Different events +from that affordance can have the same subject and different CloudEvents +`id` values. A binding-specific writer identifier or native occurrence +identifier is not appended to this pointer. + +The concrete TD path and the corresponding TM declaration path can differ. +This extension does not infer a declaration-lineage mapping between them. + +### dataschema and datacontenttype + +Core [`dataschema`](../spec.md#dataschema) identifies the schema that the +CloudEvent's actual `data` adheres to. +[`datacontenttype`](../spec.md#datacontenttype) identifies that data's media +type. Neither identifies the TD document's format. + +A TD describes interactions and can contain several DataSchemas. The +Producer MUST NOT use the whole TD as `dataschema` merely because the TD +contains a schema for the selected affordance. A TD's retrieval URL is a +valid `dataschema` only if the identified representation is itself the +schema applicable to `data`. + +The publication profile or protocol binding defines how the selected +affordance's DataSchema maps to the wire payload. An object containing +several property values, an event payload and a protocol envelope can need +different schemas. When `dataschema` is present, the Producer MUST ensure +that it identifies the schema of the representation actually sent, including +any encoding or envelope selected by the binding. + +An xRegistry Schema Resource's document-view URL can identify that external +schema. It is not the WoT Resource's metadata-view URL. A profile MAY require +an exact schema Version independently of `wotversion`. + +### Relationship to Other Extensions + +This extension does not redefine native message types, sequence counters, +writer identities or source identities. A profile that also uses the +[OPC UA extension](opcua.md) MUST specify how its TM-derived type and +affordance subject interact with that extension's existing type and subject +mappings. Merely adding `wotid` does not permit overriding them or establish +conformance to the OPC UA extension. + +## Example + +The following CloudEvents describe the same pump and affordance. The first +references the authored TD through the configured resolver. The second uses +`wottd` to select a resolved representation explicitly. Both retain the +authored TD's stable `wotid`. + +```json +{ + "specversion": "1.0", + "id": "sample-4711", + "source": "urn:example:plant:publisher", + "type": "com.example.models.wot.%2Ftm%2Fpump.affordance.properties.processData", + "subject": "/properties/processData", + "datacontenttype": "application/json", + "dataschema": "https://example.com/schemas/pump-process-data/versions/3", + "wotid": "urn:example:pump:7", + "wotversion": "3", + "data": { + "Speed": 1500, + "Pressure": 4.5 + } +} +``` + +For an authored TD selected by `wotid`, the Consumer resolves revision `3` +through its configured resolver. The subject selects that TD's `processData` +property. + +The resolved-view form adds a document-view URI: + +```json +{ + "specversion": "1.0", + "id": "sample-4712", + "source": "urn:example:plant:publisher", + "type": "com.example.models.wot.%2Ftm%2Fpump.affordance.properties.processData", + "subject": "/properties/processData", + "datacontenttype": "application/json", + "dataschema": "https://example.com/schemas/pump-process-data/versions/3", + "wotid": "urn:example:pump:7", + "wottd": "https://registry.example/tds/pump-7/resolved/3", + "wotversion": "3", + "data": { + "Speed": 1500, + "Pressure": 4.5 + } +} +``` + +In either form, the separate schema describes the JSON object containing +`Speed` and `Pressure`; it does not describe the TD document. Another pump +with the same model and model-affordance mapping can use the same type with a +different `wotid`. + +## Security Considerations + +Resolvers MUST apply their configured trust, authorization and retrieval +policies before accessing documents. An untrusted identity or schema URI +MUST NOT authorize arbitrary network access, redirects or credential +forwarding. Implementations SHOULD bound document sizes and dependency +resolution. + +The Producer controls these attributes unless another mechanism authenticates +them. A matching digest does not establish that a TD, its model lineage or a +schema is authorized for the Consumer's use. Exact revisions and digests do +not grant access to referenced documents or make their dependencies available. + +[TD]: https://www.w3.org/TR/wot-thing-description11/ +[TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model +[JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 +[WoT Registry]: https://github.com/xregistry/spec/blob/main/workingdrafts/models/wot/spec.md From 1418500faef5c576cbb8ff4a82dc3a0940704f29 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 29 Oct 2026 07:31:18 +0100 Subject: [PATCH 02/60] Align WoT extension identity with xRegistry Signed-off-by: Marc --- cloudevents/extensions/wot.md | 76 +++++++++++++---------------------- 1 file changed, 27 insertions(+), 49 deletions(-) diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 7c7e1308d..282ea6c24 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -46,26 +46,6 @@ The deployment or publication profile defines the resolver and its lookup scope. The identity can name either an authored TD or a resolved TD for the same Thing; it does not select between those representations. -### wottd - -- Type: `URI` -- Description: The location of the TD document view to use. It can identify - either the authored TD or a resolved TD. -- Constraints: - - OPTIONAL - - If present, MUST be a non-empty absolute URI. - - MUST identify the TD document, not registry metadata about the TD. - - The resolved document MUST have the `wotid` identity. - - If `wotversion` is also present, the selected document MUST be that exact - revision. - -`wottd` selects a representation; `wotid` identifies the Thing. A Producer -MAY set `wottd` to distinguish an authored TD from a resolved TD when both -are available under the same identity and revision. If it is absent, the -configured resolver selects the representation. A resolution scope that -matches more than one representation MUST be narrowed by the publication -profile or by `wottd`; a Consumer MUST NOT choose one arbitrarily. - ### wotversion - Type: `String` @@ -78,10 +58,8 @@ profile or by `wottd`; a Consumer MUST NOT choose one arbitrarily. - If present, MUST be non-empty and MUST identify exactly one revision. - MUST NOT be interpreted as a minimum acceptable version or a version range. - MUST NOT be inferred from, or appended to, `wotid`. - - If absent, the Consumer MUST use the revision identified by `wottd`, when - present, or the default revision selected by the configured resolver. - - If `wottd` is present and the locator identifies a revision, that revision - MUST match `wotversion`. + - If absent, the Consumer MUST use the default revision selected by the + configured resolver for the selected representation. A publication profile MAY require `wotversion`. An exact revision is RECOMMENDED when later interpretation of a stored event depends on the same @@ -113,11 +91,11 @@ payload, a registry metadata response or the documents referenced by the TD. It does not require JSON-LD expansion or JSON canonicalization. Whitespace changes can change the digest. -When both `wotversion` and `wottd` are absent, `wotdigest` verifies the default -revision and representation selected by the resolver; it does not define a -search for some historical revision or representation having that digest. A -missing digest provides no byte-verification result. A matching digest is not -a signature and does not authenticate the Producer. +When `wotversion` is absent, `wotdigest` verifies the default revision and +representation selected by the resolver; it does not define a search for some +historical revision or representation having that digest. A missing digest +provides no byte-verification result. A matching digest is not a signature +and does not authenticate the Producer. ## Resolving the Thing Description @@ -127,16 +105,17 @@ or Group selection needed to distinguish copies of the same WoT identity and, where necessary, the authored and resolved representations. This extension does not prescribe a discovery protocol. -A Consumer using this extension to interpret `data` MUST resolve the selected -representation and revision without substituting a document with another -identity. It MUST retrieve the document view identified by `wottd` when that -attribute is present. Otherwise, it MUST use the configured resolver for -`wotid`, `wotversion` and the publication profile's representation selection. -An unavailable revision, ambiguous representation, mismatching TD `id`, -malformed digest or failed digest comparison MUST be treated as unresolved -description metadata. A Consumer MAY retain or forward the CloudEvent without -interpreting its payload; it MUST NOT report successful TD-based -interpretation using an unresolved reference. +A Consumer using this extension to interpret `data` MUST resolve the +representation and revision selected by the publication profile without +substituting a document with another identity. The profile MUST select the +authored or resolved representation when the configured scope can return +both. The Consumer MUST use the configured resolver for `wotid`, +`wotversion` and that representation selection. An unavailable revision, +ambiguous representation, mismatching TD `id`, malformed digest or failed +digest comparison MUST be treated as unresolved description metadata. A +Consumer MAY retain or forward the CloudEvent without interpreting its +payload; it MUST NOT report successful TD-based interpretation using an +unresolved reference. The [xRegistry WoT working draft][WoT Registry] describes one resolution mechanism. It is a working draft, not a universal dependency of this extension. @@ -148,10 +127,10 @@ In that draft: which is not necessarily the most recently created Version. - The Consumer retrieves the TD document view, not the registry metadata view. -The xRegistry WoT draft stores authored documents. A resolved TD can instead be -identified by `wottd` when a deployment publishes that representation as a -document view. A registry Resource URL MUST NOT be treated as the resolved TD -unless its document view actually returns that TD. +The xRegistry WoT draft stores authored documents. A deployment that makes a +resolved TD available MUST define how its resolver selects that representation +for the same `wotid`. A registry Resource URL MUST NOT be treated as the +resolved TD unless its document view actually returns that TD. The Consumer still needs a configured registry scope. A registry-wide identity query can return more than one Resource; choosing the first match does not @@ -270,10 +249,9 @@ conformance to the OPC UA extension. ## Example -The following CloudEvents describe the same pump and affordance. The first -references the authored TD through the configured resolver. The second uses -`wottd` to select a resolved representation explicitly. Both retain the -authored TD's stable `wotid`. +The following CloudEvents describe the same pump and affordance. Both use the +authored TD's stable `wotid`; their publication profiles select the authored +and resolved representations, respectively. ```json { @@ -297,7 +275,8 @@ For an authored TD selected by `wotid`, the Consumer resolves revision `3` through its configured resolver. The subject selects that TD's `processData` property. -The resolved-view form adds a document-view URI: +The resolved-view form uses the same event attributes. Its publication profile +selects the resolved TD representation for `wotid`: ```json { @@ -309,7 +288,6 @@ The resolved-view form adds a document-view URI: "datacontenttype": "application/json", "dataschema": "https://example.com/schemas/pump-process-data/versions/3", "wotid": "urn:example:pump:7", - "wottd": "https://registry.example/tds/pump-7/resolved/3", "wotversion": "3", "data": { "Speed": 1500, From 0f0c219bdf9757c42eb5a49fe8df46e59b880018 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 29 Oct 2026 12:37:26 +0100 Subject: [PATCH 03/60] fix(wot): address identity, digest and event scope feedback Signed-off-by: Marc --- cloudevents/extensions/wot.md | 114 +++++++++++++++++++++++++--------- 1 file changed, 85 insertions(+), 29 deletions(-) diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 282ea6c24..ac78707ea 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -25,14 +25,14 @@ attribute marked REQUIRED here is not REQUIRED in every CloudEvent. ### wotid -- Type: `URI` +- Type: `String` - Description: The stable WoT identity of the Thing described by the referenced TD. It is not the location of a registry entry or the schema of the CloudEvent's `data`. - Constraints: - REQUIRED - - MUST be a non-empty absolute URI. - - MUST equal the TD's `id` value when that member is present. + - MUST be a non-empty absolute IRI as defined in [RFC 3987][IRI]. + - MUST equal the TD's `id` value verbatim when that member is present. - A resolved TD MUST retain the authored TD's `id` when it is present. - When the authored TD has no `id`, the Producer MUST use the stable WoT identity assigned to it by its publication contract. A resolved TD for @@ -40,7 +40,12 @@ attribute marked REQUIRED here is not REQUIRED in every CloudEvent. - MUST NOT change merely because another revision of the same TD is published. -A URI used as an identity is not necessarily a document retrieval URL. A +The CloudEvents `URI` type uses RFC 3986 and does not include IRIs containing +non-ASCII characters. This attribute uses `String` to preserve those identifiers +without percent-encoding or otherwise rewriting the TD's `id`. Absolute URIs +are also valid absolute IRIs. + +An IRI used as an identity is not necessarily a document retrieval URL. A Consumer MUST NOT assume that an arbitrary `wotid` can be fetched directly. The deployment or publication profile defines the resolver and its lookup scope. The identity can name either an authored TD or a resolved TD for the @@ -68,14 +73,14 @@ resolver's default changes; it does not pin the description that existed when the event was produced. Version identifiers are opaque outside their governing publication contract. -A Consumer MUST NOT select the default by sorting identifiers or substitute -a different revision when the requested revision is unavailable. +A Consumer MUST NOT substitute a different revision when the requested +revision is unavailable. ### wotdigest - Type: `String` - Description: A digest of the selected authored or resolved TD document's - exact bytes, independent of its identity and retrieval location. + exact bytes. - Constraints: - OPTIONAL - If present, MUST have the form `sha-256:` followed by exactly 64 lowercase @@ -83,19 +88,21 @@ a different revision when the requested revision is unavailable. - The hexadecimal value MUST be the SHA-256 digest of the TD document bytes obtained after removing transport framing and content coding, but before parsing or reserializing the document. - - When a Consumer uses the referenced TD to interpret the event, it MUST + - When a Consumer uses the referenced TD to interpret the event, it SHOULD verify a supplied digest before using that TD. -The digest covers the selected TD representation, not the CloudEvent, its -payload, a registry metadata response or the documents referenced by the TD. -It does not require JSON-LD expansion or JSON canonicalization. Whitespace -changes can change the digest. +The digest covers the entire selected TD representation, including its `id` +member when present. No document members are excluded. It does not cover the +CloudEvent, its payload, a registry metadata response or the documents referenced +by the TD. It does not require JSON-LD expansion or JSON canonicalization. +Whitespace changes can change the digest. When `wotversion` is absent, `wotdigest` verifies the default revision and representation selected by the resolver; it does not define a search for some -historical revision or representation having that digest. A missing digest -provides no byte-verification result. A matching digest is not a signature -and does not authenticate the Producer. +historical revision or representation having that digest. A missing or unchecked +digest provides no byte-verification result. A Consumer that skips verification +MUST NOT report that the TD's bytes have been verified against `wotdigest`. +A matching digest is not a signature and does not authenticate the Producer. ## Resolving the Thing Description @@ -124,7 +131,8 @@ In that draft: - `wotid` is the authored WoT identity, distinct from a registry Resource id. - `wotversion`, when present, corresponds to the Resource's exact `versionid`. - An unversioned Resource reference serves its configured default Version, - which is not necessarily the most recently created Version. + which is not necessarily the most recently created Version. A Consumer + MUST NOT infer that default by sorting `versionid` values. - The Consumer retrieves the TD document view, not the registry metadata view. The xRegistry WoT draft stores authored documents. A deployment that makes a @@ -145,11 +153,13 @@ The Core [`type`](../spec.md#type) describes the semantic event type. A Thing's identity in `wotid` is not its event type: two Things can produce events described by the same model. -For TM-derived publications, the Producer MUST select a governing TM and the +For TM-derived publications, the Producer MUST select a governing TM. For a +publication describing one affordance, the Producer MUST also select the corresponding model-affordance path. When composition or derivation does not -identify one such mapping unambiguously, the publication configuration MUST -select it explicitly. A Producer MUST NOT infer that correspondence solely -from matching names or select the first TM link arbitrarily. +identify the governing TM or affordance mapping unambiguously, the publication +configuration MUST select it explicitly. A Producer MUST NOT infer that +correspondence solely from matching names or select the first TM link +arbitrarily. The following naming convention constructs a reverse-DNS-prefixed type base from an HTTPS TM identifier: @@ -162,17 +172,25 @@ from an HTTPS TM identifier: 3. Encode the identifier's exact suffix after the hostname, including any explicit port, path, query and fragment, as one token using the encoding below. -4. Append `.wot.` and that token to the reversed hostname. +4. Append `.` and that token to the reversed hostname. + +The type does not include a separate WoT marker; the presence of `wotid` +identifies use of this extension. For other TM identifier schemes, or HTTPS identifiers not meeting these conditions, the publication configuration MUST supply an explicit reverse-DNS-prefixed base. That configuration MUST assign distinct bases to distinct governing TMs in its type namespace. -Append `.affordance.` and the encoded model-affordance path tokens to the -base. The model path is an [RFC 6901][JSON Pointer] JSON Pointer within the -TM that identifies an interaction affordance. Decode its JSON Pointer -escaping before encoding each token, and join the resulting tokens with `.`. +For a publication describing one affordance, append `.affordance.` and the +encoded model-affordance path tokens to the base. The model path is an +[RFC 6901][JSON Pointer] JSON Pointer within the TM that identifies an +interaction affordance. Decode its JSON Pointer escaping before encoding +each token, and join the resulting tokens with `.`. + +For a publication describing the Thing as a whole, the Producer MUST use the +base without an affordance suffix. The publication profile defines how the +Thing's interaction data is aggregated into the payload. For both uses of token encoding, encode the input's UTF-8 bytes. Leave only ASCII letters, digits, `-` and `_` unescaped. Encode every other byte as `%` @@ -185,7 +203,7 @@ For example, TM `https://models.example.com/tm/pump` and model affordance `/properties/processData` produce: ```text -com.example.models.wot.%2Ftm%2Fpump.affordance.properties.processData +com.example.models.%2Ftm%2Fpump.affordance.properties.processData ``` Changing the encoded TM suffix, governing base or model-affordance path @@ -206,6 +224,9 @@ Pointer to the concrete interaction affordance within the referenced TD, such as `/properties/processData` or `/events/alarm`. It is not a URI fragment and MUST NOT be prefixed with `#`. +For a publication describing the Thing as a whole, the Producer MUST omit +`subject` rather than use an empty pointer or an arbitrary affordance. + The subject identifies an affordance, not an occurrence. Different events from that affordance can have the same subject and different CloudEvents `id` values. A binding-specific writer identifier or native occurrence @@ -247,7 +268,9 @@ affordance subject interact with that extension's existing type and subject mappings. Merely adding `wotid` does not permit overriding them or establish conformance to the OPC UA extension. -## Example +## Examples + +### Single Affordance The following CloudEvents describe the same pump and affordance. Both use the authored TD's stable `wotid`; their publication profiles select the authored @@ -258,7 +281,7 @@ and resolved representations, respectively. "specversion": "1.0", "id": "sample-4711", "source": "urn:example:plant:publisher", - "type": "com.example.models.wot.%2Ftm%2Fpump.affordance.properties.processData", + "type": "com.example.models.%2Ftm%2Fpump.affordance.properties.processData", "subject": "/properties/processData", "datacontenttype": "application/json", "dataschema": "https://example.com/schemas/pump-process-data/versions/3", @@ -283,7 +306,7 @@ selects the resolved TD representation for `wotid`: "specversion": "1.0", "id": "sample-4712", "source": "urn:example:plant:publisher", - "type": "com.example.models.wot.%2Ftm%2Fpump.affordance.properties.processData", + "type": "com.example.models.%2Ftm%2Fpump.affordance.properties.processData", "subject": "/properties/processData", "datacontenttype": "application/json", "dataschema": "https://example.com/schemas/pump-process-data/versions/3", @@ -301,6 +324,38 @@ In either form, the separate schema describes the JSON object containing with the same model and model-affordance mapping can use the same type with a different `wotid`. +### Whole Thing + +This CloudEvent carries aggregated data for the pump described by the same TD. +The publication profile selects the authored TD and defines a payload containing +the `processData` and `running` property values. The type uses the governing TM's +base without an affordance suffix, and `subject` is absent because the event is +not scoped to one affordance. + +```json +{ + "specversion": "1.0", + "id": "sample-4713", + "source": "urn:example:plant:publisher", + "type": "com.example.models.%2Ftm%2Fpump", + "datacontenttype": "application/json", + "dataschema": "https://example.com/schemas/pump-state/versions/3", + "wotid": "urn:example:pump:7", + "wotversion": "3", + "data": { + "processData": { + "Speed": 1500, + "Pressure": 4.5 + }, + "running": true + } +} +``` + +`wotid` and `wotversion` select the TD used to interpret these property values. +The TD document itself is not the payload. `dataschema` identifies the schema +of the aggregate JSON object, not the TD or either property's DataSchema alone. + ## Security Considerations Resolvers MUST apply their configured trust, authorization and retrieval @@ -316,5 +371,6 @@ not grant access to referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model +[IRI]: https://www.rfc-editor.org/rfc/rfc3987 [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 [WoT Registry]: https://github.com/xregistry/spec/blob/main/workingdrafts/models/wot/spec.md From 83539d54633eefaa40cb1378237305dc23efb6ed Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 29 Oct 2026 12:41:42 +0100 Subject: [PATCH 04/60] docs(wot): clarify payload member and affordance naming Signed-off-by: Marc --- cloudevents/extensions/wot.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index ac78707ea..7b8228705 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -296,7 +296,9 @@ and resolved representations, respectively. For an authored TD selected by `wotid`, the Consumer resolves revision `3` through its configured resolver. The subject selects that TD's `processData` -property. +property. In the JSON event format, `data` is the CloudEvent's payload member; +it is not named after the affordance. Here, `data` directly contains that +property's object value without a `processData` wrapper. The resolved-view form uses the same event attributes. Its publication profile selects the resolved TD representation for `wotid`: From e6856c24dc8323ffcfcc191ef6b279231ad0dc1b Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 29 Oct 2026 12:48:34 +0100 Subject: [PATCH 05/60] ci: skip flaky RFC Editor link checks Signed-off-by: Marc --- tools/test_verify.py | 18 ++++++++++++++++++ tools/verify.py | 3 +++ 2 files changed, 21 insertions(+) diff --git a/tools/test_verify.py b/tools/test_verify.py index 3698e277b..061dc8280 100644 --- a/tools/test_verify.py +++ b/tools/test_verify.py @@ -14,6 +14,7 @@ _is_text_all_uppercase, _plain_text_issues, _render_markdown_to_html, + _uri_availability_issues, ) @@ -187,6 +188,23 @@ def test_rtl_unicode_must_be_rendered_in_the_id(): ) +@pytest.mark.asyncio +@pytest.mark.parametrize( + "uri", + ( + "https://rfc-editor.org/rfc/rfc3987", + "https://www.rfc-editor.org/info/rfc2119", + ), +) +async def test_rfc_editor_links_skip_network_check(monkeypatch, uri): + monkeypatch.setattr( + "verify.ClientSession", + lambda: pytest.fail("RFC Editor links must not be fetched"), + ) + + assert await _uri_availability_issues(uri, Settings(excluded_paths=set())) == [] + + @pytest.mark.asyncio async def test_app(monkeypatch): monkeypatch.chdir(str(Path(__file__).parent)) diff --git a/tools/verify.py b/tools/verify.py index f7f93f155..c25a7c968 100644 --- a/tools/verify.py +++ b/tools/verify.py @@ -8,6 +8,7 @@ from http import HTTPStatus from pathlib import Path from typing import Iterable, List, NewType, Optional, Sequence, Set, Tuple, TypeVar +from urllib.parse import urlsplit from aiohttp import ClientSession from bs4 import BeautifulSoup @@ -136,6 +137,8 @@ async def _uri_availability_issues(uri: HttpUri, settings: Settings) -> Sequence if "example.com" in uri: return [] if "ietf.org" in uri: return [] if "rfc-edit.org" in uri: return [] + if urlsplit(uri).hostname in {"rfc-editor.org", "www.rfc-editor.org"}: + return [] if "iso20022.org" in uri: return [] try: From 2cc6898cc8d17bd9cf268fa9f724d781b273cf31 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 29 Oct 2026 12:53:45 +0100 Subject: [PATCH 06/60] docs(opcua): clarify WoT writer and sequence mappings Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 48 ++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 918584878..4f4df1244 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -49,8 +49,11 @@ messages: mapping to the native `MessageType`. - `opcuamessagetype` MUST carry the native `MessageType`. - `subject` MUST follow the WoT extension's affordance-pointer rules. -- `opcuadatasetwriterid` MUST carry the native `DataSetWriterId`; it MUST NOT - be appended to `subject`. +- `opcuadatasetwriterid` and `opcuadatasetwritername`, when present, MUST + identify the native DataSetWriter; neither MAY be appended to `subject`. +- For data and event messages, at least one of `opcuadatasetwriterid` and + `opcuadatasetwritername` MUST be present. If both are present, they MUST + identify the same DataSetWriter. - For an event message, the `EventId` remains in the OPC UA event payload and MUST NOT be appended to `subject`. - `opcuapublisherid` MUST identify the native PublisherId. @@ -107,11 +110,21 @@ extensions are used, determine message type from `opcuamessagetype`. ### sequence -Attribute as defined by [sequence extensions](./sequence.md) MUST map to [Data -Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) -field `SequenceNumber`, except when the WoT extension is also used. In that -case, `opcuasequence` maps to the native field and `sequence` has the -independent meaning defined by the Sequence extension. +Without the WoT extension, a `sequence` attribute, when present, MUST map to +the native DataSetMessage `SequenceNumber`. The OPC UA Publisher assigns and +increments this counter for messages from a DataSetWriter, as defined in +[OPC UA Part 14, Section 7.2.3][UA SequenceNumber]. This is the existing +OPC UA mapping for the [Sequence extension](./sequence.md), but it does not by +itself establish an ordering across multiple DataSetWriters that share one +CloudEvents `source`. A Publisher using this mapping MUST scope `source` to the +DataSetWriter's ordering scope; otherwise, it MUST NOT present the per-writer +counter as the CloudEvents `sequence`. + +When the WoT extension is also used, `subject` identifies a TD affordance, not +the DataSetWriter. `opcuasequence` therefore carries the native OPC UA counter; +a CloudEvents `sequence`, if present, MUST satisfy the Sequence extension's +ordering requirements independently and MUST NOT be inferred from +`opcuasequence`. ### traceparent @@ -182,10 +195,24 @@ field `MetaDataVersion`. - Constraints - OPTIONAL - If present, MUST be in the range 0 to 65535, inclusive. - - In combination with the WoT extension, REQUIRED for data and event - messages. - MUST map to the Data Set Message Header `DataSetWriterId`. +### opcuadatasetwritername + +- Type: `String` +- Description: Carries the human-readable name of the DataSetWriter that + produced the DataSetMessage. +- Constraints + - OPTIONAL + - If present, MUST be non-empty. + - MUST match the DataSetWriter's configured `DataSetWriterName`. For JSON + message mapping, this is the [`DataSetWriterName` field][UA DataSetWriterName] + when present in the DataSetMessage; otherwise the publisher obtains it + from configuration. + - In combination with the WoT extension, if used without + `opcuadatasetwriterid`, it MUST uniquely identify the DataSetWriter within + the configured `opcuapublisherid` scope. + ### opcuamessagetype - Type: `String` @@ -419,3 +446,6 @@ recordedtime: 2024-03-28T23:59:59Z ----------------------------------------------- ``` + +[UA DataSetWriterName]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table185 +[UA SequenceNumber]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.3 From a06d52327cce755c71e02e07bc086aa0be9091e8 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 29 Oct 2026 12:55:46 +0100 Subject: [PATCH 07/60] docs(opcua): add combined WoT telemetry example Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 4f4df1244..6a1f3b909 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -447,5 +447,37 @@ recordedtime: 2024-03-28T23:59:59Z ----------------------------------------------- ``` +### WoT and OPC UA telemetry message + +This keyframe uses the WoT event type and affordance subject while retaining +the native OPC UA message type, writer identity and sequence number. The +human-readable DataSetWriter name is used without a numeric writer ID. The +example assumes that `PumpProcessData` uniquely identifies a writer within +publisher `UInt16:12`. The CloudEvents `sequence` attribute is absent because +this example does not define a source-wide ordering across DataSetWriters. + +```json +{ + "specversion": "1.0", + "id": "ua-message-25460", + "source": "urn:example:plant:publisher", + "type": "com.example.models.%2Ftm%2Fpump.affordance.properties.processData", + "subject": "/properties/processData", + "time": "2026-10-29T12:00:00Z", + "datacontenttype": "application/json", + "dataschema": "https://example.com/schemas/pump-process-data/versions/3", + "wotid": "urn:example:pump:7", + "wotversion": "3", + "opcuapublisherid": "UInt16:12", + "opcuadatasetwritername": "PumpProcessData", + "opcuamessagetype": "ua-keyframe", + "opcuasequence": 25460, + "data": { + "Speed": 1500, + "Pressure": 4.5 + } +} +``` + [UA DataSetWriterName]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table185 [UA SequenceNumber]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.3 From fb77f3a88ffc00970eea61831a3fde062e1c8158 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 31 Oct 2026 05:30:24 +0100 Subject: [PATCH 08/60] docs(wot): align CloudEvents Thing source mapping Signed-off-by: Marc --- cloudevents/extensions/README.md | 2 +- cloudevents/extensions/opcua.md | 122 ++++---- cloudevents/extensions/wot.md | 471 ++++++++++++++----------------- tools/test_wot_examples.py | 85 ++++++ 4 files changed, 372 insertions(+), 308 deletions(-) create mode 100644 tools/test_wot_examples.py diff --git a/cloudevents/extensions/README.md b/cloudevents/extensions/README.md index 8982d3699..88968c440 100644 --- a/cloudevents/extensions/README.md +++ b/cloudevents/extensions/README.md @@ -53,4 +53,4 @@ for more information. - [Sampling](sampledrate.md) - [Sequence](sequence.md) - [Severity](severity.md) -- [Web of Things](wot.md) +- [Web of Things](wot.md) (Core attribute mapping profile) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 6a1f3b909..b630f8073 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -1,10 +1,9 @@ # OPC UA -This extension defines the mapping of [OPC UA](https://reference.opcfoundation.org/Core/Part1/v105/docs/) -[PubSub](https://reference.opcfoundation.org/Core/Part14/v105/docs/) dataset to -CloudEvents to allow seamless routing of OPC UA dataset messages via different -protocols, it therefore provides a recommendation to map known REQUIRED and -OPTIONAL attributes using other extensions as well as defines its own extension +This extension maps [OPC UA](https://reference.opcfoundation.org/Core/Part1/v105/docs/) +[PubSub](https://reference.opcfoundation.org/Core/Part14/v105/docs/) +DataSetMessages to CloudEvents for routing over supported protocols. It defines +mappings for Core and other extension attributes and specifies OPC UA extension attributes. ## Notational Conventions @@ -29,26 +28,31 @@ field `MessageId`. ### source -MUST either map to [Application -Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) field -`applicationUri` of the OPC UA server or to a customer configured identifier -like a unified namespace path. +Without the WoT profile, MUST either map to [Application +Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) +field `applicationUri` of the OPC UA server or to a customer configured +identifier like a unified namespace path. + +With the WoT profile, MUST follow its `source` mapping. ### type -MUST map to [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) -field `MessageType`. +Without the WoT profile, MUST map to +[Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) +field `MessageType`. With the WoT profile, MUST follow its semantic event-type +rules. ### WoT mapping When a CloudEvent uses both this extension and the -[WoT extension](./wot.md), the following mappings apply to data and event +[WoT profile](./wot.md), the following mappings apply to data and event messages: -- `type` MUST follow the WoT extension's semantic event-type rules instead of +- `source` MUST follow the WoT profile's Thing identity and version rules. +- `type` MUST follow the WoT profile's semantic event-type rules instead of mapping to the native `MessageType`. - `opcuamessagetype` MUST carry the native `MessageType`. -- `subject` MUST follow the WoT extension's affordance-pointer rules. +- `subject` MUST follow the WoT profile's resolved-TD pointer rules. - `opcuadatasetwriterid` and `opcuadatasetwritername`, when present, MUST identify the native DataSetWriter; neither MAY be appended to `subject`. - For data and event messages, at least one of `opcuadatasetwriterid` and @@ -65,7 +69,10 @@ messages: These conditional mappings replace only the conflicting OPC UA mappings above. All other requirements in this extension remain applicable. A profile that uses only part of this extension MUST NOT claim conformance to it unless the -profile satisfies every applicable requirement in this document. +profile satisfies every applicable requirement in this document. Producers +sharing a WoT `source` MUST assign distinct native `MessageId` values to +distinct events within that source to satisfy Core's `source` and `id` +uniqueness requirement. ## Mapping of OPTIONAL Attributes @@ -85,7 +92,7 @@ those cases the attribute references the schema and is used for versioning. ### subject -When the WoT extension is not used, the following OPC UA mappings apply: +When the WoT profile is not used, the following OPC UA mappings apply: For metadata, event and data messages (type one of `ua-metadata`, `ua-keyframe`, `ua-deltaframe`, `ua-event`), `subject` MUST map to either [Data Set Message @@ -105,12 +112,12 @@ field `Timestamp`. ## Mapping for other extensions For data and event messages, the following well-known extension attributes -apply when this extension is used without the WoT extension. When both +apply when this extension is used without the WoT profile. When both extensions are used, determine message type from `opcuamessagetype`. ### sequence -Without the WoT extension, a `sequence` attribute, when present, MUST map to +Without the WoT profile, a `sequence` attribute, when present, MUST map to the native DataSetMessage `SequenceNumber`. The OPC UA Publisher assigns and increments this counter for messages from a DataSetWriter, as defined in [OPC UA Part 14, Section 7.2.3][UA SequenceNumber]. This is the existing @@ -120,7 +127,7 @@ CloudEvents `source`. A Publisher using this mapping MUST scope `source` to the DataSetWriter's ordering scope; otherwise, it MUST NOT present the per-writer counter as the CloudEvents `sequence`. -When the WoT extension is also used, `subject` identifies a TD affordance, not +When the WoT profile is also used, `subject` identifies a TD or affordance, not the DataSetWriter. `opcuasequence` therefore carries the native OPC UA counter; a CloudEvents `sequence`, if present, MUST satisfy the Sequence extension's ordering requirements independently and MUST NOT be inferred from @@ -171,6 +178,10 @@ field `MetaDataVersion`. - REQUIRED if status is not _Good_ - MAY be omitted if status is _Good_ +CloudEvents `Integer` is limited to the signed 32-bit range. If a native +status value cannot be represented, the Producer MUST report an error rather +than omit the status, wrap the value, or report it as _Good_. + ### opcuapublisherid - Type: `String` @@ -184,7 +195,7 @@ field `MetaDataVersion`. of the PublisherId. - For `String`, `` MUST be the unpadded base64url encoding of the PublisherId's UTF-8 bytes. - - In combination with the WoT extension, REQUIRED for data and event + - In combination with the WoT profile, REQUIRED for data and event messages. - MUST map to the Network Message Header `PublisherId`. @@ -209,9 +220,10 @@ field `MetaDataVersion`. message mapping, this is the [`DataSetWriterName` field][UA DataSetWriterName] when present in the DataSetMessage; otherwise the publisher obtains it from configuration. - - In combination with the WoT extension, if used without - `opcuadatasetwriterid`, it MUST uniquely identify the DataSetWriter within - the configured `opcuapublisherid` scope. + - In combination with the WoT profile, MUST uniquely identify the + DataSetWriter within the configured `opcuapublisherid` scope. + - In combination with the WoT profile, names MUST be compared exactly, + without case folding or Unicode normalization. ### opcuamessagetype @@ -220,7 +232,7 @@ field `MetaDataVersion`. identifies a WoT semantic event type. - Constraints - OPTIONAL - - In combination with the WoT extension, REQUIRED for data and event + - In combination with the WoT profile, REQUIRED for data and event messages. - MUST map to the Data Set Message Header `MessageType`. - The value MUST be the native OPC UA message type, such as `ua-keyframe`, @@ -228,15 +240,18 @@ field `MetaDataVersion`. ### opcuasequence -- Type: `Integer` +- Type: `String` - Description: Carries the native DataSetMessage sequence counter without assigning CloudEvents Sequence extension ordering semantics to it. - Constraints - OPTIONAL - - If present, MUST be in the range 0 to 65535, inclusive. - - In combination with the WoT extension, REQUIRED for keyframe, deltaframe + - If present, MUST be a canonical unsigned decimal representation in the + range `0` to `4294967295`, inclusive, with no leading zero except for `0`. + - In combination with the WoT profile, REQUIRED for keyframe, deltaframe and event messages. - - MUST map to the Data Set Message Header `SequenceNumber`. + - MUST map to the Data Set Message Header `SequenceNumber`. The + [OPC UA JSON mapping][UA DataSetWriterName] defines this field as `UInt32`; + the String representation retains the full range of that value. - MUST NOT be interpreted as a source-wide sequence unless it also independently satisfies the Sequence extension's requirements. @@ -449,34 +464,41 @@ recordedtime: 2024-03-28T23:59:59Z ### WoT and OPC UA telemetry message -This keyframe uses the WoT event type and affordance subject while retaining -the native OPC UA message type, writer identity and sequence number. The -human-readable DataSetWriter name is used without a numeric writer ID. The +This binary-mode keyframe uses the WoT event type and affordance subject while +retaining the native OPC UA message type, writer identity, and sequence +number. The DataSetWriter name is used without a numeric writer ID. The example assumes that `PumpProcessData` uniquely identifies a writer within publisher `UInt16:12`. The CloudEvents `sequence` attribute is absent because this example does not define a source-wide ordering across DataSetWriters. -```json +```text +------------------ PUBLISH ------------------- + +Topic Name: opcua/json/DataSetMessage/pump +Content Type: application/json + +------------- User Properties ---------------- + +specversion: 1.0 +id: ua-message-25460 +source: wot-td://factory/line1?wotid=urn:example:pump:7;wotversion=3.0.0 +type: com.example.models.tm.pump.properties.processData +subject: #/properties/processData +time: 2026-10-29T12:00:00Z +dataschema: https://example.com/schemas/pump-process-data/versions/3 +opcuapublisherid: UInt16:12 +opcuadatasetwritername: PumpProcessData +opcuamessagetype: ua-keyframe +opcuasequence: 4294967295 + +------------------ payload ------------------- + { - "specversion": "1.0", - "id": "ua-message-25460", - "source": "urn:example:plant:publisher", - "type": "com.example.models.%2Ftm%2Fpump.affordance.properties.processData", - "subject": "/properties/processData", - "time": "2026-10-29T12:00:00Z", - "datacontenttype": "application/json", - "dataschema": "https://example.com/schemas/pump-process-data/versions/3", - "wotid": "urn:example:pump:7", - "wotversion": "3", - "opcuapublisherid": "UInt16:12", - "opcuadatasetwritername": "PumpProcessData", - "opcuamessagetype": "ua-keyframe", - "opcuasequence": 25460, - "data": { - "Speed": 1500, - "Pressure": 4.5 - } + "Speed": 1500, + "Pressure": 4.5 } + +----------------------------------------------- ``` [UA DataSetWriterName]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table185 diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 7b8228705..714caa955 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -1,15 +1,13 @@ # Web of Things -This extension identifies the [Web of Things Thing Description][TD] (TD) that -describes the interaction associated with a CloudEvent. It separates the -Thing's identity, the selected TD representation, its revision and -verification of its bytes. The selected representation can be the authored TD -or a resolved TD derived from it. +This profile maps a [Web of Things Thing Description][TD] (TD) to CloudEvents +Core context attributes. The `source` identifies the Thing and, when provided, +a version of its resolved TD. The `subject` identifies the part of that TD +associated with the event, and the `type` names the event contract. -The extension also defines a convention for event types derived from a -[Thing Model][TM] (TM), affordance subjects and the relationship between a TD -and the payload schema. It does not define a transport binding, provision a -Thing, or require a particular registry implementation. +The profile defines no CloudEvents extension attributes. Its use is identified +by the `wot-td` scheme in `source`. It does not define a transport binding, +provision a Thing, or require a particular registry implementation. ## Notational Conventions @@ -18,222 +16,214 @@ As with the main [CloudEvents specification](../spec.md), the key words "MUST", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119). -The scope of these key words is limited to events using this extension. An +The scope of these key words is limited to events using this profile. An attribute marked REQUIRED here is not REQUIRED in every CloudEvent. -## Attributes - -### wotid - -- Type: `String` -- Description: The stable WoT identity of the Thing described by the - referenced TD. It is not the location of a registry entry or the schema of - the CloudEvent's `data`. -- Constraints: - - REQUIRED - - MUST be a non-empty absolute IRI as defined in [RFC 3987][IRI]. - - MUST equal the TD's `id` value verbatim when that member is present. - - A resolved TD MUST retain the authored TD's `id` when it is present. - - When the authored TD has no `id`, the Producer MUST use the stable WoT - identity assigned to it by its publication contract. A resolved TD for - that Thing MUST use the same identity. - - MUST NOT change merely because another revision of the same TD is - published. - -The CloudEvents `URI` type uses RFC 3986 and does not include IRIs containing -non-ASCII characters. This attribute uses `String` to preserve those identifiers -without percent-encoding or otherwise rewriting the TD's `id`. Absolute URIs -are also valid absolute IRIs. - -An IRI used as an identity is not necessarily a document retrieval URL. A -Consumer MUST NOT assume that an arbitrary `wotid` can be fetched directly. -The deployment or publication profile defines the resolver and its lookup -scope. The identity can name either an authored TD or a resolved TD for the -same Thing; it does not select between those representations. - -### wotversion - -- Type: `String` -- Description: The exact revision of the TD identified by `wotid`, within the - configured resolution scope and selected representation. This is a document - revision, not the CloudEvents `specversion`, the version of a WoT vocabulary - or the version of the wire-payload schema. -- Constraints: - - OPTIONAL - - If present, MUST be non-empty and MUST identify exactly one revision. - - MUST NOT be interpreted as a minimum acceptable version or a version range. - - MUST NOT be inferred from, or appended to, `wotid`. - - If absent, the Consumer MUST use the default revision selected by the - configured resolver for the selected representation. - -A publication profile MAY require `wotversion`. An exact revision is -RECOMMENDED when later interpretation of a stored event depends on the same -description. An unversioned reference can resolve differently after the -resolver's default changes; it does not pin the description that existed -when the event was produced. - -Version identifiers are opaque outside their governing publication contract. -A Consumer MUST NOT substitute a different revision when the requested -revision is unavailable. - -### wotdigest - -- Type: `String` -- Description: A digest of the selected authored or resolved TD document's - exact bytes. -- Constraints: - - OPTIONAL - - If present, MUST have the form `sha-256:` followed by exactly 64 lowercase - hexadecimal characters. - - The hexadecimal value MUST be the SHA-256 digest of the TD document bytes - obtained after removing transport framing and content coding, but before - parsing or reserializing the document. - - When a Consumer uses the referenced TD to interpret the event, it SHOULD - verify a supplied digest before using that TD. - -The digest covers the entire selected TD representation, including its `id` -member when present. No document members are excluded. It does not cover the -CloudEvent, its payload, a registry metadata response or the documents referenced -by the TD. It does not require JSON-LD expansion or JSON canonicalization. -Whitespace changes can change the digest. - -When `wotversion` is absent, `wotdigest` verifies the default revision and -representation selected by the resolver; it does not define a search for some -historical revision or representation having that digest. A missing or unchecked -digest provides no byte-verification result. A Consumer that skips verification -MUST NOT report that the TD's bytes have been verified against `wotdigest`. -A matching digest is not a signature and does not authenticate the Producer. +## Source + +The Core [`source`](../spec.md#source) identifies a Thing within a configured +logical topology. It uses this absolute URI form: + +```text +wot-td://?wotid=[;wotversion=] +``` + +For example: + +```text +wot-td://factory/line1?wotid=urn:example:pump:7;wotversion=3.0.0 +``` + +`wotid` and `wotversion` are query parameters, not CloudEvents attributes. +The `wot-td` scheme is proposed and is not currently registered with IANA. +The URI is an identifier for a configured resolver; it is not an HTTP registry +URL and does not itself specify where to retrieve a TD. + +### Topology + +The Producer configures the topology. It consists of a non-empty authority +followed by an OPTIONAL hierarchical path. Both MUST conform to +[RFC 3986][URI]. The authority MUST contain a non-empty host and MUST NOT +contain user information. The host need not be a resolvable DNS name. +Implementations MUST apply RFC 3986 host case rules and MUST NOT change the +case of the path when interpreting the topology. + +The topology can represent, for example, a site and production line. It is +not the Thing's identity or a registry Resource identifier. + +### Query syntax and encoding + +The query contains `wotid` followed by an OPTIONAL `wotversion`. The literal +parameter names are case-sensitive, and `;` separates the parameters. Each +parameter consists of its name, one `=`, and a non-empty value. No other +parameters are defined. + +The value's unescaped characters are the RFC 3986 `unreserved` characters +and `!`, `$`, `'`, `(`, `)`, `*`, `,`, `:`, `@`, `/`, and `?`. A Producer +MUST leave these characters unescaped. It MUST percent-encode the UTF-8 bytes +of all other characters using uppercase hexadecimal digits. +In particular, a literal `%`, `;`, `=`, `&`, `+`, or `#` in a value MUST be +encoded. A Producer MUST NOT use form-query encoding or encode a space as `+`. + +A Consumer MUST split the query at `;` before decoding the values. It MUST +reject an unknown or duplicate parameter, a missing or empty `wotid`, an empty +`wotversion`, an invalid percent escape, invalid UTF-8, an out-of-order +parameter, an unescaped character outside the permitted set, or a URI with an +outer fragment. It MUST percent-decode each value exactly once and MUST NOT +interpret `+` as a space. + +For example, an identifier containing U+00E9 followed by the literal characters +`%2F` encodes that portion as `%C3%A9%252F`. One decoding pass recovers the +original characters, including the literal `%2F`; it does not turn them into +a slash. + +### Thing identity and version + +The decoded `wotid` MUST be a non-empty absolute IRI as defined in +[RFC 3987][IRI]. When the authored TD has an `id`, `wotid` MUST equal that +value verbatim and the resolved TD MUST retain it. When the authored TD has +no `id`, the publication contract MUST assign a stable absolute WoT identity +for the Thing. Publishing another version MUST NOT by itself change that +identity. + +The OPTIONAL `wotversion` selects one exact version of the resolved TD within +the configured resolution scope. It is not a version range, the CloudEvents +`specversion`, a WoT vocabulary version, or a payload-schema version. Its +meaning is defined by the publication contract; a Consumer MUST NOT substitute +a different version when the requested version is unavailable. Selecting that +version does not by itself establish the compatibility of its dependencies. + +An explicit version identifies a stable resolved view. A Producer MUST NOT +change the logical view identified by a published version. It MUST publish a +new version when the view changes, including changes introduced by its source +closure. A serialization or formatting change alone does not require a new +version. + +When `wotversion` is absent, the Consumer resolves the current default view. +That default can change, so a delayed event can resolve to a different view +than the one available when the event was produced. A publication profile +that requires repeatable replay MUST require `wotversion`. + +Core requires `source` and `id` together to identify each distinct event. +Changing the topology or version changes the `source` and therefore its event +identity and [Sequence extension](sequence.md) scope. Returning to an earlier +`source` returns to its existing scope: Producers MUST NOT reuse event +identities or restart a claimed source-wide sequence within that scope. ## Resolving the Thing Description -The Producer and Consumer MUST agree on the resolution scope out of band or -through their publication profile. That scope includes any registry, tenant -or Group selection needed to distinguish copies of the same WoT identity and, -where necessary, the authored and resolved representations. This extension -does not prescribe a discovery protocol. - -A Consumer using this extension to interpret `data` MUST resolve the -representation and revision selected by the publication profile without -substituting a document with another identity. The profile MUST select the -authored or resolved representation when the configured scope can return -both. The Consumer MUST use the configured resolver for `wotid`, -`wotversion` and that representation selection. An unavailable revision, -ambiguous representation, mismatching TD `id`, malformed digest or failed -digest comparison MUST be treated as unresolved description metadata. A -Consumer MAY retain or forward the CloudEvent without interpreting its -payload; it MUST NOT report successful TD-based interpretation using an -unresolved reference. +The Producer and Consumer MUST agree on a resolver and its scope out of band +or through their publication profile. The scope selects a registry and Group, +tenant, or equivalent boundary in which the Thing identity is resolved. This +profile does not prescribe a discovery protocol. + +The resolver MUST find exactly one Resource or equivalent publication for +`wotid` within that scope. It MUST select the exact version named by +`wotversion`, or the current default when the parameter is absent. A missing +or ambiguous match is a resolution failure; selecting the first match does not +establish which Thing the Producer meant. + +The Consumer MUST obtain the resolved TD selected by that publication. It MAY +retrieve a published resolved view or reconstruct the same logical view from +a complete, pinned source closure and the applicable resolution rules. The +closure and rules MUST establish one unambiguous view. The JSON serialization +does not need to be byte-identical. + +If the selected view cannot be retrieved or reconstructed, the Consumer MUST +report a resolution failure and leave the event uncorrelated. It MAY retain +or forward the event without interpreting its payload. The Consumer MUST NOT +claim successful TD-based interpretation when the resolved view or its +identity cannot be established. The [xRegistry WoT working draft][WoT Registry] describes one resolution -mechanism. It is a working draft, not a universal dependency of this extension. -In that draft: - -- `wotid` is the authored WoT identity, distinct from a registry Resource id. -- `wotversion`, when present, corresponds to the Resource's exact `versionid`. -- An unversioned Resource reference serves its configured default Version, - which is not necessarily the most recently created Version. A Consumer - MUST NOT infer that default by sorting `versionid` values. -- The Consumer retrieves the TD document view, not the registry metadata view. - -The xRegistry WoT draft stores authored documents. A deployment that makes a -resolved TD available MUST define how its resolver selects that representation -for the same `wotid`. A registry Resource URL MUST NOT be treated as the -resolved TD unless its document view actually returns that TD. - -The Consumer still needs a configured registry scope. A registry-wide identity -query can return more than one Resource; choosing the first match does not -establish which description the Producer meant. The same applies when a scope -can return both authored and resolved representations. +mechanism. It is a working draft, not a universal dependency of this profile. +In that draft, `wotid` is the WoT identity rather than the Resource ID, and +`wotversion` corresponds to the Resource's exact `versionid`. The default +Version is not necessarily the most recently created Version and MUST NOT be +inferred by sorting version identifiers. + +The draft stores authored documents and describes a publication closure. +Some closure reference mappings remain unresolved; the closure schema alone +does not establish that every resolved view can be reconstructed. Where the +closure and applicable rules cannot establish the view, the publication +contract MUST provide the resolved view for this profile to use it. + +The event carries no digest of the TD. An exact version or a successful +resolution does not by itself prove that retrieved bytes are unchanged. ## Mapping Core Context Attributes ### type -The Core [`type`](../spec.md#type) describes the semantic event type. A -Thing's identity in `wotid` is not its event type: two Things can produce -events described by the same model. +The Core [`type`](../spec.md#type) identifies the event contract. Two Things +can produce events of the same type when their interactions follow the same +model. This profile uses a dot-separated symbol so a Consumer can map the type +to a code-generation symbol. -For TM-derived publications, the Producer MUST select a governing TM. For a -publication describing one affordance, the Producer MUST also select the +The type MUST contain one or more segments separated by single dots. Each +segment MUST start with an ASCII letter or underscore and contain only ASCII +letters, digits, or underscores thereafter. These character restrictions apply +only to `type`; they do not change the Thing identifier, TD member names, +`source`, `subject`, or payload. A code generator remains responsible for +language-specific keywords. + +A Producer MAY configure the complete type. Otherwise, it derives the type +from a governing [Thing Model][TM] (TM) and, for an affordance event, the corresponding model-affordance path. When composition or derivation does not -identify the governing TM or affordance mapping unambiguously, the publication -configuration MUST select it explicitly. A Producer MUST NOT infer that -correspondence solely from matching names or select the first TM link -arbitrarily. - -The following naming convention constructs a reverse-DNS-prefixed type base -from an HTTPS TM identifier: - -1. Parse the absolute identifier without removing its path, query or fragment. - The authority MUST contain an ASCII DNS hostname with no empty labels or - trailing root dot, and MUST NOT contain user information. Other authorities, - including IP addresses, require an explicit base instead. -2. Lowercase the ASCII DNS hostname and reverse its labels. -3. Encode the identifier's exact suffix after the hostname, including any - explicit port, path, query and fragment, as one token using the encoding - below. -4. Append `.` and that token to the reversed hostname. - -The type does not include a separate WoT marker; the presence of `wotid` -identifies use of this extension. - -For other TM identifier schemes, or HTTPS identifiers not meeting these -conditions, the publication configuration MUST supply an explicit -reverse-DNS-prefixed base. That configuration MUST assign distinct bases to -distinct governing TMs in its type namespace. - -For a publication describing one affordance, append `.affordance.` and the -encoded model-affordance path tokens to the base. The model path is an -[RFC 6901][JSON Pointer] JSON Pointer within the TM that identifies an -interaction affordance. Decode its JSON Pointer escaping before encoding -each token, and join the resulting tokens with `.`. - -For a publication describing the Thing as a whole, the Producer MUST use the -base without an affordance suffix. The publication profile defines how the -Thing's interaction data is aggregated into the payload. - -For both uses of token encoding, encode the input's UTF-8 bytes. Leave only -ASCII letters, digits, `-` and `_` unescaped. Encode every other byte as `%` -followed by two uppercase hexadecimal digits. Represent an empty token as -`~`; a literal tilde is encoded as `%7E`. Dots and percent signs are escaped, -so a literal dot in a name cannot be confused with a path-token separator. -This encoding is part of the type String, not an instruction to dereference it. +identify that mapping unambiguously, the publication configuration MUST +select it explicitly. A Producer MUST NOT infer the mapping solely from +matching names or select the first TM link. + +For an eligible HTTPS TM identifier, derive the type as follows: + +1. Require an ASCII DNS hostname without empty labels or a trailing root dot. + The identifier cannot contain user information, a port, a query, or a + fragment for this derivation. +2. Lowercase the hostname, reverse its labels, and join them with dots. +3. Append the TM identifier's path, replacing each `/` with `.`. +4. For an affordance event, append the model-affordance JSON Pointer path. + Decode its [RFC 6901][JSON Pointer] token escaping, then replace each `/` + with `.`. For example, TM `https://models.example.com/tm/pump` and model affordance `/properties/processData` produce: ```text -com.example.models.%2Ftm%2Fpump.affordance.properties.processData +com.example.models.tm.pump.properties.processData ``` -Changing the encoded TM suffix, governing base or model-affordance path -changes this derived type; changing only the hostname's letter case does not. -The Producer MUST NOT change that derivation merely because a different TD -instance or registry location is used. Versioning the payload schema is -separate from naming a semantic event type. +For a whole-Thing event, use the TM-derived type without an affordance path. +The publication profile defines how interaction data is aggregated into the +payload. -A TD can be published without a governing TM. This extension does not invent -one: publications without a TM-derived type follow Core's producer-defined -type rules. A profile requiring TM-derived types MUST reject missing or -ambiguous model mappings rather than inventing a base. +The Producer MUST configure a valid complete type when the derivation is +unavailable, produces an invalid symbol, or collides with a different event +contract in the Producer's type namespace. A slash-to-dot conversion is not +reversible: `/tm/pump.v1` and `/tm/pump/v1` produce the same suffix. The +Producer MUST disambiguate such contracts by configuration rather than +silently rewriting identifiers or member names. ### subject -The [`subject`](../spec.md#subject), when present, MUST be an RFC 6901 JSON -Pointer to the concrete interaction affordance within the referenced TD, -such as `/properties/processData` or `/events/alarm`. It is not a URI -fragment and MUST NOT be prefixed with `#`. +The [`subject`](../spec.md#subject) is REQUIRED. It MUST be an +[RFC 6901][JSON Pointer] URI-fragment pointer evaluated against the resolved +TD. For an event describing the whole Thing, the Producer MUST use `#`. For +an affordance event, the pointer MUST identify the concrete affordance in the +resolved TD, for example `#/properties/processData` or `#/events/alarm`. -For a publication describing the Thing as a whole, the Producer MUST omit -`subject` rather than use an empty pointer or an arbitrary affordance. +The Producer MUST escape JSON Pointer tokens before applying URI-fragment +encoding. For example, the property name `pressure/bar` is addressed by +`#/properties/pressure~1bar`. The Consumer MUST report a failure and leave +the event uncorrelated if the pointer is invalid or does not select the +intended member of the resolved view. -The subject identifies an affordance, not an occurrence. Different events -from that affordance can have the same subject and different CloudEvents -`id` values. A binding-specific writer identifier or native occurrence -identifier is not appended to this pointer. +The subject identifies the Thing or affordance, not an occurrence. Different +events can have the same subject and different CloudEvents `id` values. A +binding-specific writer identifier or native occurrence identifier is not +appended to this pointer. -The concrete TD path and the corresponding TM declaration path can differ. -This extension does not infer a declaration-lineage mapping between them. +The concrete TD path and corresponding TM declaration path can differ. This +profile does not infer a declaration-lineage mapping between them. ### dataschema and datacontenttype @@ -257,63 +247,30 @@ any encoding or envelope selected by the binding. An xRegistry Schema Resource's document-view URL can identify that external schema. It is not the WoT Resource's metadata-view URL. A profile MAY require -an exact schema Version independently of `wotversion`. +an exact schema Version independently of the `wotversion` query parameter. ### Relationship to Other Extensions -This extension does not redefine native message types, sequence counters, -writer identities or source identities. A profile that also uses the -[OPC UA extension](opcua.md) MUST specify how its TM-derived type and -affordance subject interact with that extension's existing type and subject -mappings. Merely adding `wotid` does not permit overriding them or establish -conformance to the OPC UA extension. +This profile does not redefine native message types, sequence counters, or +writer identities. An event that also uses the [OPC UA extension](opcua.md) +MUST follow that extension's conditional WoT mapping. ## Examples ### Single Affordance -The following CloudEvents describe the same pump and affordance. Both use the -authored TD's stable `wotid`; their publication profiles select the authored -and resolved representations, respectively. +This CloudEvent identifies a pump and its `processData` property. The +configured resolver selects version `3.0.0` of the resolved TD. ```json { "specversion": "1.0", "id": "sample-4711", - "source": "urn:example:plant:publisher", - "type": "com.example.models.%2Ftm%2Fpump.affordance.properties.processData", - "subject": "/properties/processData", - "datacontenttype": "application/json", - "dataschema": "https://example.com/schemas/pump-process-data/versions/3", - "wotid": "urn:example:pump:7", - "wotversion": "3", - "data": { - "Speed": 1500, - "Pressure": 4.5 - } -} -``` - -For an authored TD selected by `wotid`, the Consumer resolves revision `3` -through its configured resolver. The subject selects that TD's `processData` -property. In the JSON event format, `data` is the CloudEvent's payload member; -it is not named after the affordance. Here, `data` directly contains that -property's object value without a `processData` wrapper. - -The resolved-view form uses the same event attributes. Its publication profile -selects the resolved TD representation for `wotid`: - -```json -{ - "specversion": "1.0", - "id": "sample-4712", - "source": "urn:example:plant:publisher", - "type": "com.example.models.%2Ftm%2Fpump.affordance.properties.processData", - "subject": "/properties/processData", + "source": "wot-td://factory/line1?wotid=urn:example:pump:7;wotversion=3.0.0", + "type": "com.example.models.tm.pump.properties.processData", + "subject": "#/properties/processData", "datacontenttype": "application/json", "dataschema": "https://example.com/schemas/pump-process-data/versions/3", - "wotid": "urn:example:pump:7", - "wotversion": "3", "data": { "Speed": 1500, "Pressure": 4.5 @@ -321,29 +278,27 @@ selects the resolved TD representation for `wotid`: } ``` -In either form, the separate schema describes the JSON object containing -`Speed` and `Pressure`; it does not describe the TD document. Another pump -with the same model and model-affordance mapping can use the same type with a -different `wotid`. +The subject selects the property in that resolved view. The payload directly +contains the property's object value without a `processData` wrapper. The +separate schema describes that object, not the TD document. Another pump can +use the same event type with a different Thing identity in its `source`. ### Whole Thing -This CloudEvent carries aggregated data for the pump described by the same TD. -The publication profile selects the authored TD and defines a payload containing -the `processData` and `running` property values. The type uses the governing TM's -base without an affordance suffix, and `subject` is absent because the event is -not scoped to one affordance. +This CloudEvent carries aggregated data for the same pump. Its unversioned +source selects the current default resolved TD, which this example assumes is +version `3.0.0`. The publication profile defines a payload containing the +`processData` and `running` property values. The subject selects the whole TD. ```json { "specversion": "1.0", "id": "sample-4713", - "source": "urn:example:plant:publisher", - "type": "com.example.models.%2Ftm%2Fpump", + "source": "wot-td://factory/line1?wotid=urn:example:pump:7", + "type": "com.example.models.tm.pump", + "subject": "#", "datacontenttype": "application/json", "dataschema": "https://example.com/schemas/pump-state/versions/3", - "wotid": "urn:example:pump:7", - "wotversion": "3", "data": { "processData": { "Speed": 1500, @@ -354,7 +309,8 @@ not scoped to one affordance. } ``` -`wotid` and `wotversion` select the TD used to interpret these property values. +The source selects the TD used to interpret these property values. If the +default changes, a later resolution of this event can select another version. The TD document itself is not the payload. `dataschema` identifies the schema of the aggregate JSON object, not the TD or either property's DataSchema alone. @@ -366,13 +322,14 @@ MUST NOT authorize arbitrary network access, redirects or credential forwarding. Implementations SHOULD bound document sizes and dependency resolution. -The Producer controls these attributes unless another mechanism authenticates -them. A matching digest does not establish that a TD, its model lineage or a -schema is authorized for the Consumer's use. Exact revisions and digests do -not grant access to referenced documents or make their dependencies available. +The Producer controls the context attributes unless another mechanism +authenticates them. A version does not establish that a TD, its model lineage, +or a schema is authorized for the Consumer's use. It does not grant access to +referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [IRI]: https://www.rfc-editor.org/rfc/rfc3987 +[URI]: https://www.rfc-editor.org/rfc/rfc3986 [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 [WoT Registry]: https://github.com/xregistry/spec/blob/main/workingdrafts/models/wot/spec.md diff --git a/tools/test_wot_examples.py b/tools/test_wot_examples.py new file mode 100644 index 000000000..03cc1a8f3 --- /dev/null +++ b/tools/test_wot_examples.py @@ -0,0 +1,85 @@ +import json +import re +from pathlib import Path +from urllib.parse import quote, unquote_to_bytes, urlsplit + + +EXTENSIONS = Path(__file__).resolve().parents[1] / "cloudevents" / "extensions" +TYPE = re.compile(r"[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*") +SAFE_VALUE = "!$'()*,:@/?" + + +def _source_parameters(source): + uri = urlsplit(source) + assert uri.scheme == "wot-td" + assert uri.hostname + assert uri.username is None and uri.password is None + assert "#" not in source + parts = uri.query.split(";") + assert len(parts) in (1, 2) + values = {} + for part in parts: + name, separator, encoded = part.partition("=") + assert separator and encoded and "=" not in encoded + assert name not in values + assert not re.search(r"%(?![0-9A-Fa-f]{2})", encoded) + value = unquote_to_bytes(encoded).decode("utf-8", errors="strict") + assert quote(value, safe=SAFE_VALUE) == encoded + values[name] = value + assert list(values) in (["wotid"], ["wotid", "wotversion"]) + return values + + +def _assert_wot_context(event): + assert event["specversion"] == "1.0" + assert event["id"] + assert TYPE.fullmatch(event["type"]) + assert event["subject"] == "#" or event["subject"].startswith("#/") + assert not {"wotid", "wotversion", "wotdigest"} & event.keys() + return _source_parameters(event["source"]) + + +def test_wot_json_examples_use_canonical_core_attributes(): + text = (EXTENSIONS / "wot.md").read_text(encoding="utf-8") + examples = [ + json.loads(block) + for block in re.findall(r"```json\s*\n(.*?)\n```", text, re.DOTALL) + ] + assert len(examples) == 2 + affordance, whole_thing = examples + assert _assert_wot_context(affordance) == { + "wotid": "urn:example:pump:7", + "wotversion": "3.0.0", + } + assert _assert_wot_context(whole_thing) == {"wotid": "urn:example:pump:7"} + assert affordance["subject"] == "#/properties/processData" + assert affordance["type"] == "com.example.models.tm.pump.properties.processData" + assert affordance["data"] == {"Speed": 1500, "Pressure": 4.5} + assert whole_thing["subject"] == "#" + assert whole_thing["type"] == "com.example.models.tm.pump" + assert whole_thing["data"]["processData"] == affordance["data"] + + +def test_opcua_binary_example_retains_native_writer_and_uint32_sequence(): + text = (EXTENSIONS / "opcua.md").read_text(encoding="utf-8") + section = text.split("### WoT and OPC UA telemetry message", 1)[1] + example = section.split("```text", 1)[1].split("```", 1)[0] + properties = example.split("------------- User Properties ----------------", 1)[1] + properties, payload = properties.split("------------------ payload -------------------", 1) + event = dict( + line.split(": ", 1) for line in properties.strip().splitlines() if line.strip() + ) + assert _assert_wot_context(event) == { + "wotid": "urn:example:pump:7", + "wotversion": "3.0.0", + } + assert event["type"] == "com.example.models.tm.pump.properties.processData" + assert event["subject"] == "#/properties/processData" + assert event["opcuapublisherid"] == "UInt16:12" + assert event["opcuadatasetwritername"] == "PumpProcessData" + assert "opcuadatasetwriterid" not in event + assert event["opcuamessagetype"] == "ua-keyframe" + assert event["opcuasequence"] == "4294967295" + assert "sequence" not in event + payload_json = payload.split("-----------------------------------------------", 1)[0] + assert json.loads(payload_json) == {"Speed": 1500, "Pressure": 4.5} From 6842f78f530dbfb7309ec9bf8c576e354841228a Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 31 Oct 2026 05:32:41 +0100 Subject: [PATCH 09/60] docs(opcua): preserve sequence string ordering Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 13 ++++++++++--- tools/test_wot_examples.py | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index b630f8073..d1571ca5b 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -127,6 +127,13 @@ CloudEvents `source`. A Publisher using this mapping MUST scope `source` to the DataSetWriter's ordering scope; otherwise, it MUST NOT present the per-writer counter as the CloudEvents `sequence`. +The Sequence extension compares String values lexicographically. The Producer +MUST format the mapped counter so that string comparison preserves the event +order; padding the unsigned decimal value to ten digits is one way to do so. +A reset or rollover can reverse that order within the same source scope. The +Producer MUST NOT use the counter for `sequence` when it cannot preserve the +ordering defined by the Sequence extension. + When the WoT profile is also used, `subject` identifies a TD or affordance, not the DataSetWriter. `opcuasequence` therefore carries the native OPC UA counter; a CloudEvents `sequence`, if present, MUST satisfy the Sequence extension's @@ -331,7 +338,7 @@ id: 1235-1235-1235 source: urn:factory:aggregationserver:opcua datacontenttype: application/json; charset=utf-8 subject: energy-consumption-asset -sequence: 7 +sequence: 0000000007 traceparent: 4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00000011 recordedtime: 2024-03-28T21:56:43Z opcuametadatamajorversion: 672338910 @@ -406,7 +413,7 @@ id: 1236-1237-1238 source: urn:factory:aggregationserver:opcua datacontenttype: application/json; charset=utf-8 subject: energy-consumption-asset/444321 -sequence: 18 +sequence: 0000000018 traceparent: caffef3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00000011 recordedtime: 2024-03-28T21:57:01Z opcuametadatamajorversion: 672338910 @@ -449,7 +456,7 @@ source: bottling-company/amsterdam/FillingArea1/FillingLine9/Cell1/Conveyor datacontenttype: application/avro subject: energy-consumption-asset dataschema: http://example.com/schemas/energy-consumption-asset/v1.8 -sequence: 3141 +sequence: 0000003141 traceparent: 22222f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-00000011 recordedtime: 2024-03-28T23:59:59Z .... further attributes ... diff --git a/tools/test_wot_examples.py b/tools/test_wot_examples.py index 03cc1a8f3..283913fc9 100644 --- a/tools/test_wot_examples.py +++ b/tools/test_wot_examples.py @@ -83,3 +83,27 @@ def test_opcua_binary_example_retains_native_writer_and_uint32_sequence(): assert "sequence" not in event payload_json = payload.split("-----------------------------------------------", 1)[0] assert json.loads(payload_json) == {"Speed": 1500, "Pressure": 4.5} + + +def test_ua_only_sequence_examples_preserve_lexicographic_order(): + text = (EXTENSIONS / "opcua.md").read_text(encoding="utf-8") + sections = [ + "### Telemetry message\n", + "### Event message\n", + "### Telemetry message with different Encoding\n", + ] + examples = [ + text.split(heading, 1)[1].split("\n### ", 1)[0] for heading in sections + ] + sequences = [ + re.search(r"^sequence: (\S+)$", example, re.MULTILINE).group(1) + for example in examples + ] + sources = [ + re.search(r"^source: (\S+)$", example, re.MULTILINE).group(1) + for example in examples + ] + assert sequences == ["0000000007", "0000000018", "0000003141"] + assert [int(sequence) for sequence in sequences] == [7, 18, 3141] + assert sources[0] == sources[1] + assert sequences[0] < sequences[1] From b3784a2f646dbd066073ab9d58d4b7fe7ea193c2 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 31 Oct 2026 09:30:42 +0100 Subject: [PATCH 10/60] docs(wot): generalize source URI mapping Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 2 +- cloudevents/extensions/wot.md | 99 +++++++++++++++++---------------- tools/test_wot_examples.py | 74 +++++++++++++++++++++--- 3 files changed, 120 insertions(+), 55 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index d1571ca5b..f9e7a967b 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -488,7 +488,7 @@ Content Type: application/json specversion: 1.0 id: ua-message-25460 -source: wot-td://factory/line1?wotid=urn:example:pump:7;wotversion=3.0.0 +source: https://factory.example.com/line1?wotid=urn:example:pump:7;wotversion=3.0.0;site=north type: com.example.models.tm.pump.properties.processData subject: #/properties/processData time: 2026-10-29T12:00:00Z diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 714caa955..f7117668b 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -5,9 +5,10 @@ Core context attributes. The `source` identifies the Thing and, when provided, a version of its resolved TD. The `subject` identifies the part of that TD associated with the event, and the `type` names the event contract. -The profile defines no CloudEvents extension attributes. Its use is identified -by the `wot-td` scheme in `source`. It does not define a transport binding, -provision a Thing, or require a particular registry implementation. +The profile defines no CloudEvents extension attributes or URI scheme. +Producers and Consumers agree on its use through a publication profile or out +of band. It does not define a transport binding, provision a Thing, or require +a particular registry implementation. ## Notational Conventions @@ -21,56 +22,59 @@ attribute marked REQUIRED here is not REQUIRED in every CloudEvent. ## Source -The Core [`source`](../spec.md#source) identifies a Thing within a configured -logical topology. It uses this absolute URI form: +The Core [`source`](../spec.md#source) identifies a Thing within the Producer's +chosen context. It MUST contain the `wotid` query parameter and MAY contain +`wotversion` and additional parameters. This profile does not prescribe the URI +scheme or the rest of the URI-reference. Core permits relative URI-references +and recommends an absolute URI. + +For example: ```text -wot-td://?wotid=[;wotversion=] +https://factory.example.com/line1?wotid=urn:example:pump:7;wotversion=3.0.0;site=north ``` -For example: +The `site` parameter is defined by the Producer, not this profile. An HTTPS +source is an identifier and is not necessarily a retrieval URL for a TD. +Another possible form is: ```text wot-td://factory/line1?wotid=urn:example:pump:7;wotversion=3.0.0 ``` -`wotid` and `wotversion` are query parameters, not CloudEvents attributes. -The `wot-td` scheme is proposed and is not currently registered with IANA. -The URI is an identifier for a configured resolver; it is not an HTTP registry -URL and does not itself specify where to retrieve a TD. - -### Topology - -The Producer configures the topology. It consists of a non-empty authority -followed by an OPTIONAL hierarchical path. Both MUST conform to -[RFC 3986][URI]. The authority MUST contain a non-empty host and MUST NOT -contain user information. The host need not be a resolvable DNS name. -Implementations MUST apply RFC 3986 host case rules and MUST NOT change the -case of the path when interpreting the topology. - -The topology can represent, for example, a site and production line. It is -not the Thing's identity or a registry Resource identifier. +This profile does not define the `wot-td` scheme or propose its registration. +The part of `source` outside the standardized parameters can identify a +topology, publisher, or another Producer-defined context. This profile does +not prescribe its structure or derive a TD retrieval location from it. ### Query syntax and encoding -The query contains `wotid` followed by an OPTIONAL `wotversion`. The literal -parameter names are case-sensitive, and `;` separates the parameters. Each -parameter consists of its name, one `=`, and a non-empty value. No other -parameters are defined. - -The value's unescaped characters are the RFC 3986 `unreserved` characters -and `!`, `$`, `'`, `(`, `)`, `*`, `,`, `:`, `@`, `/`, and `?`. A Producer -MUST leave these characters unescaped. It MUST percent-encode the UTF-8 bytes -of all other characters using uppercase hexadecimal digits. -In particular, a literal `%`, `;`, `=`, `&`, `+`, or `#` in a value MUST be -encoded. A Producer MUST NOT use form-query encoding or encode a space as `+`. - -A Consumer MUST split the query at `;` before decoding the values. It MUST -reject an unknown or duplicate parameter, a missing or empty `wotid`, an empty -`wotversion`, an invalid percent escape, invalid UTF-8, an out-of-order -parameter, an unescaped character outside the permitted set, or a URI with an -outer fragment. It MUST percent-decode each value exactly once and MUST NOT -interpret `+` as a space. +The `source` query uses `;` as the parameter separator. This profile +standardizes two query parameters, not CloudEvents attributes: `wotid` is +REQUIRED and appears first; `wotversion` is OPTIONAL and, when present, +immediately follows `wotid`. Their names are case-sensitive and MUST appear +literally. Each MUST use `name=value` with a non-empty value. `wotid` MUST +appear exactly once, and `wotversion` MUST NOT appear more than once. + +A Producer MAY include additional parameters after the standardized parameters. +This profile does not assign them a meaning; a publication contract MAY define +their semantics. A Consumer MUST NOT reject a source solely because it contains +parameters not defined by this profile. + +For the standardized values, the unescaped characters are the +[RFC 3986][URI] `unreserved` characters and `!`, `$`, `'`, `(`, `)`, `*`, +`,`, `:`, `@`, `/`, and `?`. A Producer MUST leave these characters +unescaped. It MUST percent-encode the UTF-8 bytes of all other characters using +uppercase hexadecimal digits. In particular, a literal `%`, `;`, `=`, `&`, +`+`, or `#` in a standardized value MUST be encoded. A Producer MUST NOT use +form-query encoding or encode a space as `+` for those values. + +A Consumer MUST split the query at `;` before decoding the standardized values. +It MUST reject a missing or empty `wotid`, an empty `wotversion`, a duplicate +standardized parameter, or a standardized parameter in the wrong position. For +a standardized value, it MUST reject an invalid percent escape, invalid UTF-8, +or an unescaped character outside the permitted set. It MUST percent-decode +each standardized value exactly once and MUST NOT interpret `+` as a space. For example, an identifier containing U+00E9 followed by the literal characters `%2F` encodes that portion as `%C3%A9%252F`. One decoding pass recovers the @@ -105,10 +109,11 @@ than the one available when the event was produced. A publication profile that requires repeatable replay MUST require `wotversion`. Core requires `source` and `id` together to identify each distinct event. -Changing the topology or version changes the `source` and therefore its event -identity and [Sequence extension](sequence.md) scope. Returning to an earlier -`source` returns to its existing scope: Producers MUST NOT reuse event -identities or restart a claimed source-wide sequence within that scope. +Changing the `source`, including its context, version, or other parameters, +changes the event identity and [Sequence extension](sequence.md) scope. +Returning to an earlier `source` returns to its existing scope: Producers MUST +NOT reuse event identities or restart a claimed source-wide sequence within +that scope. ## Resolving the Thing Description @@ -266,7 +271,7 @@ configured resolver selects version `3.0.0` of the resolved TD. { "specversion": "1.0", "id": "sample-4711", - "source": "wot-td://factory/line1?wotid=urn:example:pump:7;wotversion=3.0.0", + "source": "https://factory.example.com/line1?wotid=urn:example:pump:7;wotversion=3.0.0;site=north", "type": "com.example.models.tm.pump.properties.processData", "subject": "#/properties/processData", "datacontenttype": "application/json", @@ -294,7 +299,7 @@ version `3.0.0`. The publication profile defines a payload containing the { "specversion": "1.0", "id": "sample-4713", - "source": "wot-td://factory/line1?wotid=urn:example:pump:7", + "source": "https://factory.example.com/line1?wotid=urn:example:pump:7;site=north", "type": "com.example.models.tm.pump", "subject": "#", "datacontenttype": "application/json", diff --git a/tools/test_wot_examples.py b/tools/test_wot_examples.py index 283913fc9..705fe3390 100644 --- a/tools/test_wot_examples.py +++ b/tools/test_wot_examples.py @@ -3,33 +3,90 @@ from pathlib import Path from urllib.parse import quote, unquote_to_bytes, urlsplit +import pytest + EXTENSIONS = Path(__file__).resolve().parents[1] / "cloudevents" / "extensions" TYPE = re.compile(r"[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*") SAFE_VALUE = "!$'()*,:@/?" +STANDARD_PARAMETERS = {"wotid", "wotversion"} def _source_parameters(source): + assert source uri = urlsplit(source) - assert uri.scheme == "wot-td" - assert uri.hostname - assert uri.username is None and uri.password is None - assert "#" not in source parts = uri.query.split(";") - assert len(parts) in (1, 2) values = {} - for part in parts: + for index, part in enumerate(parts): name, separator, encoded = part.partition("=") + if name not in STANDARD_PARAMETERS: + continue + assert (name == "wotid" and index == 0) or ( + name == "wotversion" and index == 1 and "wotid" in values + ) assert separator and encoded and "=" not in encoded assert name not in values assert not re.search(r"%(?![0-9A-Fa-f]{2})", encoded) value = unquote_to_bytes(encoded).decode("utf-8", errors="strict") assert quote(value, safe=SAFE_VALUE) == encoded values[name] = value - assert list(values) in (["wotid"], ["wotid", "wotversion"]) + assert "wotid" in values return values +@pytest.mark.parametrize( + "source, expected", + ( + ( + "https://factory.example.com/line1?wotid=urn:example:pump:7" + ";wotversion=3.0.0;site=north", + {"wotid": "urn:example:pump:7", "wotversion": "3.0.0"}, + ), + ( + "wot-td://factory/line1?wotid=urn:example:pump:7;" + "wotversion=3.0.0;site=north", + {"wotid": "urn:example:pump:7", "wotversion": "3.0.0"}, + ), + ( + "line1?wotid=urn:example:pump:7;site=north;site=south#details", + {"wotid": "urn:example:pump:7"}, + ), + ( + "custom:line1?wotid=urn:example:pump:7;site=north", + {"wotid": "urn:example:pump:7"}, + ), + ( + "?wotid=urn:example:caf%C3%A9%252F;other=a=b;flag", + {"wotid": "urn:example:caf\u00e9%2F"}, + ), + ), +) +def test_source_parameters_allow_other_context_and_parameters(source, expected): + assert _source_parameters(source) == expected + + +@pytest.mark.parametrize( + "query, error", + ( + ("site=north", AssertionError), + ("site=north;wotid=urn:example:pump:7", AssertionError), + ("wotid=", AssertionError), + ("wotid=urn:example:pump:7;wotversion=", AssertionError), + ("wotid=urn:example:pump:7;wotid=urn:example:pump:8", AssertionError), + ("wotid=urn:example:pump:7;wotversion=1;wotversion=2", AssertionError), + ("wotversion=1;wotid=urn:example:pump:7", AssertionError), + ("wotid=urn:example:pump:7;site=north;wotversion=1", AssertionError), + ("wotid=urn:example:pump:7&wotversion=1", AssertionError), + ("wotid=urn:example:pump%2", AssertionError), + ("wotid=urn:example:pump%FF", UnicodeDecodeError), + ("wotid=urn:example:pump+7", AssertionError), + ), +) +def test_source_parameters_reject_invalid_standard_parameters(query, error): + with pytest.raises(error): + _source_parameters(f"https://factory.example.com/line1?{query}") + + def _assert_wot_context(event): assert event["specversion"] == "1.0" assert event["id"] @@ -52,6 +109,8 @@ def test_wot_json_examples_use_canonical_core_attributes(): "wotversion": "3.0.0", } assert _assert_wot_context(whole_thing) == {"wotid": "urn:example:pump:7"} + assert urlsplit(affordance["source"]).query.endswith(";site=north") + assert urlsplit(whole_thing["source"]).query.endswith(";site=north") assert affordance["subject"] == "#/properties/processData" assert affordance["type"] == "com.example.models.tm.pump.properties.processData" assert affordance["data"] == {"Speed": 1500, "Pressure": 4.5} @@ -73,6 +132,7 @@ def test_opcua_binary_example_retains_native_writer_and_uint32_sequence(): "wotid": "urn:example:pump:7", "wotversion": "3.0.0", } + assert urlsplit(event["source"]).query.endswith(";site=north") assert event["type"] == "com.example.models.tm.pump.properties.processData" assert event["subject"] == "#/properties/processData" assert event["opcuapublisherid"] == "UInt16:12" From 8552ac425f29ac4ddf411e35fbe077edf3816fad Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 31 Oct 2026 09:30:42 +0100 Subject: [PATCH 11/60] docs: remove dead UNCTAD spreadsheet link Signed-off-by: Marc --- cloudevents/extensions/data-classification.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cloudevents/extensions/data-classification.md b/cloudevents/extensions/data-classification.md index e1d10a13e..087c5e61e 100644 --- a/cloudevents/extensions/data-classification.md +++ b/cloudevents/extensions/data-classification.md @@ -96,11 +96,10 @@ Examples where data classification of events can be useful are: ## Appendix: Data Protection and Privacy Regulations -For reference purposes, a catalog of common data protection and privacy -regulation and abbreviations is available from [UNCTAD +For reference purposes, information on data protection and privacy legislation +worldwide is available from [UNCTAD (United Nations Conference on Trade and Development)](https://unctad.org/page/data-protection-and-privacy-legislation-worldwide). -Others might exist. Some examples include: - `GDPR` - General Data Protection Regulation, Europe From 67f61982328a39659f8587f2cb1ad71a4df28cea Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 31 Oct 2026 09:35:09 +0100 Subject: [PATCH 12/60] docs(wot): add MQTT source example Signed-off-by: Marc --- cloudevents/extensions/wot.md | 7 +++++++ tools/test_wot_examples.py | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index f7117668b..89c79cc06 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -36,6 +36,13 @@ https://factory.example.com/line1?wotid=urn:example:pump:7;wotversion=3.0.0;site The `site` parameter is defined by the Producer, not this profile. An HTTPS source is an identifier and is not necessarily a retrieval URL for a TD. + +An MQTT source identifier can use the same query parameters: + +```text +mqtt://site/line/cell/device/sensor?wotid=urn:example:sensor:7;wotversion=3.0.0 +``` + Another possible form is: ```text diff --git a/tools/test_wot_examples.py b/tools/test_wot_examples.py index 705fe3390..7f8982a6f 100644 --- a/tools/test_wot_examples.py +++ b/tools/test_wot_examples.py @@ -65,6 +65,24 @@ def test_source_parameters_allow_other_context_and_parameters(source, expected): assert _source_parameters(source) == expected +def test_mqtt_source_example_uses_standard_parameters(): + text = (EXTENSIONS / "wot.md").read_text(encoding="utf-8") + section = text.split("## Source\n", 1)[1].split("### Query syntax", 1)[0] + examples = re.findall(r"```text\s*\n(mqtt://[^\n]+)\n```", section) + assert len(examples) == 1 + source = examples[0] + uri = urlsplit(source) + assert (uri.scheme, uri.netloc, uri.path) == ( + "mqtt", + "site", + "/line/cell/device/sensor", + ) + assert _source_parameters(source) == { + "wotid": "urn:example:sensor:7", + "wotversion": "3.0.0", + } + + @pytest.mark.parametrize( "query, error", ( From d9c65271c55509e0999a2ced2fa3e7fb9c8013e0 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 31 Oct 2026 09:38:42 +0100 Subject: [PATCH 13/60] Revert unrelated classification and tool changes Signed-off-by: Marc --- cloudevents/extensions/data-classification.md | 9 +- tools/test_verify.py | 18 -- tools/test_wot_examples.py | 187 ------------------ tools/verify.py | 3 - 4 files changed, 6 insertions(+), 211 deletions(-) delete mode 100644 tools/test_wot_examples.py diff --git a/cloudevents/extensions/data-classification.md b/cloudevents/extensions/data-classification.md index 087c5e61e..37c7a9b4a 100644 --- a/cloudevents/extensions/data-classification.md +++ b/cloudevents/extensions/data-classification.md @@ -96,10 +96,13 @@ Examples where data classification of events can be useful are: ## Appendix: Data Protection and Privacy Regulations -For reference purposes, information on data protection and privacy legislation -worldwide is available from [UNCTAD +For reference purposes, a catalog of common data protection and privacy +regulation and abbreviations is availble from [UNCTAD (United Nations Conference on Trade and -Development)](https://unctad.org/page/data-protection-and-privacy-legislation-worldwide). +Development)](https://unctad.org/page/data-protection-and-privacy-legislation-worldwide), +under the `DOWNLOAD FULL DATA` button ([direct +link](https://unctad.org/system/files/information-document/DP.xlsx)). Others +might exist. Some examples include: - `GDPR` - General Data Protection Regulation, Europe diff --git a/tools/test_verify.py b/tools/test_verify.py index 061dc8280..3698e277b 100644 --- a/tools/test_verify.py +++ b/tools/test_verify.py @@ -14,7 +14,6 @@ _is_text_all_uppercase, _plain_text_issues, _render_markdown_to_html, - _uri_availability_issues, ) @@ -188,23 +187,6 @@ def test_rtl_unicode_must_be_rendered_in_the_id(): ) -@pytest.mark.asyncio -@pytest.mark.parametrize( - "uri", - ( - "https://rfc-editor.org/rfc/rfc3987", - "https://www.rfc-editor.org/info/rfc2119", - ), -) -async def test_rfc_editor_links_skip_network_check(monkeypatch, uri): - monkeypatch.setattr( - "verify.ClientSession", - lambda: pytest.fail("RFC Editor links must not be fetched"), - ) - - assert await _uri_availability_issues(uri, Settings(excluded_paths=set())) == [] - - @pytest.mark.asyncio async def test_app(monkeypatch): monkeypatch.chdir(str(Path(__file__).parent)) diff --git a/tools/test_wot_examples.py b/tools/test_wot_examples.py deleted file mode 100644 index 7f8982a6f..000000000 --- a/tools/test_wot_examples.py +++ /dev/null @@ -1,187 +0,0 @@ -import json -import re -from pathlib import Path -from urllib.parse import quote, unquote_to_bytes, urlsplit - -import pytest - - -EXTENSIONS = Path(__file__).resolve().parents[1] / "cloudevents" / "extensions" -TYPE = re.compile(r"[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*") -SAFE_VALUE = "!$'()*,:@/?" -STANDARD_PARAMETERS = {"wotid", "wotversion"} - - -def _source_parameters(source): - assert source - uri = urlsplit(source) - parts = uri.query.split(";") - values = {} - for index, part in enumerate(parts): - name, separator, encoded = part.partition("=") - if name not in STANDARD_PARAMETERS: - continue - assert (name == "wotid" and index == 0) or ( - name == "wotversion" and index == 1 and "wotid" in values - ) - assert separator and encoded and "=" not in encoded - assert name not in values - assert not re.search(r"%(?![0-9A-Fa-f]{2})", encoded) - value = unquote_to_bytes(encoded).decode("utf-8", errors="strict") - assert quote(value, safe=SAFE_VALUE) == encoded - values[name] = value - assert "wotid" in values - return values - - -@pytest.mark.parametrize( - "source, expected", - ( - ( - "https://factory.example.com/line1?wotid=urn:example:pump:7" - ";wotversion=3.0.0;site=north", - {"wotid": "urn:example:pump:7", "wotversion": "3.0.0"}, - ), - ( - "wot-td://factory/line1?wotid=urn:example:pump:7;" - "wotversion=3.0.0;site=north", - {"wotid": "urn:example:pump:7", "wotversion": "3.0.0"}, - ), - ( - "line1?wotid=urn:example:pump:7;site=north;site=south#details", - {"wotid": "urn:example:pump:7"}, - ), - ( - "custom:line1?wotid=urn:example:pump:7;site=north", - {"wotid": "urn:example:pump:7"}, - ), - ( - "?wotid=urn:example:caf%C3%A9%252F;other=a=b;flag", - {"wotid": "urn:example:caf\u00e9%2F"}, - ), - ), -) -def test_source_parameters_allow_other_context_and_parameters(source, expected): - assert _source_parameters(source) == expected - - -def test_mqtt_source_example_uses_standard_parameters(): - text = (EXTENSIONS / "wot.md").read_text(encoding="utf-8") - section = text.split("## Source\n", 1)[1].split("### Query syntax", 1)[0] - examples = re.findall(r"```text\s*\n(mqtt://[^\n]+)\n```", section) - assert len(examples) == 1 - source = examples[0] - uri = urlsplit(source) - assert (uri.scheme, uri.netloc, uri.path) == ( - "mqtt", - "site", - "/line/cell/device/sensor", - ) - assert _source_parameters(source) == { - "wotid": "urn:example:sensor:7", - "wotversion": "3.0.0", - } - - -@pytest.mark.parametrize( - "query, error", - ( - ("site=north", AssertionError), - ("site=north;wotid=urn:example:pump:7", AssertionError), - ("wotid=", AssertionError), - ("wotid=urn:example:pump:7;wotversion=", AssertionError), - ("wotid=urn:example:pump:7;wotid=urn:example:pump:8", AssertionError), - ("wotid=urn:example:pump:7;wotversion=1;wotversion=2", AssertionError), - ("wotversion=1;wotid=urn:example:pump:7", AssertionError), - ("wotid=urn:example:pump:7;site=north;wotversion=1", AssertionError), - ("wotid=urn:example:pump:7&wotversion=1", AssertionError), - ("wotid=urn:example:pump%2", AssertionError), - ("wotid=urn:example:pump%FF", UnicodeDecodeError), - ("wotid=urn:example:pump+7", AssertionError), - ), -) -def test_source_parameters_reject_invalid_standard_parameters(query, error): - with pytest.raises(error): - _source_parameters(f"https://factory.example.com/line1?{query}") - - -def _assert_wot_context(event): - assert event["specversion"] == "1.0" - assert event["id"] - assert TYPE.fullmatch(event["type"]) - assert event["subject"] == "#" or event["subject"].startswith("#/") - assert not {"wotid", "wotversion", "wotdigest"} & event.keys() - return _source_parameters(event["source"]) - - -def test_wot_json_examples_use_canonical_core_attributes(): - text = (EXTENSIONS / "wot.md").read_text(encoding="utf-8") - examples = [ - json.loads(block) - for block in re.findall(r"```json\s*\n(.*?)\n```", text, re.DOTALL) - ] - assert len(examples) == 2 - affordance, whole_thing = examples - assert _assert_wot_context(affordance) == { - "wotid": "urn:example:pump:7", - "wotversion": "3.0.0", - } - assert _assert_wot_context(whole_thing) == {"wotid": "urn:example:pump:7"} - assert urlsplit(affordance["source"]).query.endswith(";site=north") - assert urlsplit(whole_thing["source"]).query.endswith(";site=north") - assert affordance["subject"] == "#/properties/processData" - assert affordance["type"] == "com.example.models.tm.pump.properties.processData" - assert affordance["data"] == {"Speed": 1500, "Pressure": 4.5} - assert whole_thing["subject"] == "#" - assert whole_thing["type"] == "com.example.models.tm.pump" - assert whole_thing["data"]["processData"] == affordance["data"] - - -def test_opcua_binary_example_retains_native_writer_and_uint32_sequence(): - text = (EXTENSIONS / "opcua.md").read_text(encoding="utf-8") - section = text.split("### WoT and OPC UA telemetry message", 1)[1] - example = section.split("```text", 1)[1].split("```", 1)[0] - properties = example.split("------------- User Properties ----------------", 1)[1] - properties, payload = properties.split("------------------ payload -------------------", 1) - event = dict( - line.split(": ", 1) for line in properties.strip().splitlines() if line.strip() - ) - assert _assert_wot_context(event) == { - "wotid": "urn:example:pump:7", - "wotversion": "3.0.0", - } - assert urlsplit(event["source"]).query.endswith(";site=north") - assert event["type"] == "com.example.models.tm.pump.properties.processData" - assert event["subject"] == "#/properties/processData" - assert event["opcuapublisherid"] == "UInt16:12" - assert event["opcuadatasetwritername"] == "PumpProcessData" - assert "opcuadatasetwriterid" not in event - assert event["opcuamessagetype"] == "ua-keyframe" - assert event["opcuasequence"] == "4294967295" - assert "sequence" not in event - payload_json = payload.split("-----------------------------------------------", 1)[0] - assert json.loads(payload_json) == {"Speed": 1500, "Pressure": 4.5} - - -def test_ua_only_sequence_examples_preserve_lexicographic_order(): - text = (EXTENSIONS / "opcua.md").read_text(encoding="utf-8") - sections = [ - "### Telemetry message\n", - "### Event message\n", - "### Telemetry message with different Encoding\n", - ] - examples = [ - text.split(heading, 1)[1].split("\n### ", 1)[0] for heading in sections - ] - sequences = [ - re.search(r"^sequence: (\S+)$", example, re.MULTILINE).group(1) - for example in examples - ] - sources = [ - re.search(r"^source: (\S+)$", example, re.MULTILINE).group(1) - for example in examples - ] - assert sequences == ["0000000007", "0000000018", "0000003141"] - assert [int(sequence) for sequence in sequences] == [7, 18, 3141] - assert sources[0] == sources[1] - assert sequences[0] < sequences[1] diff --git a/tools/verify.py b/tools/verify.py index c25a7c968..f7f93f155 100644 --- a/tools/verify.py +++ b/tools/verify.py @@ -8,7 +8,6 @@ from http import HTTPStatus from pathlib import Path from typing import Iterable, List, NewType, Optional, Sequence, Set, Tuple, TypeVar -from urllib.parse import urlsplit from aiohttp import ClientSession from bs4 import BeautifulSoup @@ -137,8 +136,6 @@ async def _uri_availability_issues(uri: HttpUri, settings: Settings) -> Sequence if "example.com" in uri: return [] if "ietf.org" in uri: return [] if "rfc-edit.org" in uri: return [] - if urlsplit(uri).hostname in {"rfc-editor.org", "www.rfc-editor.org"}: - return [] if "iso20022.org" in uri: return [] try: From 376091f0a5079b6f791573799472d2181f1dbb41 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 31 Oct 2026 09:50:34 +0100 Subject: [PATCH 14/60] docs: update UNCTAD legislation reference Signed-off-by: Marc --- cloudevents/extensions/data-classification.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cloudevents/extensions/data-classification.md b/cloudevents/extensions/data-classification.md index 37c7a9b4a..53e52c697 100644 --- a/cloudevents/extensions/data-classification.md +++ b/cloudevents/extensions/data-classification.md @@ -96,13 +96,10 @@ Examples where data classification of events can be useful are: ## Appendix: Data Protection and Privacy Regulations -For reference purposes, a catalog of common data protection and privacy -regulation and abbreviations is availble from [UNCTAD -(United Nations Conference on Trade and -Development)](https://unctad.org/page/data-protection-and-privacy-legislation-worldwide), -under the `DOWNLOAD FULL DATA` button ([direct -link](https://unctad.org/system/files/information-document/DP.xlsx)). Others -might exist. +[UNCTAD (United Nations Conference on Trade and +Development)](https://unctad.org/page/data-protection-and-privacy-legislation-worldwide) +provides a [catalog of legislation by country](https://storage.unctad.org/2026-cyberlaw_tracker/assets/data/document_links.json), +including data protection and privacy regulations. Some examples include: - `GDPR` - General Data Protection Regulation, Europe From 47ad4382fc9374c35b1061f8d55f1a0087aae5b5 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 31 Oct 2026 11:17:03 +0100 Subject: [PATCH 15/60] docs(wot): version event contracts in types Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 2 +- cloudevents/extensions/wot.md | 45 ++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index f9e7a967b..54110bdf9 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -489,7 +489,7 @@ Content Type: application/json specversion: 1.0 id: ua-message-25460 source: https://factory.example.com/line1?wotid=urn:example:pump:7;wotversion=3.0.0;site=north -type: com.example.models.tm.pump.properties.processData +type: com.example.models.tm.pump.properties.processData.v1 subject: #/properties/processData time: 2026-10-29T12:00:00Z dataschema: https://example.com/schemas/pump-process-data/versions/3 diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 89c79cc06..0025b8ba1 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -167,17 +167,20 @@ resolution does not by itself prove that retrieved bytes are unchanged. ### type -The Core [`type`](../spec.md#type) identifies the event contract. Two Things -can produce events of the same type when their interactions follow the same -model. This profile uses a dot-separated symbol so a Consumer can map the type -to a code-generation symbol. +The Core [`type`](../spec.md#type) identifies the event contract. The contract +is the payload representation defined by the publication profile or protocol +binding, including its members, member types, and semantics. Two Things can +produce events of the same type when their event contracts are the same. This +profile uses a dot-separated symbol so a Consumer can map the type to a +code-generation symbol. The type MUST contain one or more segments separated by single dots. Each segment MUST start with an ASCII letter or underscore and contain only ASCII letters, digits, or underscores thereafter. These character restrictions apply only to `type`; they do not change the Thing identifier, TD member names, `source`, `subject`, or payload. A code generator remains responsible for -language-specific keywords. +language-specific keywords. The final segment MUST identify the event-contract +revision as `vN`, where `N` is a positive decimal integer without leading zeros. A Producer MAY configure the complete type. Otherwise, it derives the type from a governing [Thing Model][TM] (TM) and, for an affordance event, the @@ -196,17 +199,35 @@ For an eligible HTTPS TM identifier, derive the type as follows: 4. For an affordance event, append the model-affordance JSON Pointer path. Decode its [RFC 6901][JSON Pointer] token escaping, then replace each `/` with `.`. +5. Append the event-contract revision as the final segment. For example, TM `https://models.example.com/tm/pump` and model affordance -`/properties/processData` produce: +`/properties/processData` with event-contract revision 1 produce: ```text -com.example.models.tm.pump.properties.processData +com.example.models.tm.pump.properties.processData.v1 ``` -For a whole-Thing event, use the TM-derived type without an affordance path. -The publication profile defines how interaction data is aggregated into the -payload. +For a whole-Thing event, use the TM-derived type without an affordance path, +then append the revision. The publication profile defines how interaction data +is aggregated into the payload. + +The publication profile MUST assign the same revision to the same event +contract. A Producer MUST use a new revision when the contract changes, +including when a member is added or removed, a member's type or meaning +changes, or the payload envelope changes. This applies even when the change is +backwardly compatible. A Producer MUST NOT reuse a revision for a different +contract with the same base type. + +For example, adding a `quality` member to +`com.example.models.tm.pump.properties.processData.v1` requires +`com.example.models.tm.pump.properties.processData.v2`, even if Consumers can +ignore the new member. + +A change to an individual value or the presence of a member already defined as +OPTIONAL does not change the contract revision. A change to `wotversion` or +`dataschema` alone also does not change the revision; if it changes the payload +contract, the Producer MUST use a new revision. The Producer MUST configure a valid complete type when the derivation is unavailable, produces an invalid symbol, or collides with a different event @@ -279,7 +300,7 @@ configured resolver selects version `3.0.0` of the resolved TD. "specversion": "1.0", "id": "sample-4711", "source": "https://factory.example.com/line1?wotid=urn:example:pump:7;wotversion=3.0.0;site=north", - "type": "com.example.models.tm.pump.properties.processData", + "type": "com.example.models.tm.pump.properties.processData.v1", "subject": "#/properties/processData", "datacontenttype": "application/json", "dataschema": "https://example.com/schemas/pump-process-data/versions/3", @@ -307,7 +328,7 @@ version `3.0.0`. The publication profile defines a payload containing the "specversion": "1.0", "id": "sample-4713", "source": "https://factory.example.com/line1?wotid=urn:example:pump:7;site=north", - "type": "com.example.models.tm.pump", + "type": "com.example.models.tm.pump.v1", "subject": "#", "datacontenttype": "application/json", "dataschema": "https://example.com/schemas/pump-state/versions/3", From 36411e0988c731844df4ad3640fed19aaa63852d Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 12 Nov 2026 11:44:56 +0100 Subject: [PATCH 16/60] docs: align WoT and OPC UA with xRegistry Event Context Signed-off-by: Marc --- cloudevents/extensions/README.md | 1 + cloudevents/extensions/context.md | 210 ++++++++++++++++++++++++++++++ cloudevents/extensions/opcua.md | 137 +++++++++++++++++-- cloudevents/extensions/wot.md | 101 +++++++++++--- 4 files changed, 420 insertions(+), 29 deletions(-) create mode 100644 cloudevents/extensions/context.md diff --git a/cloudevents/extensions/README.md b/cloudevents/extensions/README.md index 88968c440..971bdbd4c 100644 --- a/cloudevents/extensions/README.md +++ b/cloudevents/extensions/README.md @@ -46,6 +46,7 @@ for more information. - [Dataref (Claim Check Pattern)](dataref.md) - [Deprecation](deprecation.md) - [Distributed Tracing](distributed-tracing.md) +- [Event Context](context.md) - [Expiry Time](expirytime.md) - [OPC UA](opcua.md) - [Partitioning](partitioning.md) diff --git a/cloudevents/extensions/context.md b/cloudevents/extensions/context.md new file mode 100644 index 000000000..10463ca9c --- /dev/null +++ b/cloudevents/extensions/context.md @@ -0,0 +1,210 @@ +# Event Context + +The `contexturl` extension attribute identifies shared information that a +Consumer needs to interpret an event. Instead of repeating a Message definition +URL, schema URL, and emitter description URL in every event, a Producer names +one Context that references those representations by Role. + +This proposal aligns with the [xRegistry Event Context working draft][Context +Registry] in [xregistry/spec#796][Context PR]. The attribute name and the +resolved-view media type remain provisional. A Context is a metadata-only +xRegistry Resource, not a document attached to that Resource. This extension +does not require a Producer to host or query a Registry. + +A Publisher creates Contexts and their referenced representations. A Producer +emits events, and a Consumer processes them. + +## Notational Conventions + +As with the main [CloudEvents specification](../spec.md), the key words "MUST", +"MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", +"RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as +described in [RFC 2119](https://tools.ietf.org/html/rfc2119). + +The scope of these key words is limited to events using this extension. + +## Attributes + +### contexturl + +- Type: `URI` +- Description: The absolute URL of the Context that applies to this event. +- Constraints: + - OPTIONAL. + - If present, MUST identify a Context Resource or Context Version and MUST + NOT contain a fragment. + - SHOULD identify a Context Version. + - Consumers MUST use the value unchanged as the request URL and as the URL + component of the cache key. Cache selection MUST also account for the + selected representation and authorization context. + - Consumers MUST NOT derive other URLs from the value. In particular, they + MUST NOT append `$details`, a view path, or a query parameter, or remove + `/versions/`. + - When absent, this extension supplies no Context for the event. + +In the JSON event format, `contexturl` is a top-level string member. In HTTP +binary content mode, it is the `ce-contexturl` header, encoded and decoded +according to the [HTTP binding](../bindings/http-protocol-binding.md). +Other bindings use their normal extension-attribute mapping. + +## Context Representation + +An ordinary `GET` of `contexturl` with `Accept: application/json` returns +Context metadata directly. The xRegistry Context model sets `hasdocument` to +`false`; no `$details` request or separate Context document is needed. + +The REQUIRED `references` map contains at least one entry. Each key is a Role, +and each value is an object with a REQUIRED `url` member. That member is an +absolute URL without a fragment. Consumers MUST use each referenced URL +unchanged when retrieving its representation. + +The working draft defines these Roles. + +| Role | Referenced representation | +| --- | --- | +| `message` | Message definition metadata describing the event. | +| `schema` | Schema document for the event's `data`. | +| `emitter` | Description of the emitting entity, such as a WoT Thing Description Version document. | +| `target` | Model that the event concerns, such as an OpenUSD asset. | + +Roles follow the working draft's map-key rules. Unprefixed names are reserved +for that draft. Other Roles MUST use an identifying prefix followed by `:`, +such as `acme:policy`. Consumers MUST ignore Roles they do not use and Reference +attributes they do not understand. + +Contexts and References permit extension attributes. A profile can use those +attributes for metadata shared by a message stream. Such metadata is not +automatically a CloudEvents attribute: the profile MUST define its meaning and +how it relates to attributes carried in the event. + +## Processing and Versioning + +When including `contexturl`, a Producer MUST name a Context whose references +apply to the event. A Publisher MUST make referenced representations available +before configuring Producers with the Context URL. Producers SHOULD reuse a +configured Context Version URL for events with the same shared information. +A Context with a `message` Reference applies to one event type; Producers +that emit several types use a separate Context for each type in that case. + +A Publisher MUST NOT change a Context Version's `references` after any +Producer is configured with its URL. Changing references requires a new +Version and reconfigured Producers. Profiles that store shared metadata in +Context extension attributes MUST define equivalent stability rules for those +values. + +A Context Resource URL serves the current default Version. That default can +change without changing `contexturl`, so Consumers SHOULD bound the lifetime +of cached Resource representations. A Context Version fixes its references, +not the bytes of referenced representations. Publishers SHOULD reference +explicit Target Versions when replay requires reproducible interpretation and +SHOULD retain Contexts and referenced representations for the replay period. + +A Consumer retrieves the Context from the unchanged URL or uses a valid cache +entry for that URL, representation, and authorization context. It MUST check +the response status, media type, and Context representation against the +working draft. A failed response, unsupported representation, or missing or +empty `references` map makes the Context unavailable. For a valid Context, the +Consumer retrieves the representations for the Roles it needs, subject to its +access and content-trust policies. A missing Role that the Consumer needs +makes the Context incomplete. + +When retrieval fails or the Context is invalid or incomplete, the Consumer +MUST NOT derive replacement URLs from `contexturl`. It SHOULD record the +condition. Local policy determines whether to defer, reject, or process the +event without that information, unless another profile requires a particular +outcome. + +### Resolved Context view + +A supporting server can return the Context and all directly referenced +representations in one response. A Consumer requests that view at the same +unchanged URL with: + +```http +Accept: application/vnd.xregistry.context-view+json, application/json;q=0.5 +``` + +The Consumer MUST inspect `Content-Type` rather than assume that the server +supports the view. Ordinary `application/json` returns Context metadata; +`application/vnd.xregistry.context-view+json` returns `context` and `documents` +as defined by the working draft. The view includes every direct Reference or +returns an error. It does not recursively retrieve their dependencies or +establish a snapshot across Registries. + +## Relationship to Other Attributes + +Core attributes retain their meaning. In particular, `contexturl` does not +replace REQUIRED `id`, `source`, or `type`, and does not locate the event's +`data` as the [Dataref extension](dataref.md) does. + +A Consumer selects the first applicable schema source in this order: + +1. The event's `dataschema`. +2. The Context's `schema` Reference. +3. The schema declared by the Context's `message` representation. + +Producers SHOULD omit `dataschema` when the Context supplies the schema. +Publishers and Producers SHOULD supply only one schema source, or identify +the same schema when several are supplied. Consumers apply the precedence +without comparing the sources. + +An `emitter` Reference does not authenticate the event or redefine `source`. +The [WoT profile](wot.md) defines how it selects a Thing Description (TD) when +this extension is used. The +[OPC UA extension](opcua.md#shared-stream-metadata-in-a-context) +defines which stream metadata can be supplied by a Context. Neither rule +applies to generic events merely because they contain `contexturl`. + +## Example + +This event references shared emitter and payload-schema information. + +```json +{ + "specversion": "1.0", + "id": "sample-4711", + "source": "mqtt://site/line/cell/device/sensor", + "type": "com.example.models.tm.pump.properties.processData.v1", + "subject": "#/properties/processData", + "datacontenttype": "application/json", + "contexturl": "https://registry.example/contextgroups/line1/contexts/pump-process-data/versions/1", + "data": { + "Speed": 1500, + "Pressure": 4.5 + } +} +``` + +The Context Version has the following metadata. Other Core metadata is omitted +from this excerpt. + +```json +{ + "contextid": "pump-process-data", + "versionid": "1", + "references": { + "emitter": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + }, + "schema": { + "url": "https://example.com/schemas/pump-process-data/versions/3" + } + } +} +``` + +## Security Considerations + +Consumers and servers that assemble resolved views MUST apply authorization, +URL, redirect, and content-trust policies before retrieving or using a Context +or any referenced representation. An event-provided URL MUST NOT authorize +arbitrary network access or credential forwarding. Implementations SHOULD +bound response sizes, retrieval times, and dependency processing. + +Caches MUST NOT share representations across authorization contexts unless +the applicable access policy permits it. A resolved view does not bypass the +Consumer's trust checks. Context Versions and Target Versions do not by +themselves authenticate content or prove that its bytes are unchanged. + +[Context PR]: https://github.com/xregistry/spec/pull/796 +[Context Registry]: https://github.com/xregistry/spec/blob/e46561facacb672ed3d7603be1574a75b1a11789/workingdrafts/models/context/spec.md diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 54110bdf9..3fba9dd3d 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -6,6 +6,13 @@ DataSetMessages to CloudEvents for routing over supported protocols. It defines mappings for Core and other extension attributes and specifies OPC UA extension attributes. +When used with the [Event Context extension](context.md) and the xRegistry +Context model, metadata that stays constant for a message stream is preferably +stored in the Context rather than repeated in each event. The existing OPC UA +attributes remain defined and usable. The +[shared metadata rules](#shared-stream-metadata-in-a-context) describe how a +Consumer obtains omitted values from the Context. + ## Notational Conventions As with the main [CloudEvents specification](../spec.md), the key words "MUST", @@ -66,6 +73,10 @@ messages: requirements of the Sequence extension and MUST NOT be inferred from `opcuasequence`. +The Context rules below allow stable OPC UA values to be supplied by a +Context instead of a per-event attribute. They do not relocate `source`, +`type`, or `subject`, and they do not change how those Core attributes map. + These conditional mappings replace only the conflicting OPC UA mappings above. All other requirements in this extension remain applicable. A profile that uses only part of this extension MUST NOT claim conformance to it unless the @@ -90,6 +101,11 @@ separate format like [JSON schema](https://json-schema.org/specification) or [Avro schema](https://avro.apache.org/docs/1.11.1/specification/) or others. For those cases the attribute references the schema and is used for versioning. +When the Event Context extension is used, its `schema` Reference or `message` +representation can supply this schema instead. The Consumer follows that +extension's schema precedence, and the Producer SHOULD omit `dataschema` when +the Context supplies the schema. + ### subject When the WoT profile is not used, the following OPC UA mappings apply: @@ -267,11 +283,84 @@ than omit the status, wrap the value, or report it as _Good_. - OPC UA messages MUST use `binary-mode` of CloudEvents. - OPC UA PubSub JSON messages MUST be encoded using non-reversible encoding as the decoding information is contained in metadata messages or by schema -referenced via `dataschema` attribute. +referenced via `dataschema` attribute or selected through Event Context. - Payload of OPC UA PubSub JSON messages MUST NOT contain Network Message Header and Data Set Header as that information is mapped into CloudEvents attributes. - OPC UA PubSub JSON messages MUST contain exactly one dataset message. +## Shared Stream Metadata in a Context + +A message stream here is a configured flow from one Publisher and +DataSetWriter with a defined payload contract. It is not necessarily a broker +topic or a CloudEvents `source`; either can carry several streams. + +When Producers and Consumers agree to use this extension with the +[Event Context extension](context.md), the Context Publisher SHOULD store +metadata that is constant for the stream as Context Version extension +attributes. Each event then carries `contexturl`. The attributes defined in +[Attributes](#attributes) remain valid in events, but storing stream-constant +values once in the Context is preferable because events no longer repeat them, +which keeps messages small. The Context has no document body: these +values are members of its metadata object, alongside `references`. + +The following values can be supplied by the Context when they remain constant +for every event using that Context Version. When a Context supplies any of +these values, `contexturl` MUST identify a Context Version. A Context Resource +URL can select a different default Version when a delayed or replayed event is +processed. + +| Context attribute | Meaning and conditions | +| --- | --- | +| `opcuapublisherid` | The stream's native PublisherId. | +| `opcuadatasetwriterid` | The stream's native DataSetWriterId, when used. | +| `opcuadatasetwritername` | The stream's configured DataSetWriterName, when used. | +| `opcuametadatamajorversion` | The MajorVersion of the applicable native metadata, when no payload schema is selected. | +| `opcuametadataminorversion` | The MinorVersion of the applicable native metadata, when no payload schema is selected. | +| `opcuamessagetype` | The native MessageType, only for a stream restricted to one message type. Streams that mix keyframes, deltaframes, or events retain it in each event. | + +These members MUST use the CloudEvents types, value constraints, and native +field mappings defined in [Attributes](#attributes). For example, a Context's +`opcuadatasetwriterid` is a JSON integer, not a string. The Context's `schema` +Reference, rather than a new OPC UA attribute, identifies an external payload +schema. Native metadata-version attributes MUST NOT be supplied in the event +or Context when a schema is selected through `dataschema` or the Context. + +For these listed attributes, a value supplied by an applicable Context +satisfies this extension's presence requirements, including those of the +combined WoT mapping. A Producer MAY omit the corresponding event attribute. +All existing attribute definitions remain unchanged for events that do not +use this Context mapping. + +The Consumer uses an event attribute when it is present, otherwise the value +in the Context. If both are present, they MUST have the same typed value. If +they disagree, the Consumer MUST report a metadata conflict and MUST NOT +interpret the payload using that Context. If a REQUIRED value is absent from +both, the Consumer MUST report missing metadata and MUST NOT interpret the +payload as a conforming OPC UA message. A Consumer that cannot retrieve the +Context MAY process the event using only its explicit attributes if they +satisfy every applicable requirement, including the WoT resolution rules when +that profile is used. + +The Context Publisher MUST NOT change these values in a Context Version after +any Producer is configured with its URL. A change requires a new Context Version +and reconfigured Producers. Consumers MUST NOT retain values from a previous +Context when processing an event that selects another Context. A changed +payload contract also requires a changed WoT `type` revision when that profile +is used; changing only `contexturl` is not sufficient. + +Values that vary by occurrence remain in each event. In particular, +`opcuasequence`, `opcuastatus` when REQUIRED, `id`, and `time` MUST NOT be +supplied by the Context as replacements for their event attributes. Tracing, +recording times, and a CloudEvents `sequence`, when used, also remain in the +event. A Consumer MUST NOT use Context members with those names as event +values. Core attributes retain their normal placement and meaning even when +their values happen to be constant for a stream. + +Without a `contexturl`, no Context supplies missing OPC UA values. This +preserves the existing mapping for Consumers that do not support indirection. +Producers SHOULD use omission only when they know that the intended Consumers +support this mapping; retaining explicit OPC UA attributes remains valid. + ## Examples ### Metadata message @@ -471,10 +560,11 @@ recordedtime: 2024-03-28T23:59:59Z ### WoT and OPC UA telemetry message -This binary-mode keyframe uses the WoT event type and affordance subject while -retaining the native OPC UA message type, writer identity, and sequence -number. The DataSetWriter name is used without a numeric writer ID. The -example assumes that `PumpProcessData` uniquely identifies a writer within +This binary-mode keyframe uses the WoT event type and affordance subject. +Its Context supplies the resolved TD, payload schema, PublisherId, and +DataSetWriterName. The native OPC UA message type and sequence remain in the +event because they can vary within this stream. The example assumes that +`PumpProcessData` uniquely identifies a writer within publisher `UInt16:12`. The CloudEvents `sequence` attribute is absent because this example does not define a source-wide ordering across DataSetWriters. @@ -488,13 +578,11 @@ Content Type: application/json specversion: 1.0 id: ua-message-25460 -source: https://factory.example.com/line1?wotid=urn:example:pump:7;wotversion=3.0.0;site=north +source: mqtt://site/line/cell/device/sensor type: com.example.models.tm.pump.properties.processData.v1 subject: #/properties/processData time: 2026-10-29T12:00:00Z -dataschema: https://example.com/schemas/pump-process-data/versions/3 -opcuapublisherid: UInt16:12 -opcuadatasetwritername: PumpProcessData +contexturl: https://registry.example/contextgroups/line1/contexts/opcua-pump-process-data/versions/1 opcuamessagetype: ua-keyframe opcuasequence: 4294967295 @@ -508,5 +596,36 @@ opcuasequence: 4294967295 ----------------------------------------------- ``` +The referenced Context Version has the following metadata. Other Core +metadata is omitted from this excerpt. + +```json +{ + "contextid": "opcua-pump-process-data", + "versionid": "1", + "references": { + "emitter": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + }, + "schema": { + "url": "https://example.com/schemas/pump-process-data/versions/3" + } + }, + "opcuapublisherid": "UInt16:12", + "opcuadatasetwritername": "PumpProcessData" +} +``` + +The Consumer uses the Context's PublisherId and writer name together with the +event's `opcuamessagetype` and `opcuasequence`. It evaluates `subject` against +the TD selected by `emitter` and uses the schema selected by `schema`. + +## Context Retrieval Security + +The Event Context extension's retrieval, authorization, and cache rules apply +to this mapping. Stable writer metadata in a Context does not authenticate +the Publisher or authorize access to the referenced TD or schema. A Consumer +MUST establish trust in the Context before using it as OPC UA metadata. + [UA DataSetWriterName]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table185 [UA SequenceNumber]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.3 diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 0025b8ba1..55b4d2b09 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -1,14 +1,17 @@ # Web of Things This profile maps a [Web of Things Thing Description][TD] (TD) to CloudEvents -Core context attributes. The `source` identifies the Thing and, when provided, -a version of its resolved TD. The `subject` identifies the part of that TD -associated with the event, and the `type` names the event contract. +Core context attributes and the [Event Context extension](context.md). +The `contexturl` identifies shared metadata whose `emitter` Reference selects +the resolved TD. The `subject` identifies the part of that TD associated with +the event, and the `type` names the event contract. Without `contexturl`, the +`source` query parameters select the Thing and its resolved TD. The profile defines no CloudEvents extension attributes or URI scheme. Producers and Consumers agree on its use through a publication profile or out of band. It does not define a transport binding, provision a Thing, or require -a particular registry implementation. +a particular registry implementation. Events with `contexturl` use the +xRegistry Context representation. ## Notational Conventions @@ -23,10 +26,14 @@ attribute marked REQUIRED here is not REQUIRED in every CloudEvent. ## Source The Core [`source`](../spec.md#source) identifies a Thing within the Producer's -chosen context. It MUST contain the `wotid` query parameter and MAY contain -`wotversion` and additional parameters. This profile does not prescribe the URI -scheme or the rest of the URI-reference. Core permits relative URI-references -and recommends an absolute URI. +chosen context. With `contexturl`, it follows Core's URI-reference rules and +does not need `wotid` or `wotversion`. The Context's `emitter` Reference, not +the `source`, selects the resolved TD. + +Without `contexturl`, `source` MUST contain the `wotid` query parameter and MAY +contain `wotversion` and additional parameters. This profile does not prescribe +the URI scheme or the rest of the URI-reference. Core permits relative +URI-references and recommends an absolute URI. For example: @@ -56,6 +63,8 @@ not prescribe its structure or derive a TD retrieval location from it. ### Query syntax and encoding +This subsection applies when the event has no `contexturl`. + The `source` query uses `;` as the parameter separator. This profile standardizes two query parameters, not CloudEvents attributes: `wotid` is REQUIRED and appears first; `wotversion` is OPTIONAL and, when present, @@ -90,6 +99,9 @@ a slash. ### Thing identity and version +This subsection applies to selection through `source` when the event has no +`contexturl`. + The decoded `wotid` MUST be a non-empty absolute IRI as defined in [RFC 3987][IRI]. When the authored TD has an `id`, `wotid` MUST equal that value verbatim and the resolved TD MUST retain it. When the authored TD has @@ -115,6 +127,8 @@ That default can change, so a delayed event can resolve to a different view than the one available when the event was produced. A publication profile that requires repeatable replay MUST require `wotversion`. +### Event identity + Core requires `source` and `id` together to identify each distinct event. Changing the `source`, including its context, version, or other parameters, changes the event identity and [Sequence extension](sequence.md) scope. @@ -122,8 +136,43 @@ Returning to an earlier `source` returns to its existing scope: Producers MUST NOT reuse event identities or restart a claimed source-wide sequence within that scope. +Changing `contexturl` alone does not change event identity or sequence scope. +A Producer MUST NOT reuse an `id` or restart a source-wide sequence merely +because it publishes a new Context Version. + ## Resolving the Thing Description +### With Event Context + +When `contexturl` is present, the Producer and Consumer MUST use the +[Event Context extension](context.md). The Context MUST contain an `emitter` +Reference whose `url` identifies the resolved TD document, not its Registry +metadata. The Context Publisher SHOULD reference an explicit TD Version and +publish the resolved TD view at that URL. The Consumer retrieves the document +directly or uses the corresponding document in an accepted resolved Context +view. It MUST NOT derive a TD URL from `contexturl` or from the `emitter` URL. + +The Context's `emitter` is authoritative for TD selection. The Consumer MUST +evaluate `subject` against that TD, even if an interpretation of `source`, +including `wotid` or `wotversion` query parameters, would select another TD. +Those parameters do not select a TD in this mode. This rule does not change +Core's meaning of `source` or authenticate the emitting entity. + +If the Context cannot be retrieved or is invalid, or its `emitter` Reference +is missing or invalid, or the referenced TD is unavailable or not resolved, +the Consumer MUST report a resolution failure and leave the event uncorrelated. +It MUST NOT fall back to selection through `source`. It MAY retain or forward +the event without TD-based interpretation. + +The Context Publisher MUST make the TD available before configuring Producers +with the Context Version URL. Changes to its Reference require a new Context +Version. A change to the TD's resolved logical view requires a new TD Version; +the Context Publisher MUST NOT change that view at a previously published +Version URL. Context versioning alone does not make an unversioned TD URL +stable. + +### Without Event Context + The Producer and Consumer MUST agree on a resolver and its scope out of band or through their publication profile. The scope selects a registry and Group, tenant, or equivalent boundary in which the Thing identity is resolved. This @@ -225,9 +274,10 @@ For example, adding a `quality` member to ignore the new member. A change to an individual value or the presence of a member already defined as -OPTIONAL does not change the contract revision. A change to `wotversion` or -`dataschema` alone also does not change the revision; if it changes the payload -contract, the Producer MUST use a new revision. +OPTIONAL does not change the contract revision. A change to `contexturl`, its +`emitter` Reference, `wotversion`, or the selected schema alone also does not +change the revision; if it changes the payload contract, the Producer MUST use +a new revision. The Producer MUST configure a valid complete type when the derivation is unavailable, produces an invalid symbol, or collides with a different event @@ -265,6 +315,11 @@ CloudEvent's actual `data` adheres to. [`datacontenttype`](../spec.md#datacontenttype) identifies that data's media type. Neither identifies the TD document's format. +When `contexturl` is present, the Consumer follows the Event Context +extension's schema precedence: `dataschema`, then the Context's `schema` +Reference, then the schema declared by its `message` representation. The +Producer SHOULD omit `dataschema` when the Context supplies the schema. + A TD describes interactions and can contain several DataSchemas. The Producer MUST NOT use the whole TD as `dataschema` merely because the TD contains a schema for the selected affordance. A TD's retrieval URL is a @@ -277,6 +332,7 @@ several property values, an event payload and a protocol envelope can need different schemas. When `dataschema` is present, the Producer MUST ensure that it identifies the schema of the representation actually sent, including any encoding or envelope selected by the binding. +The same requirement applies to a schema supplied by the Context. An xRegistry Schema Resource's document-view URL can identify that external schema. It is not the WoT Resource's metadata-view URL. A profile MAY require @@ -292,18 +348,18 @@ MUST follow that extension's conditional WoT mapping. ### Single Affordance -This CloudEvent identifies a pump and its `processData` property. The -configured resolver selects version `3.0.0` of the resolved TD. +This CloudEvent identifies a pump and its `processData` property. Its Context +selects version `3.0.0` of the resolved TD and supplies the payload schema. ```json { "specversion": "1.0", "id": "sample-4711", - "source": "https://factory.example.com/line1?wotid=urn:example:pump:7;wotversion=3.0.0;site=north", + "source": "mqtt://site/line/cell/device/sensor", "type": "com.example.models.tm.pump.properties.processData.v1", "subject": "#/properties/processData", "datacontenttype": "application/json", - "dataschema": "https://example.com/schemas/pump-process-data/versions/3", + "contexturl": "https://registry.example/contextgroups/line1/contexts/pump-process-data/versions/1", "data": { "Speed": 1500, "Pressure": 4.5 @@ -311,17 +367,22 @@ configured resolver selects version `3.0.0` of the resolved TD. } ``` +The Context metadata is shown in the +[Event Context example](context.md#example). Its `emitter` selects the TD, +and its `schema` selects the payload schema. The subject selects the property in that resolved view. The payload directly contains the property's object value without a `processData` wrapper. The separate schema describes that object, not the TD document. Another pump can -use the same event type with a different Thing identity in its `source`. +use the same event type with a different Thing identity in its `source` and a +Context whose `emitter` describes that pump. ### Whole Thing -This CloudEvent carries aggregated data for the same pump. Its unversioned -source selects the current default resolved TD, which this example assumes is -version `3.0.0`. The publication profile defines a payload containing the -`processData` and `running` property values. The subject selects the whole TD. +This CloudEvent carries aggregated data for the same pump without +`contexturl`. Its unversioned source selects the current default resolved TD, +which this example assumes is version `3.0.0`. The publication profile defines +a payload containing the `processData` and `running` property values. The +subject selects the whole TD. ```json { From 6f3f097d548a71bcf7befd06fdd8b6c7af2fac2c Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 12 Nov 2026 12:24:33 +0100 Subject: [PATCH 17/60] docs: require WoT event context Signed-off-by: Marc --- cloudevents/extensions/context.md | 4 +- cloudevents/extensions/data-classification.md | 9 +- cloudevents/extensions/opcua.md | 281 +++++++++++------- cloudevents/extensions/wot.md | 253 +++++----------- 4 files changed, 241 insertions(+), 306 deletions(-) diff --git a/cloudevents/extensions/context.md b/cloudevents/extensions/context.md index 10463ca9c..b01fa463f 100644 --- a/cloudevents/extensions/context.md +++ b/cloudevents/extensions/context.md @@ -149,8 +149,8 @@ the same schema when several are supplied. Consumers apply the precedence without comparing the sources. An `emitter` Reference does not authenticate the event or redefine `source`. -The [WoT profile](wot.md) defines how it selects a Thing Description (TD) when -this extension is used. The +The [WoT profile](wot.md) requires this extension and defines how `emitter` +selects a Thing Description (TD). The [OPC UA extension](opcua.md#shared-stream-metadata-in-a-context) defines which stream metadata can be supplied by a Context. Neither rule applies to generic events merely because they contain `contexturl`. diff --git a/cloudevents/extensions/data-classification.md b/cloudevents/extensions/data-classification.md index 53e52c697..e1d10a13e 100644 --- a/cloudevents/extensions/data-classification.md +++ b/cloudevents/extensions/data-classification.md @@ -96,10 +96,11 @@ Examples where data classification of events can be useful are: ## Appendix: Data Protection and Privacy Regulations -[UNCTAD (United Nations Conference on Trade and -Development)](https://unctad.org/page/data-protection-and-privacy-legislation-worldwide) -provides a [catalog of legislation by country](https://storage.unctad.org/2026-cyberlaw_tracker/assets/data/document_links.json), -including data protection and privacy regulations. +For reference purposes, a catalog of common data protection and privacy +regulation and abbreviations is available from [UNCTAD +(United Nations Conference on Trade and +Development)](https://unctad.org/page/data-protection-and-privacy-legislation-worldwide). +Others might exist. Some examples include: - `GDPR` - General Data Protection Regulation, Europe diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 3fba9dd3d..e6daeb4d4 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -9,9 +9,10 @@ attributes. When used with the [Event Context extension](context.md) and the xRegistry Context model, metadata that stays constant for a message stream is preferably stored in the Context rather than repeated in each event. The existing OPC UA -attributes remain defined and usable. The -[shared metadata rules](#shared-stream-metadata-in-a-context) describe how a -Consumer obtains omitted values from the Context. +attributes remain defined and usable. Publisher and writer metadata can +instead be supplied in the `source` query when the Context does not provide +it. The [shared metadata rules](#shared-stream-metadata-in-a-context) describe +how a Consumer obtains these values. ## Notational Conventions @@ -35,19 +36,19 @@ field `MessageId`. ### source -Without the WoT profile, MUST either map to [Application -Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) -field `applicationUri` of the OPC UA server or to a customer configured -identifier like a unified namespace path. - -With the WoT profile, MUST follow its `source` mapping. +An OPC UA source can identify the OPC UA server using its +[Application Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) +field `applicationUri` or a customer configured identifier like a unified +namespace path. It can include the publisher and writer query parameters +defined in this extension or follow the WoT profile's `source` mapping. ### type -Without the WoT profile, MUST map to +An OPC UA `type` can map to the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) -field `MessageType`. With the WoT profile, MUST follow its semantic event-type -rules. +field `MessageType` or follow the WoT profile's semantic event-type rules. +When the `type` identifies a WoT event contract, `opcuamessagetype` can carry +the native `MessageType`. ### WoT mapping @@ -55,13 +56,15 @@ When a CloudEvent uses both this extension and the [WoT profile](./wot.md), the following mappings apply to data and event messages: -- `source` MUST follow the WoT profile's Thing identity and version rules. +- `source` MUST follow the WoT profile's source mapping. - `type` MUST follow the WoT profile's semantic event-type rules instead of mapping to the native `MessageType`. -- `opcuamessagetype` MUST carry the native `MessageType`. +- The native `MessageType` MUST be supplied as `opcuamessagetype` in the event + or Context. - `subject` MUST follow the WoT profile's resolved-TD pointer rules. -- `opcuadatasetwriterid` and `opcuadatasetwritername`, when present, MUST - identify the native DataSetWriter; neither MAY be appended to `subject`. +- Publisher and writer metadata supplied in `source` or the Context MUST + identify the native Publisher and DataSetWriter. Writer identifiers MUST NOT + be appended to `subject`. - For data and event messages, at least one of `opcuadatasetwriterid` and `opcuadatasetwritername` MUST be present. If both are present, they MUST identify the same DataSetWriter. @@ -73,9 +76,10 @@ messages: requirements of the Sequence extension and MUST NOT be inferred from `opcuasequence`. -The Context rules below allow stable OPC UA values to be supplied by a -Context instead of a per-event attribute. They do not relocate `source`, -`type`, or `subject`, and they do not change how those Core attributes map. +The [publisher and writer metadata rules](#publisher-and-writer-metadata) +define the source-query and Context representations of these identifiers. +They do not relocate `source`, `type`, or `subject`, and they do not change +how those Core attributes map. These conditional mappings replace only the conflicting OPC UA mappings above. All other requirements in this extension remain applicable. A profile that @@ -108,15 +112,14 @@ the Context supplies the schema. ### subject -When the WoT profile is not used, the following OPC UA mappings apply: - -For metadata, event and data messages (type one of `ua-metadata`, `ua-keyframe`, -`ua-deltaframe`, `ua-event`), `subject` MUST map to either [Data Set Message +For metadata and data messages, an OPC UA-specific mapping can use +`DataSetWriterId` or `DataSetWriterName` from the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) -field `DataSetWriterId` or `DataSetWriterName`. +as `subject`. A publisher using the WoT profile can instead use its +resolved-TD pointer mapping. -For event messages (type equals to `ua-event`) `subject` MUST be appended with -"/" and [Base Event Type](https://reference.opcfoundation.org/Core/Part5/v104/docs/6.4.2) +For an OPC UA event message (`type` equals `ua-event`), `subject` can be +appended with "/" and the [Base Event Type](https://reference.opcfoundation.org/Core/Part5/v104/docs/6.4.2) field `EventId`. ### time @@ -205,49 +208,6 @@ CloudEvents `Integer` is limited to the signed 32-bit range. If a native status value cannot be represented, the Producer MUST report an error rather than omit the status, wrap the value, or report it as _Good_. -### opcuapublisherid - -- Type: `String` -- Description: Identifies the OPC UA PubSub PublisherId. -- Constraints - - OPTIONAL - - If present, MUST use `:`. - - For `Byte`, `UInt16`, `UInt32` and `UInt64`, `` MUST be the - canonical unsigned decimal representation of the PublisherId. - - For `Guid`, `` MUST be the lowercase canonical UUID representation - of the PublisherId. - - For `String`, `` MUST be the unpadded base64url encoding of the - PublisherId's UTF-8 bytes. - - In combination with the WoT profile, REQUIRED for data and event - messages. - - MUST map to the Network Message Header `PublisherId`. - -### opcuadatasetwriterid - -- Type: `Integer` -- Description: Identifies the DataSetWriter that produced the DataSetMessage. -- Constraints - - OPTIONAL - - If present, MUST be in the range 0 to 65535, inclusive. - - MUST map to the Data Set Message Header `DataSetWriterId`. - -### opcuadatasetwritername - -- Type: `String` -- Description: Carries the human-readable name of the DataSetWriter that - produced the DataSetMessage. -- Constraints - - OPTIONAL - - If present, MUST be non-empty. - - MUST match the DataSetWriter's configured `DataSetWriterName`. For JSON - message mapping, this is the [`DataSetWriterName` field][UA DataSetWriterName] - when present in the DataSetMessage; otherwise the publisher obtains it - from configuration. - - In combination with the WoT profile, MUST uniquely identify the - DataSetWriter within the configured `opcuapublisherid` scope. - - In combination with the WoT profile, names MUST be compared exactly, - without case folding or Unicode normalization. - ### opcuamessagetype - Type: `String` @@ -255,8 +215,8 @@ than omit the status, wrap the value, or report it as _Good_. identifies a WoT semantic event type. - Constraints - OPTIONAL - - In combination with the WoT profile, REQUIRED for data and event - messages. + - In combination with the WoT profile, the value is REQUIRED for data and + event messages, in the event or Context. - MUST map to the Data Set Message Header `MessageType`. - The value MUST be the native OPC UA message type, such as `ua-keyframe`, `ua-deltaframe` or `ua-event`. @@ -278,6 +238,91 @@ than omit the status, wrap the value, or report it as _Good_. - MUST NOT be interpreted as a source-wide sequence unless it also independently satisfies the Sequence extension's requirements. +## Publisher and Writer Metadata + +The following values identify the OPC UA Publisher and DataSetWriter. They +are not CloudEvents extension attributes. A Producer MAY supply them as +query parameters in `source`, as extension attributes of the applicable +Context Version, or in both places. The names are the same in both +representations. + +| Name | Value | +| --- | --- | +| `opcuapublisherid` | The native PublisherId, represented as a string. | +| `opcuadatasetwriterid` | The native DataSetWriterId, represented as an integer. | +| `opcuadatasetwritername` | The configured DataSetWriterName, represented as a string. | + +`opcuapublisherid` MUST use `:`. The type MUST be `Byte`, +`UInt16`, `UInt32`, `UInt64`, or `String`, as defined for the native +[PublisherId][UA PublisherId]. For an unsigned integer type, the value MUST be +the nonzero unsigned decimal representation within that type's range, without +a sign or leading zeros. For `String`, the value MUST be the unpadded base64url +encoding of the non-empty PublisherId's UTF-8 bytes. If the message encoding +does not preserve the PublisherId's type, the Producer obtains it from +configuration. If the type cannot be determined, the Producer MUST report an +error rather than assign one. + +`opcuadatasetwriterid` MUST map to the native DataSetWriterId. It MUST be in +the range 1 to 65535, inclusive; [OPC UA reserves zero][UA DataSetWriterId] +as a null value. +`opcuadatasetwritername` MUST be non-empty and match the DataSetWriter's +configured name. For JSON message mapping, this is the +[`DataSetWriterName` field][UA DataSetWriterName] when present in the +DataSetMessage; otherwise the Producer obtains it from configuration. + +In combination with the WoT profile, `opcuapublisherid` and at least one of +`opcuadatasetwriterid` and `opcuadatasetwritername` are REQUIRED for data and +event messages. If both writer values are supplied, they MUST identify the +same DataSetWriter. A writer name MUST uniquely identify the DataSetWriter +within the PublisherId scope. Consumers MUST compare names exactly, without +case folding or Unicode normalization. + +A Consumer MUST report invalid metadata and MUST NOT interpret the payload as +a conforming OPC UA message if a supplied publisher or writer value violates +these representation or range constraints. + +### Source query syntax + +When these values are supplied in `source`, the query parameters carry +stream-constant metadata. The Producer SHOULD omit a query parameter when the +Context supplies its value. If the Context does not supply a value REQUIRED by +the mapping, the Producer MUST supply it in `source`. + +The Producer MUST use `name=value` for each of these parameters, with a +non-empty value. It MUST separate them from each other and from preceding +query content with `;`, and place the query before any URI fragment. The three +names are case-sensitive and MUST appear literally, at most once each. Other +parameters MAY appear in any order; a Consumer MUST NOT reject the source +solely because it contains parameters not defined by this extension. + +For these parameter values, the unescaped characters are the [RFC 3986][URI] +`unreserved` characters and `!`, `$`, `'`, `(`, `)`, `*`, `,`, `:`, `@`, +`/`, and `?`. A Producer MUST leave these characters unescaped and +percent-encode the UTF-8 bytes of all other characters using uppercase +hexadecimal digits. In particular, a literal `%`, `;`, `=`, `&`, `+`, or `#` +MUST be encoded. A Producer MUST NOT use form-query encoding or encode a space +as `+`. + +A Consumer MUST split the query at `;` before decoding these values. It MUST +reject an empty or duplicate recognized parameter, an invalid percent escape, +invalid UTF-8, or an unescaped character outside the permitted set. It MUST +percent-decode each value exactly once and MUST NOT interpret `+` as a space. +The writer ID uses unsigned decimal notation without a sign or leading zeros +in the query and an integer in the Context; the other two values use strings +in both places. + +For example, the following source supplies the PublisherId and writer name +when the Context does not supply them. The writer name is `Pump&Process`. + +```text +mqtt://site/line/cell/device/sensor?opcuapublisherid=UInt16:12;opcuadatasetwritername=Pump%26Process;site=north +``` + +Changing `source`, including its query parameters, changes the CloudEvents +event-identity and [Sequence extension](sequence.md) scope. A Producer MUST +NOT reuse event identities or restart a claimed source-wide sequence when it +returns to a previously used `source`. + ## General Constraints - OPC UA messages MUST use `binary-mode` of CloudEvents. @@ -285,7 +330,8 @@ than omit the status, wrap the value, or report it as _Good_. the decoding information is contained in metadata messages or by schema referenced via `dataschema` attribute or selected through Event Context. - Payload of OPC UA PubSub JSON messages MUST NOT contain Network Message Header -and Data Set Header as that information is mapped into CloudEvents attributes. +and Data Set Header as that information is mapped into CloudEvents attributes, +`source`, or the Context. - OPC UA PubSub JSON messages MUST contain exactly one dataset message. ## Shared Stream Metadata in a Context @@ -297,11 +343,10 @@ topic or a CloudEvents `source`; either can carry several streams. When Producers and Consumers agree to use this extension with the [Event Context extension](context.md), the Context Publisher SHOULD store metadata that is constant for the stream as Context Version extension -attributes. Each event then carries `contexturl`. The attributes defined in -[Attributes](#attributes) remain valid in events, but storing stream-constant -values once in the Context is preferable because events no longer repeat them, -which keeps messages small. The Context has no document body: these -values are members of its metadata object, alongside `references`. +attributes. Each event then carries `contexturl`. Storing stream-constant +values once in the Context avoids repeating them in event attributes or the +`source` query. The Context has no document body: these values are members +of its metadata object, alongside `references`. The following values can be supplied by the Context when they remain constant for every event using that Context Version. When a Context supplies any of @@ -318,28 +363,32 @@ processed. | `opcuametadataminorversion` | The MinorVersion of the applicable native metadata, when no payload schema is selected. | | `opcuamessagetype` | The native MessageType, only for a stream restricted to one message type. Streams that mix keyframes, deltaframes, or events retain it in each event. | -These members MUST use the CloudEvents types, value constraints, and native -field mappings defined in [Attributes](#attributes). For example, a Context's -`opcuadatasetwriterid` is a JSON integer, not a string. The Context's `schema` -Reference, rather than a new OPC UA attribute, identifies an external payload -schema. Native metadata-version attributes MUST NOT be supplied in the event -or Context when a schema is selected through `dataschema` or the Context. - -For these listed attributes, a value supplied by an applicable Context -satisfies this extension's presence requirements, including those of the -combined WoT mapping. A Producer MAY omit the corresponding event attribute. -All existing attribute definitions remain unchanged for events that do not -use this Context mapping. - -The Consumer uses an event attribute when it is present, otherwise the value -in the Context. If both are present, they MUST have the same typed value. If -they disagree, the Consumer MUST report a metadata conflict and MUST NOT -interpret the payload using that Context. If a REQUIRED value is absent from -both, the Consumer MUST report missing metadata and MUST NOT interpret the -payload as a conforming OPC UA message. A Consumer that cannot retrieve the -Context MAY process the event using only its explicit attributes if they -satisfy every applicable requirement, including the WoT resolution rules when -that profile is used. +These members MUST use the value constraints and native field mappings +defined in [Attributes](#attributes) and +[Publisher and Writer Metadata](#publisher-and-writer-metadata). For example, +a Context's `opcuadatasetwriterid` is a JSON integer, not a string. The +Context's `schema` Reference identifies an external payload schema. Native +metadata-version attributes MUST NOT be supplied in the event or Context +when a schema is selected through `dataschema` or the Context. + +A value supplied by an applicable Context satisfies this extension's presence +requirements, including those of the combined WoT mapping. A Producer MAY +omit an event attribute or source query parameter when the Context supplies +the corresponding value. The existing OPC UA event attributes remain valid. + +If a publisher or writer value appears in both the `source` query and the +Context, the values MUST agree after decoding and type conversion. If an event +attribute and the Context both supply a metadata version or message type, +their typed values MUST agree. On a conflict, the Consumer MUST report a +metadata conflict and MUST NOT interpret the payload using that Context. If a +REQUIRED value is absent from all applicable locations, the Consumer MUST +report missing metadata and MUST NOT interpret the payload as a conforming +OPC UA message. + +A Consumer that cannot retrieve the Context MAY process the event using +its source query and explicit event attributes if they satisfy every applicable +requirement. When the WoT profile is used, the Consumer also needs the Context +to resolve the TD and MUST follow the WoT profile's failure rules. The Context Publisher MUST NOT change these values in a Context Version after any Producer is configured with its URL. A change requires a new Context Version @@ -357,9 +406,9 @@ values. Core attributes retain their normal placement and meaning even when their values happen to be constant for a stream. Without a `contexturl`, no Context supplies missing OPC UA values. This -preserves the existing mapping for Consumers that do not support indirection. -Producers SHOULD use omission only when they know that the intended Consumers -support this mapping; retaining explicit OPC UA attributes remains valid. +preserves the existing event attributes and lets a Producer supply publisher +and writer metadata in the `source` query. Producers SHOULD use Context +metadata only when they know that the intended Consumers support this mapping. ## Examples @@ -561,12 +610,13 @@ recordedtime: 2024-03-28T23:59:59Z ### WoT and OPC UA telemetry message This binary-mode keyframe uses the WoT event type and affordance subject. -Its Context supplies the resolved TD, payload schema, PublisherId, and -DataSetWriterName. The native OPC UA message type and sequence remain in the -event because they can vary within this stream. The example assumes that -`PumpProcessData` uniquely identifies a writer within -publisher `UInt16:12`. The CloudEvents `sequence` attribute is absent because -this example does not define a source-wide ordering across DataSetWriters. +Its Context supplies the resolved TD, payload schema, and PublisherId. The +`source` query supplies the DataSetWriterId because the Context does not +identify the writer. The native OPC UA message type and sequence remain in the +event because they can vary within this stream. The example uses writer ID +`17` within publisher `UInt16:12`. The CloudEvents `sequence` attribute is +absent because this example does not define a source-wide ordering across +DataSetWriters. ```text ------------------ PUBLISH ------------------- @@ -578,7 +628,7 @@ Content Type: application/json specversion: 1.0 id: ua-message-25460 -source: mqtt://site/line/cell/device/sensor +source: mqtt://site/line/cell/device/sensor?opcuadatasetwriterid=17;site=north type: com.example.models.tm.pump.properties.processData.v1 subject: #/properties/processData time: 2026-10-29T12:00:00Z @@ -611,14 +661,14 @@ metadata is omitted from this excerpt. "url": "https://example.com/schemas/pump-process-data/versions/3" } }, - "opcuapublisherid": "UInt16:12", - "opcuadatasetwritername": "PumpProcessData" + "opcuapublisherid": "UInt16:12" } ``` -The Consumer uses the Context's PublisherId and writer name together with the -event's `opcuamessagetype` and `opcuasequence`. It evaluates `subject` against -the TD selected by `emitter` and uses the schema selected by `schema`. +The Consumer uses the writer ID from `source` and the PublisherId from the +Context with the event's `opcuamessagetype` and `opcuasequence`. It evaluates +`subject` against the TD selected by `emitter` and uses the schema selected by +`schema`. ## Context Retrieval Security @@ -628,4 +678,7 @@ the Publisher or authorize access to the referenced TD or schema. A Consumer MUST establish trust in the Context before using it as OPC UA metadata. [UA DataSetWriterName]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table185 +[UA DataSetWriterId]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.4.1 +[UA PublisherId]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.7.1 [UA SequenceNumber]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.3 +[URI]: https://www.rfc-editor.org/rfc/rfc3986 diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 55b4d2b09..4ddf22740 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -2,16 +2,15 @@ This profile maps a [Web of Things Thing Description][TD] (TD) to CloudEvents Core context attributes and the [Event Context extension](context.md). -The `contexturl` identifies shared metadata whose `emitter` Reference selects -the resolved TD. The `subject` identifies the part of that TD associated with -the event, and the `type` names the event contract. Without `contexturl`, the -`source` query parameters select the Thing and its resolved TD. +The REQUIRED `contexturl` identifies shared metadata whose `emitter` Reference +selects the resolved TD. The `subject` identifies the part of that TD associated +with the event, and the `type` names the event contract. The profile defines no CloudEvents extension attributes or URI scheme. Producers and Consumers agree on its use through a publication profile or out of band. It does not define a transport binding, provision a Thing, or require -a particular registry implementation. Events with `contexturl` use the -xRegistry Context representation. +a particular registry implementation. Events use the xRegistry Context +representation defined by the Event Context extension. ## Notational Conventions @@ -25,113 +24,23 @@ attribute marked REQUIRED here is not REQUIRED in every CloudEvent. ## Source -The Core [`source`](../spec.md#source) identifies a Thing within the Producer's -chosen context. With `contexturl`, it follows Core's URI-reference rules and -does not need `wotid` or `wotversion`. The Context's `emitter` Reference, not -the `source`, selects the resolved TD. +The Core [`source`](../spec.md#source) identifies the context in which the +event occurred and follows Core's URI-reference rules. It can identify a Thing, +topology, publisher, or another Producer-defined context. This profile does not +prescribe a URI scheme or query parameters. The Context's `emitter` Reference, +not `source`, selects the resolved TD. -Without `contexturl`, `source` MUST contain the `wotid` query parameter and MAY -contain `wotversion` and additional parameters. This profile does not prescribe -the URI scheme or the rest of the URI-reference. Core permits relative -URI-references and recommends an absolute URI. - -For example: - -```text -https://factory.example.com/line1?wotid=urn:example:pump:7;wotversion=3.0.0;site=north -``` - -The `site` parameter is defined by the Producer, not this profile. An HTTPS -source is an identifier and is not necessarily a retrieval URL for a TD. - -An MQTT source identifier can use the same query parameters: - -```text -mqtt://site/line/cell/device/sensor?wotid=urn:example:sensor:7;wotversion=3.0.0 -``` - -Another possible form is: - -```text -wot-td://factory/line1?wotid=urn:example:pump:7;wotversion=3.0.0 -``` - -This profile does not define the `wot-td` scheme or propose its registration. -The part of `source` outside the standardized parameters can identify a -topology, publisher, or another Producer-defined context. This profile does -not prescribe its structure or derive a TD retrieval location from it. - -### Query syntax and encoding - -This subsection applies when the event has no `contexturl`. - -The `source` query uses `;` as the parameter separator. This profile -standardizes two query parameters, not CloudEvents attributes: `wotid` is -REQUIRED and appears first; `wotversion` is OPTIONAL and, when present, -immediately follows `wotid`. Their names are case-sensitive and MUST appear -literally. Each MUST use `name=value` with a non-empty value. `wotid` MUST -appear exactly once, and `wotversion` MUST NOT appear more than once. - -A Producer MAY include additional parameters after the standardized parameters. -This profile does not assign them a meaning; a publication contract MAY define -their semantics. A Consumer MUST NOT reject a source solely because it contains -parameters not defined by this profile. - -For the standardized values, the unescaped characters are the -[RFC 3986][URI] `unreserved` characters and `!`, `$`, `'`, `(`, `)`, `*`, -`,`, `:`, `@`, `/`, and `?`. A Producer MUST leave these characters -unescaped. It MUST percent-encode the UTF-8 bytes of all other characters using -uppercase hexadecimal digits. In particular, a literal `%`, `;`, `=`, `&`, -`+`, or `#` in a standardized value MUST be encoded. A Producer MUST NOT use -form-query encoding or encode a space as `+` for those values. - -A Consumer MUST split the query at `;` before decoding the standardized values. -It MUST reject a missing or empty `wotid`, an empty `wotversion`, a duplicate -standardized parameter, or a standardized parameter in the wrong position. For -a standardized value, it MUST reject an invalid percent escape, invalid UTF-8, -or an unescaped character outside the permitted set. It MUST percent-decode -each standardized value exactly once and MUST NOT interpret `+` as a space. - -For example, an identifier containing U+00E9 followed by the literal characters -`%2F` encodes that portion as `%C3%A9%252F`. One decoding pass recovers the -original characters, including the literal `%2F`; it does not turn them into -a slash. - -### Thing identity and version - -This subsection applies to selection through `source` when the event has no -`contexturl`. - -The decoded `wotid` MUST be a non-empty absolute IRI as defined in -[RFC 3987][IRI]. When the authored TD has an `id`, `wotid` MUST equal that -value verbatim and the resolved TD MUST retain it. When the authored TD has -no `id`, the publication contract MUST assign a stable absolute WoT identity -for the Thing. Publishing another version MUST NOT by itself change that -identity. - -The OPTIONAL `wotversion` selects one exact version of the resolved TD within -the configured resolution scope. It is not a version range, the CloudEvents -`specversion`, a WoT vocabulary version, or a payload-schema version. Its -meaning is defined by the publication contract; a Consumer MUST NOT substitute -a different version when the requested version is unavailable. Selecting that -version does not by itself establish the compatibility of its dependencies. - -An explicit version identifies a stable resolved view. A Producer MUST NOT -change the logical view identified by a published version. It MUST publish a -new version when the view changes, including changes introduced by its source -closure. A serialization or formatting change alone does not require a new -version. - -When `wotversion` is absent, the Consumer resolves the current default view. -That default can change, so a delayed event can resolve to a different view -than the one available when the event was produced. A publication profile -that requires repeatable replay MUST require `wotversion`. +For example, a Producer can use `https://factory.example.com/line1/pump7` or +`mqtt://site/line/cell/device/sensor` as a source. Another possible form is +`wot-td://factory/line1`; this profile does not define that scheme or propose +its registration. A source is an identifier and is not necessarily a retrieval +URL for a TD. ### Event identity Core requires `source` and `id` together to identify each distinct event. -Changing the `source`, including its context, version, or other parameters, -changes the event identity and [Sequence extension](sequence.md) scope. +Changing the `source`, including any query parameters, changes the event +identity and [Sequence extension](sequence.md) scope. Returning to an earlier `source` returns to its existing scope: Producers MUST NOT reuse event identities or restart a claimed source-wide sequence within that scope. @@ -142,27 +51,25 @@ because it publishes a new Context Version. ## Resolving the Thing Description -### With Event Context - -When `contexturl` is present, the Producer and Consumer MUST use the -[Event Context extension](context.md). The Context MUST contain an `emitter` -Reference whose `url` identifies the resolved TD document, not its Registry -metadata. The Context Publisher SHOULD reference an explicit TD Version and -publish the resolved TD view at that URL. The Consumer retrieves the document -directly or uses the corresponding document in an accepted resolved Context -view. It MUST NOT derive a TD URL from `contexturl` or from the `emitter` URL. +Every event using this profile MUST include `contexturl`. The Producer and +Consumer MUST implement the [Event Context extension](context.md). The Context +MUST contain an `emitter` Reference whose `url` identifies the resolved TD +document, not its Registry metadata. The Context Publisher SHOULD reference an +explicit TD Version and publish the resolved TD view at that URL. The Consumer +retrieves the document directly or uses the corresponding document in an +accepted resolved Context view. It MUST NOT derive a TD URL from `contexturl` +or from the `emitter` URL. The Context's `emitter` is authoritative for TD selection. The Consumer MUST -evaluate `subject` against that TD, even if an interpretation of `source`, -including `wotid` or `wotversion` query parameters, would select another TD. -Those parameters do not select a TD in this mode. This rule does not change -Core's meaning of `source` or authenticate the emitting entity. +evaluate `subject` against that TD and MUST NOT select another TD from `source`. +This rule does not change Core's meaning of `source` or authenticate the +emitting entity. -If the Context cannot be retrieved or is invalid, or its `emitter` Reference -is missing or invalid, or the referenced TD is unavailable or not resolved, -the Consumer MUST report a resolution failure and leave the event uncorrelated. -It MUST NOT fall back to selection through `source`. It MAY retain or forward -the event without TD-based interpretation. +If `contexturl` is missing, the Context cannot be retrieved or is invalid, its +`emitter` Reference is missing or invalid, or the referenced TD is unavailable +or not resolved, the Consumer MUST report a resolution failure and leave the +event uncorrelated. It MUST NOT fall back to selection through `source`. It +MAY retain or forward the event without TD-based interpretation. The Context Publisher MUST make the TD available before configuring Producers with the Context Version URL. Changes to its Reference require a new Context @@ -171,44 +78,6 @@ the Context Publisher MUST NOT change that view at a previously published Version URL. Context versioning alone does not make an unversioned TD URL stable. -### Without Event Context - -The Producer and Consumer MUST agree on a resolver and its scope out of band -or through their publication profile. The scope selects a registry and Group, -tenant, or equivalent boundary in which the Thing identity is resolved. This -profile does not prescribe a discovery protocol. - -The resolver MUST find exactly one Resource or equivalent publication for -`wotid` within that scope. It MUST select the exact version named by -`wotversion`, or the current default when the parameter is absent. A missing -or ambiguous match is a resolution failure; selecting the first match does not -establish which Thing the Producer meant. - -The Consumer MUST obtain the resolved TD selected by that publication. It MAY -retrieve a published resolved view or reconstruct the same logical view from -a complete, pinned source closure and the applicable resolution rules. The -closure and rules MUST establish one unambiguous view. The JSON serialization -does not need to be byte-identical. - -If the selected view cannot be retrieved or reconstructed, the Consumer MUST -report a resolution failure and leave the event uncorrelated. It MAY retain -or forward the event without interpreting its payload. The Consumer MUST NOT -claim successful TD-based interpretation when the resolved view or its -identity cannot be established. - -The [xRegistry WoT working draft][WoT Registry] describes one resolution -mechanism. It is a working draft, not a universal dependency of this profile. -In that draft, `wotid` is the WoT identity rather than the Resource ID, and -`wotversion` corresponds to the Resource's exact `versionid`. The default -Version is not necessarily the most recently created Version and MUST NOT be -inferred by sorting version identifiers. - -The draft stores authored documents and describes a publication closure. -Some closure reference mappings remain unresolved; the closure schema alone -does not establish that every resolved view can be reconstructed. Where the -closure and applicable rules cannot establish the view, the publication -contract MUST provide the resolved view for this profile to use it. - The event carries no digest of the TD. An exact version or a successful resolution does not by itself prove that retrieved bytes are unchanged. @@ -275,9 +144,9 @@ ignore the new member. A change to an individual value or the presence of a member already defined as OPTIONAL does not change the contract revision. A change to `contexturl`, its -`emitter` Reference, `wotversion`, or the selected schema alone also does not -change the revision; if it changes the payload contract, the Producer MUST use -a new revision. +`emitter` Reference, or the selected schema alone also does not change the +revision; if it changes the payload contract, the Producer MUST use a new +revision. The Producer MUST configure a valid complete type when the derivation is unavailable, produces an invalid symbol, or collides with a different event @@ -315,10 +184,10 @@ CloudEvent's actual `data` adheres to. [`datacontenttype`](../spec.md#datacontenttype) identifies that data's media type. Neither identifies the TD document's format. -When `contexturl` is present, the Consumer follows the Event Context -extension's schema precedence: `dataschema`, then the Context's `schema` -Reference, then the schema declared by its `message` representation. The -Producer SHOULD omit `dataschema` when the Context supplies the schema. +The Consumer follows the Event Context extension's schema precedence: +`dataschema`, then the Context's `schema` Reference, then the schema declared +by its `message` representation. The Producer SHOULD omit `dataschema` when +the Context supplies the schema. A TD describes interactions and can contain several DataSchemas. The Producer MUST NOT use the whole TD as `dataschema` merely because the TD @@ -336,7 +205,7 @@ The same requirement applies to a schema supplied by the Context. An xRegistry Schema Resource's document-view URL can identify that external schema. It is not the WoT Resource's metadata-view URL. A profile MAY require -an exact schema Version independently of the `wotversion` query parameter. +an exact schema Version independently of the selected TD Version. ### Relationship to Other Extensions @@ -378,21 +247,20 @@ Context whose `emitter` describes that pump. ### Whole Thing -This CloudEvent carries aggregated data for the same pump without -`contexturl`. Its unversioned source selects the current default resolved TD, -which this example assumes is version `3.0.0`. The publication profile defines -a payload containing the `processData` and `running` property values. The -subject selects the whole TD. +This CloudEvent carries aggregated data for the same pump. Its Context +selects version `3.0.0` of the resolved TD and the aggregate payload schema. +The publication profile defines a payload containing the `processData` and +`running` property values. The subject selects the whole TD. ```json { "specversion": "1.0", "id": "sample-4713", - "source": "https://factory.example.com/line1?wotid=urn:example:pump:7;site=north", + "source": "https://factory.example.com/line1/pump7", "type": "com.example.models.tm.pump.v1", "subject": "#", "datacontenttype": "application/json", - "dataschema": "https://example.com/schemas/pump-state/versions/3", + "contexturl": "https://registry.example/contextgroups/line1/contexts/pump-state/versions/1", "data": { "processData": { "Speed": 1500, @@ -403,10 +271,26 @@ subject selects the whole TD. } ``` -The source selects the TD used to interpret these property values. If the -default changes, a later resolution of this event can select another version. -The TD document itself is not the payload. `dataschema` identifies the schema -of the aggregate JSON object, not the TD or either property's DataSchema alone. +The referenced Context Version contains the following metadata. + +```json +{ + "contextid": "pump-state", + "versionid": "1", + "references": { + "emitter": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + }, + "schema": { + "url": "https://example.com/schemas/pump-state/versions/3" + } + } +} +``` + +The `emitter` selects the TD used to interpret these property values. The TD +document itself is not the payload. The `schema` identifies the aggregate JSON +object, not the TD or either property's DataSchema alone. ## Security Considerations @@ -423,7 +307,4 @@ referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model -[IRI]: https://www.rfc-editor.org/rfc/rfc3987 -[URI]: https://www.rfc-editor.org/rfc/rfc3986 [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 -[WoT Registry]: https://github.com/xregistry/spec/blob/main/workingdrafts/models/wot/spec.md From 88e6152fd9c5ccb447c803498638cba562499e77 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 12 Nov 2026 12:27:55 +0100 Subject: [PATCH 18/60] docs(opcua): make mapping choices normative Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index e6daeb4d4..5a7501090 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -36,19 +36,21 @@ field `MessageId`. ### source -An OPC UA source can identify the OPC UA server using its +An OPC UA Producer MAY identify the server using its [Application Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) -field `applicationUri` or a customer configured identifier like a unified -namespace path. It can include the publisher and writer query parameters -defined in this extension or follow the WoT profile's `source` mapping. +field `applicationUri` or a customer-configured identifier such as a unified +namespace path. A Producer MAY include the publisher and writer query +parameters defined in this extension. A Producer using the WoT profile MAY +instead follow its `source` mapping. ### type -An OPC UA `type` can map to the +An OPC UA Producer MAY map `type` to the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) -field `MessageType` or follow the WoT profile's semantic event-type rules. -When the `type` identifies a WoT event contract, `opcuamessagetype` can carry -the native `MessageType`. +field `MessageType`. A Producer using the WoT profile MUST follow its semantic +event-type rules. In that case, the Producer MUST supply the native +`MessageType` as `opcuamessagetype` in the event or Context, as specified in +the WoT mapping section. ### WoT mapping @@ -112,14 +114,15 @@ the Context supplies the schema. ### subject -For metadata and data messages, an OPC UA-specific mapping can use +For metadata and data messages, a Producer MAY map `subject` to `DataSetWriterId` or `DataSetWriterName` from the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) -as `subject`. A publisher using the WoT profile can instead use its +header. A Producer using the WoT profile MUST instead follow its resolved-TD pointer mapping. -For an OPC UA event message (`type` equals `ua-event`), `subject` can be -appended with "/" and the [Base Event Type](https://reference.opcfoundation.org/Core/Part5/v104/docs/6.4.2) +For an OPC UA event message (`type` equals `ua-event`), a Producer using the +OPC UA-specific `subject` mapping MUST append "/" and the +[Base Event Type](https://reference.opcfoundation.org/Core/Part5/v104/docs/6.4.2) field `EventId`. ### time From 4ad755ab4b43d2dfe47bf88835ef3ed465456222 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 12 Nov 2026 12:30:05 +0100 Subject: [PATCH 19/60] docs(opcua): recommend WoT message type mapping Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 5a7501090..e52648110 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -48,9 +48,10 @@ instead follow its `source` mapping. An OPC UA Producer MAY map `type` to the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) field `MessageType`. A Producer using the WoT profile MUST follow its semantic -event-type rules. In that case, the Producer MUST supply the native -`MessageType` as `opcuamessagetype` in the event or Context, as specified in -the WoT mapping section. +event-type rules. When the `type` identifies a WoT event contract, a Producer +SHOULD carry the native `MessageType` as `opcuamessagetype` in the event or +Context. The [WoT mapping section](#wot-mapping) requires it when both +profiles are used. ### WoT mapping From d7e4c23918ad4d4c0b0fc2e60ab0953a5c0bb9be Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 12 Nov 2026 12:37:25 +0100 Subject: [PATCH 20/60] docs(opcua): keep message type in each event Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index e52648110..d411e3f26 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -49,8 +49,8 @@ An OPC UA Producer MAY map `type` to the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) field `MessageType`. A Producer using the WoT profile MUST follow its semantic event-type rules. When the `type` identifies a WoT event contract, a Producer -SHOULD carry the native `MessageType` as `opcuamessagetype` in the event or -Context. The [WoT mapping section](#wot-mapping) requires it when both +SHOULD carry the native `MessageType` as `opcuamessagetype` in the event. The +[WoT mapping section](#wot-mapping) requires it when both profiles are used. ### WoT mapping @@ -62,8 +62,7 @@ messages: - `source` MUST follow the WoT profile's source mapping. - `type` MUST follow the WoT profile's semantic event-type rules instead of mapping to the native `MessageType`. -- The native `MessageType` MUST be supplied as `opcuamessagetype` in the event - or Context. +- The native `MessageType` MUST be supplied as `opcuamessagetype` in the event. - `subject` MUST follow the WoT profile's resolved-TD pointer rules. - Publisher and writer metadata supplied in `source` or the Context MUST identify the native Publisher and DataSetWriter. Writer identifiers MUST NOT @@ -220,7 +219,7 @@ than omit the status, wrap the value, or report it as _Good_. - Constraints - OPTIONAL - In combination with the WoT profile, the value is REQUIRED for data and - event messages, in the event or Context. + event messages. - MUST map to the Data Set Message Header `MessageType`. - The value MUST be the native OPC UA message type, such as `ua-keyframe`, `ua-deltaframe` or `ua-event`. @@ -365,7 +364,6 @@ processed. | `opcuadatasetwritername` | The stream's configured DataSetWriterName, when used. | | `opcuametadatamajorversion` | The MajorVersion of the applicable native metadata, when no payload schema is selected. | | `opcuametadataminorversion` | The MinorVersion of the applicable native metadata, when no payload schema is selected. | -| `opcuamessagetype` | The native MessageType, only for a stream restricted to one message type. Streams that mix keyframes, deltaframes, or events retain it in each event. | These members MUST use the value constraints and native field mappings defined in [Attributes](#attributes) and @@ -382,8 +380,8 @@ the corresponding value. The existing OPC UA event attributes remain valid. If a publisher or writer value appears in both the `source` query and the Context, the values MUST agree after decoding and type conversion. If an event -attribute and the Context both supply a metadata version or message type, -their typed values MUST agree. On a conflict, the Consumer MUST report a +attribute and the Context both supply a metadata version, their typed values +MUST agree. On a conflict, the Consumer MUST report a metadata conflict and MUST NOT interpret the payload using that Context. If a REQUIRED value is absent from all applicable locations, the Consumer MUST report missing metadata and MUST NOT interpret the payload as a conforming @@ -402,12 +400,12 @@ payload contract also requires a changed WoT `type` revision when that profile is used; changing only `contexturl` is not sufficient. Values that vary by occurrence remain in each event. In particular, -`opcuasequence`, `opcuastatus` when REQUIRED, `id`, and `time` MUST NOT be -supplied by the Context as replacements for their event attributes. Tracing, -recording times, and a CloudEvents `sequence`, when used, also remain in the -event. A Consumer MUST NOT use Context members with those names as event -values. Core attributes retain their normal placement and meaning even when -their values happen to be constant for a stream. +`opcuamessagetype`, `opcuasequence`, `opcuastatus` when REQUIRED, `id`, and +`time` MUST NOT be supplied by the Context as replacements for their event +attributes. Tracing, recording times, and a CloudEvents `sequence`, when used, +also remain in the event. A Consumer MUST NOT use Context members with those +names as event values. Core attributes retain their normal placement and +meaning even when their values happen to be constant for a stream. Without a `contexturl`, no Context supplies missing OPC UA values. This preserves the existing event attributes and lets a Producer supply publisher From a51945bda3bb239b5311da8534cba50869b8488f Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 12 Nov 2026 12:56:46 +0100 Subject: [PATCH 21/60] docs(opcua): require source metadata when absent elsewhere Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index d411e3f26..428883b1c 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -39,9 +39,11 @@ field `MessageId`. An OPC UA Producer MAY identify the server using its [Application Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) field `applicationUri` or a customer-configured identifier such as a unified -namespace path. A Producer MAY include the publisher and writer query -parameters defined in this extension. A Producer using the WoT profile MAY -instead follow its `source` mapping. +namespace path. A Producer using the WoT profile MAY instead follow its +`source` mapping. For WoT data and event messages, a Producer MUST include +each publisher or writer query parameter REQUIRED by the mapping unless the +full OPC UA Part 14 NetworkMessage envelope or the Context supplies its +corresponding value. ### type @@ -288,8 +290,9 @@ these representation or range constraints. When these values are supplied in `source`, the query parameters carry stream-constant metadata. The Producer SHOULD omit a query parameter when the -Context supplies its value. If the Context does not supply a value REQUIRED by -the mapping, the Producer MUST supply it in `source`. +full OPC UA Part 14 NetworkMessage envelope or the Context supplies its value. +For each value REQUIRED by the WoT mapping that neither supplies, the Producer +MUST include the corresponding parameter in `source`. The Producer MUST use `name=value` for each of these parameters, with a non-empty value. It MUST separate them from each other and from preceding From d997746638cf7cf7cc01d40a4b460547e6320da8 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 12 Nov 2026 12:58:58 +0100 Subject: [PATCH 22/60] docs(opcua): require WoT message type mapping Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 428883b1c..9d4162893 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -51,7 +51,7 @@ An OPC UA Producer MAY map `type` to the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) field `MessageType`. A Producer using the WoT profile MUST follow its semantic event-type rules. When the `type` identifies a WoT event contract, a Producer -SHOULD carry the native `MessageType` as `opcuamessagetype` in the event. The +MUST carry the native `MessageType` as `opcuamessagetype` in the event. The [WoT mapping section](#wot-mapping) requires it when both profiles are used. From b56c2728742b1a5d3fc7c1d4f11dabc00df50ef6 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 12 Nov 2026 13:33:29 +0100 Subject: [PATCH 23/60] docs: address local review feedback on WoT and OPC UA Reorder the WoT profile so Core attribute mappings come first and Context resolution has its own contexturl section. Remove obsolete source-query and custom-scheme wording. Require OPC UA publisher and writer identity for all data and event messages, accept identity from a retained Part 14 NetworkMessage envelope, the source query, or the Context, and define handling for missing or conflicting values. Add a full-envelope example. Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 215 +++++++++++++++++++++++--------- cloudevents/extensions/wot.md | 107 ++++++++-------- 2 files changed, 204 insertions(+), 118 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 9d4162893..457946a2c 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -9,10 +9,11 @@ attributes. When used with the [Event Context extension](context.md) and the xRegistry Context model, metadata that stays constant for a message stream is preferably stored in the Context rather than repeated in each event. The existing OPC UA -attributes remain defined and usable. Publisher and writer metadata can -instead be supplied in the `source` query when the Context does not provide -it. The [shared metadata rules](#shared-stream-metadata-in-a-context) describe -how a Consumer obtains these values. +attributes remain defined and usable. A Producer MUST supply publisher and +writer metadata REQUIRED by this mapping in the `source` query when neither +the full Part 14 NetworkMessage envelope nor the Context provides it. The +[shared metadata rules](#shared-stream-metadata-in-a-context) describe how a +Consumer obtains these values. ## Notational Conventions @@ -39,8 +40,8 @@ field `MessageId`. An OPC UA Producer MAY identify the server using its [Application Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) field `applicationUri` or a customer-configured identifier such as a unified -namespace path. A Producer using the WoT profile MAY instead follow its -`source` mapping. For WoT data and event messages, a Producer MUST include +namespace path. A Producer using the WoT profile MUST instead follow its +`source` mapping. For data and event messages, a Producer MUST include each publisher or writer query parameter REQUIRED by the mapping unless the full OPC UA Part 14 NetworkMessage envelope or the Context supplies its corresponding value. @@ -52,8 +53,7 @@ An OPC UA Producer MAY map `type` to the field `MessageType`. A Producer using the WoT profile MUST follow its semantic event-type rules. When the `type` identifies a WoT event contract, a Producer MUST carry the native `MessageType` as `opcuamessagetype` in the event. The -[WoT mapping section](#wot-mapping) requires it when both -profiles are used. +[WoT mapping section](#wot-mapping) specifies the combined mapping. ### WoT mapping @@ -64,17 +64,13 @@ messages: - `source` MUST follow the WoT profile's source mapping. - `type` MUST follow the WoT profile's semantic event-type rules instead of mapping to the native `MessageType`. -- The native `MessageType` MUST be supplied as `opcuamessagetype` in the event. - `subject` MUST follow the WoT profile's resolved-TD pointer rules. -- Publisher and writer metadata supplied in `source` or the Context MUST - identify the native Publisher and DataSetWriter. Writer identifiers MUST NOT - be appended to `subject`. -- For data and event messages, at least one of `opcuadatasetwriterid` and - `opcuadatasetwritername` MUST be present. If both are present, they MUST - identify the same DataSetWriter. +- The native PublisherId and at least one DataSetWriter identifier MUST be + available from the full Part 14 NetworkMessage envelope, `source`, or the + Context, as defined in [Publisher and Writer Metadata](#publisher-and-writer-metadata). + Writer identifiers MUST NOT be appended to `subject`. - For an event message, the `EventId` remains in the OPC UA event payload and MUST NOT be appended to `subject`. -- `opcuapublisherid` MUST identify the native PublisherId. - `opcuasequence` MUST carry the native `SequenceNumber`. The CloudEvents `sequence` attribute, when present, MUST satisfy the independent ordering requirements of the Sequence extension and MUST NOT be inferred from @@ -84,6 +80,8 @@ The [publisher and writer metadata rules](#publisher-and-writer-metadata) define the source-query and Context representations of these identifiers. They do not relocate `source`, `type`, or `subject`, and they do not change how those Core attributes map. +Native identifiers retained in a full NetworkMessage envelope satisfy the +same presence requirements. These conditional mappings replace only the conflicting OPC UA mappings above. All other requirements in this extension remain applicable. A profile that @@ -109,17 +107,19 @@ separate format like [JSON schema](https://json-schema.org/specification) or [Avro schema](https://avro.apache.org/docs/1.11.1/specification/) or others. For those cases the attribute references the schema and is used for versioning. -When the Event Context extension is used, its `schema` Reference or `message` -representation can supply this schema instead. The Consumer follows that -extension's schema precedence, and the Producer SHOULD omit `dataschema` when -the Context supplies the schema. +When the Event Context extension is used, a Producer MAY reference a Context +whose `schema` Reference or `message` representation supplies this schema +instead. The Consumer follows that extension's schema precedence, and the +Producer SHOULD omit `dataschema` when the Context supplies the schema. The +selected schema MUST describe the actual `data`, including the full +NetworkMessage envelope when one is retained. ### subject -For metadata and data messages, a Producer MAY map `subject` to +For metadata, data, and event messages, a Producer MAY map `subject` to `DataSetWriterId` or `DataSetWriterName` from the [Data Set Message -Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) -header. A Producer using the WoT profile MUST instead follow its +Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164). +A Producer using the WoT profile MUST instead follow its resolved-TD pointer mapping. For an OPC UA event message (`type` equals `ua-event`), a Producer using the @@ -135,9 +135,9 @@ field `Timestamp`. ## Mapping for other extensions -For data and event messages, the following well-known extension attributes -apply when this extension is used without the WoT profile. When both -extensions are used, determine message type from `opcuamessagetype`. +The following well-known extension attributes apply to data and event +messages. When the WoT profile is used, determine the native message type +from `opcuamessagetype`. ### sequence @@ -246,9 +246,10 @@ than omit the status, wrap the value, or report it as _Good_. ## Publisher and Writer Metadata The following values identify the OPC UA Publisher and DataSetWriter. They -are not CloudEvents extension attributes. A Producer MAY supply them as -query parameters in `source`, as extension attributes of the applicable -Context Version, or in both places. The names are the same in both +are not CloudEvents extension attributes. A Producer MUST supply each +REQUIRED value as a query parameter in `source` or an extension attribute of +the applicable Context Version unless the full Part 14 NetworkMessage +envelope supplies it. The names are the same in the query and Context representations. | Name | Value | @@ -257,6 +258,12 @@ representations. | `opcuadatasetwriterid` | The native DataSetWriterId, represented as an integer. | | `opcuadatasetwritername` | The configured DataSetWriterName, represented as a string. | +In a full [Part 14 NetworkMessage][UA NetworkMessage], the Consumer obtains +the PublisherId from the NetworkMessage header and the DataSetWriterId or +DataSetWriterName from its single DataSetMessage header. Those fields retain +their native names and encodings. The following representation rules apply +to their equivalents in `source` and the Context. + `opcuapublisherid` MUST use `:`. The type MUST be `Byte`, `UInt16`, `UInt32`, `UInt64`, or `String`, as defined for the native [PublisherId][UA PublisherId]. For an unsigned integer type, the value MUST be @@ -275,12 +282,22 @@ configured name. For JSON message mapping, this is the [`DataSetWriterName` field][UA DataSetWriterName] when present in the DataSetMessage; otherwise the Producer obtains it from configuration. -In combination with the WoT profile, `opcuapublisherid` and at least one of -`opcuadatasetwriterid` and `opcuadatasetwritername` are REQUIRED for data and -event messages. If both writer values are supplied, they MUST identify the -same DataSetWriter. A writer name MUST uniquely identify the DataSetWriter -within the PublisherId scope. Consumers MUST compare names exactly, without -case folding or Unicode normalization. +The native PublisherId and at least one of DataSetWriterId and DataSetWriterName +are REQUIRED for all data and event messages, whether or not the WoT profile +is used. Each value MUST be supplied by the envelope or by the corresponding +query parameter or Context attribute. A full envelope that omits an identifier +does not satisfy that identifier's presence requirement. If both writer values +are supplied, they MUST identify the same DataSetWriter. A writer name MUST +uniquely identify the DataSetWriter within the PublisherId scope. Consumers +MUST compare names exactly, without case folding or Unicode normalization. + +When an identity is supplied in more than one place, the representations MUST +identify the same native Publisher or DataSetWriter. To compare a query or +Context value with an envelope field, the Consumer MUST decode that value and +apply the field's native Part 14 encoding. For example, `UInt16:12` is encoded +as `"12"` in a JSON NetworkMessage. The Consumer MUST report a metadata +conflict and MUST NOT interpret the payload as a conforming OPC UA message if +the values disagree. A Consumer MUST report invalid metadata and MUST NOT interpret the payload as a conforming OPC UA message if a supplied publisher or writer value violates @@ -291,8 +308,8 @@ these representation or range constraints. When these values are supplied in `source`, the query parameters carry stream-constant metadata. The Producer SHOULD omit a query parameter when the full OPC UA Part 14 NetworkMessage envelope or the Context supplies its value. -For each value REQUIRED by the WoT mapping that neither supplies, the Producer -MUST include the corresponding parameter in `source`. +For each REQUIRED publisher or writer value that neither supplies, the +Producer MUST include the corresponding parameter in `source`. The Producer MUST use `name=value` for each of these parameters, with a non-empty value. It MUST separate them from each other and from preceding @@ -318,7 +335,8 @@ in the query and an integer in the Context; the other two values use strings in both places. For example, the following source supplies the PublisherId and writer name -when the Context does not supply them. The writer name is `Pump&Process`. +when neither the envelope nor the Context supplies them. The writer name is +`Pump&Process`. ```text mqtt://site/line/cell/device/sensor?opcuapublisherid=UInt16:12;opcuadatasetwritername=Pump%26Process;site=north @@ -335,11 +353,20 @@ returns to a previously used `source`. - OPC UA PubSub JSON messages MUST be encoded using non-reversible encoding as the decoding information is contained in metadata messages or by schema referenced via `dataschema` attribute or selected through Event Context. -- Payload of OPC UA PubSub JSON messages MUST NOT contain Network Message Header -and Data Set Header as that information is mapped into CloudEvents attributes, -`source`, or the Context. +- A Producer MAY retain the full Part 14 NetworkMessage envelope in `data`. + Otherwise, the payload MUST omit the NetworkMessage and DataSetMessage + headers and supply their applicable information through the mappings in + this extension. - OPC UA PubSub JSON messages MUST contain exactly one dataset message. +A retained envelope does not replace the REQUIRED CloudEvents attributes or +the per-event `opcuamessagetype` and `opcuasequence` attributes when the WoT +mapping applies. `opcuamessagetype` identifies the DataSetMessage type, not +the enclosing NetworkMessage's `ua-data` type. Duplicated values MUST agree +with their native fields after applying the specified mappings. The Consumer +MUST report a conflict and MUST NOT interpret a message as conforming to this +extension when they disagree. + ## Shared Stream Metadata in a Context A message stream here is a configured flow from one Publisher and @@ -354,11 +381,11 @@ values once in the Context avoids repeating them in event attributes or the `source` query. The Context has no document body: these values are members of its metadata object, alongside `references`. -The following values can be supplied by the Context when they remain constant -for every event using that Context Version. When a Context supplies any of -these values, `contexturl` MUST identify a Context Version. A Context Resource -URL can select a different default Version when a delayed or replayed event is -processed. +The Context Publisher MAY store the following values in the Context when they +remain constant for every event using that Context Version. When a Context +supplies any of these values, `contexturl` MUST identify a Context Version. +A Context Resource URL can select a different default Version when a delayed +or replayed event is processed. | Context attribute | Meaning and conditions | | --- | --- | @@ -376,24 +403,26 @@ Context's `schema` Reference identifies an external payload schema. Native metadata-version attributes MUST NOT be supplied in the event or Context when a schema is selected through `dataschema` or the Context. -A value supplied by an applicable Context satisfies this extension's presence -requirements, including those of the combined WoT mapping. A Producer MAY -omit an event attribute or source query parameter when the Context supplies -the corresponding value. The existing OPC UA event attributes remain valid. +For the listed values, an applicable Context satisfies this extension's +presence requirements, including those of the combined WoT mapping. A Producer +MAY omit the corresponding event attribute or source query parameter. Other +event attributes, including `opcuamessagetype`, MUST NOT be replaced by Context +members. If a publisher or writer value appears in both the `source` query and the Context, the values MUST agree after decoding and type conversion. If an event attribute and the Context both supply a metadata version, their typed values -MUST agree. On a conflict, the Consumer MUST report a -metadata conflict and MUST NOT interpret the payload using that Context. If a -REQUIRED value is absent from all applicable locations, the Consumer MUST -report missing metadata and MUST NOT interpret the payload as a conforming -OPC UA message. +MUST agree. The same consistency requirement applies to publisher and writer +identities retained in the envelope. On a conflict, the Consumer MUST report a +metadata conflict and MUST NOT interpret the payload as a conforming OPC UA +message. If a REQUIRED value is absent from all applicable locations, the +Consumer MUST report missing metadata and MUST NOT interpret the payload as a +conforming OPC UA message. A Consumer that cannot retrieve the Context MAY process the event using -its source query and explicit event attributes if they satisfy every applicable -requirement. When the WoT profile is used, the Consumer also needs the Context -to resolve the TD and MUST follow the WoT profile's failure rules. +its envelope, source query, and explicit event attributes if they satisfy every +applicable requirement. When the WoT profile is used, the Consumer also needs +the Context to resolve the TD and MUST follow the WoT profile's failure rules. The Context Publisher MUST NOT change these values in a Context Version after any Producer is configured with its URL. A change requires a new Context Version @@ -417,6 +446,10 @@ metadata only when they know that the intended Consumers support this mapping. ## Examples +The examples without a Context use publisher `UInt16:12` and writer name +`energy-consumption-asset`. Their payloads omit the native headers, so their +`source` queries supply both identifiers. + ### Metadata message The metadata message helps Cloud applications to understand the semantics and @@ -434,7 +467,7 @@ specversion: 1.0 type: ua-metadata time: 2024-03-28T21:56:24Z id: 1234-1234-1234 -source: urn:factory:aggregationserver:opcua +source: https://factory.example.com/aggregationserver/opcua?opcuapublisherid=UInt16:12;opcuadatasetwritername=energy-consumption-asset datacontenttype: application/json; charset=utf-8 subject: energy-consumption-asset .... further attributes ... @@ -478,7 +511,7 @@ specversion: 1.0 type: ua-deltaframe time: 2024-03-28T21:56:42Z id: 1235-1235-1235 -source: urn:factory:aggregationserver:opcua +source: https://factory.example.com/aggregationserver/opcua?opcuapublisherid=UInt16:12;opcuadatasetwritername=energy-consumption-asset datacontenttype: application/json; charset=utf-8 subject: energy-consumption-asset sequence: 0000000007 @@ -553,7 +586,7 @@ specversion: 1.0 type: ua-event time: 2024-03-28T21:57:01Z id: 1236-1237-1238 -source: urn:factory:aggregationserver:opcua +source: https://factory.example.com/aggregationserver/opcua?opcuapublisherid=UInt16:12;opcuadatasetwritername=energy-consumption-asset datacontenttype: application/json; charset=utf-8 subject: energy-consumption-asset/444321 sequence: 0000000018 @@ -595,7 +628,7 @@ specversion: 1.0 type: ua-keyframe time: 2024-03-28T23:59:59Z id: 6235-7235-8235 -source: bottling-company/amsterdam/FillingArea1/FillingLine9/Cell1/Conveyor +source: bottling-company/amsterdam/FillingArea1/FillingLine9/Cell1/Conveyor?opcuapublisherid=UInt16:12;opcuadatasetwritername=energy-consumption-asset datacontenttype: application/avro subject: energy-consumption-asset dataschema: http://example.com/schemas/energy-consumption-asset/v1.8 @@ -675,6 +708,63 @@ Context with the event's `opcuamessagetype` and `opcuasequence`. It evaluates `subject` against the TD selected by `emitter` and uses the schema selected by `schema`. +#### Retaining the NetworkMessage envelope + +This event retains the full Part 14 NetworkMessage envelope. Its PublisherId +and DataSetWriterId satisfy the identity requirements, so `source` needs no +publisher or writer query parameters. Part 14 JSON encodes the configured +PublisherId `UInt16:12` as the string `"12"`. + +Context Version `2` retains the same `emitter` Reference and points its `schema` +Reference to `https://example.com/schemas/pump-process-data-envelope/versions/1`. +It contains no publisher or writer attributes. The event type uses revision +`v2` because retaining the envelope changes the payload contract. + +```text +------------------ PUBLISH ------------------- + +Topic Name: opcua/json/DataSetMessage/pump +Content Type: application/json + +------------- User Properties ---------------- + +specversion: 1.0 +id: ua-message-25461 +source: mqtt://site/line/cell/device/sensor?site=north +type: com.example.models.tm.pump.properties.processData.v2 +subject: #/properties/processData +time: 2026-10-29T12:00:01Z +contexturl: https://registry.example/contextgroups/line1/contexts/opcua-pump-process-data/versions/2 +opcuamessagetype: ua-keyframe +opcuasequence: 0 + +------------------ payload ------------------- + +{ + "MessageId": "ua-message-25461", + "MessageType": "ua-data", + "PublisherId": "12", + "Messages": [ + { + "DataSetWriterId": 17, + "MessageType": "ua-keyframe", + "SequenceNumber": 0, + "Timestamp": "2026-10-29T12:00:01Z", + "Payload": { + "Speed": 1500, + "Pressure": 4.5 + } + } + ] +} + +----------------------------------------------- +``` + +The native sequence has rolled over from `4294967295` to `0`; it remains +`opcuasequence`, not a CloudEvents `sequence`. The event still uses `contexturl` +to select its TD and schema, and carries `opcuamessagetype` in the event. + ## Context Retrieval Security The Event Context extension's retrieval, authorization, and cache rules apply @@ -683,6 +773,7 @@ the Publisher or authorize access to the referenced TD or schema. A Consumer MUST establish trust in the Context before using it as OPC UA metadata. [UA DataSetWriterName]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table185 +[UA NetworkMessage]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/7.2.5.3 [UA DataSetWriterId]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.4.1 [UA PublisherId]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.7.1 [UA SequenceNumber]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.3 diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 4ddf22740..0d1be6947 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -6,10 +6,10 @@ The REQUIRED `contexturl` identifies shared metadata whose `emitter` Reference selects the resolved TD. The `subject` identifies the part of that TD associated with the event, and the `type` names the event contract. -The profile defines no CloudEvents extension attributes or URI scheme. -Producers and Consumers agree on its use through a publication profile or out -of band. It does not define a transport binding, provision a Thing, or require -a particular registry implementation. Events use the xRegistry Context +The profile defines no CloudEvents extension attributes. Producers and +Consumers agree on its use through a publication profile or out of band. +It does not define a transport binding, provision a Thing, or require a +particular registry implementation. Events use the xRegistry Context representation defined by the Event Context extension. ## Notational Conventions @@ -22,67 +22,26 @@ described in [RFC 2119](https://tools.ietf.org/html/rfc2119). The scope of these key words is limited to events using this profile. An attribute marked REQUIRED here is not REQUIRED in every CloudEvent. -## Source +## Mapping Core Context Attributes + +### source The Core [`source`](../spec.md#source) identifies the context in which the -event occurred and follows Core's URI-reference rules. It can identify a Thing, -topology, publisher, or another Producer-defined context. This profile does not -prescribe a URI scheme or query parameters. The Context's `emitter` Reference, -not `source`, selects the resolved TD. +event occurred and follows Core's URI-reference rules. This profile leaves +the content of `source` undefined beyond those Core requirements. -For example, a Producer can use `https://factory.example.com/line1/pump7` or -`mqtt://site/line/cell/device/sensor` as a source. Another possible form is -`wot-td://factory/line1`; this profile does not define that scheme or propose -its registration. A source is an identifier and is not necessarily a retrieval -URL for a TD. +For example, `https://factory.example.com/line1/pump7` and +`mqtt://site/line/cell/device/sensor` are valid sources. -### Event identity +#### Event identity Core requires `source` and `id` together to identify each distinct event. -Changing the `source`, including any query parameters, changes the event -identity and [Sequence extension](sequence.md) scope. +Changing the `source` changes the event identity and +[Sequence extension](sequence.md) scope. Returning to an earlier `source` returns to its existing scope: Producers MUST NOT reuse event identities or restart a claimed source-wide sequence within that scope. -Changing `contexturl` alone does not change event identity or sequence scope. -A Producer MUST NOT reuse an `id` or restart a source-wide sequence merely -because it publishes a new Context Version. - -## Resolving the Thing Description - -Every event using this profile MUST include `contexturl`. The Producer and -Consumer MUST implement the [Event Context extension](context.md). The Context -MUST contain an `emitter` Reference whose `url` identifies the resolved TD -document, not its Registry metadata. The Context Publisher SHOULD reference an -explicit TD Version and publish the resolved TD view at that URL. The Consumer -retrieves the document directly or uses the corresponding document in an -accepted resolved Context view. It MUST NOT derive a TD URL from `contexturl` -or from the `emitter` URL. - -The Context's `emitter` is authoritative for TD selection. The Consumer MUST -evaluate `subject` against that TD and MUST NOT select another TD from `source`. -This rule does not change Core's meaning of `source` or authenticate the -emitting entity. - -If `contexturl` is missing, the Context cannot be retrieved or is invalid, its -`emitter` Reference is missing or invalid, or the referenced TD is unavailable -or not resolved, the Consumer MUST report a resolution failure and leave the -event uncorrelated. It MUST NOT fall back to selection through `source`. It -MAY retain or forward the event without TD-based interpretation. - -The Context Publisher MUST make the TD available before configuring Producers -with the Context Version URL. Changes to its Reference require a new Context -Version. A change to the TD's resolved logical view requires a new TD Version; -the Context Publisher MUST NOT change that view at a previously published -Version URL. Context versioning alone does not make an unversioned TD URL -stable. - -The event carries no digest of the TD. An exact version or a successful -resolution does not by itself prove that retrieved bytes are unchanged. - -## Mapping Core Context Attributes - ### type The Core [`type`](../spec.md#type) identifies the event contract. The contract @@ -207,7 +166,43 @@ An xRegistry Schema Resource's document-view URL can identify that external schema. It is not the WoT Resource's metadata-view URL. A profile MAY require an exact schema Version independently of the selected TD Version. -### Relationship to Other Extensions +## contexturl + +Every event using this profile MUST include `contexturl`. The Producer and +Consumer MUST implement the [Event Context extension](context.md). The Context +MUST contain an `emitter` Reference whose `url` identifies the resolved TD +document, not its Registry metadata. The Context Publisher SHOULD reference an +explicit TD Version and publish the resolved TD view at that URL. The Consumer +retrieves the document directly or uses the corresponding document in an +accepted resolved Context view. It MUST NOT derive a TD URL from `contexturl` +or from the `emitter` URL. + +The Context's `emitter` is authoritative for TD selection. The Consumer MUST +evaluate `subject` against that TD and MUST NOT select another TD from `source`. +This rule does not change Core's meaning of `source` or authenticate the +emitting entity. + +If `contexturl` is missing, the Context cannot be retrieved or is invalid, its +`emitter` Reference is missing or invalid, or the referenced TD is unavailable +or not resolved, the Consumer MUST report a resolution failure and leave the +event uncorrelated. It MUST NOT fall back to selection through `source`. It +MAY retain or forward the event without TD-based interpretation. + +The Context Publisher MUST make the TD available before configuring Producers +with the Context Version URL. Changes to its Reference require a new Context +Version. A change to the TD's resolved logical view requires a new TD Version; +the Context Publisher MUST NOT change that view at a previously published +Version URL. Context versioning alone does not make an unversioned TD URL +stable. + +Changing `contexturl` alone does not change event identity or sequence scope. +A Producer MUST NOT reuse an `id` or restart a source-wide sequence merely +because it publishes a new Context Version. + +The event carries no digest of the TD. An exact version or a successful +resolution does not by itself prove that retrieved bytes are unchanged. + +## Relationship to Other Extensions This profile does not redefine native message types, sequence counters, or writer identities. An event that also uses the [OPC UA extension](opcua.md) From a1a988334cba52396cb32c1f56eb4c69b62644a5 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 12 Nov 2026 13:58:21 +0100 Subject: [PATCH 24/60] docs(opcua): address remaining review feedback Remove redundant WoT source and identity rules from the OPC UA extension, clarify subject and writer metadata mapping, and omit opcuamessagetype when the retained NetworkMessage carries it. Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 61 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 457946a2c..6206366aa 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -40,10 +40,9 @@ field `MessageId`. An OPC UA Producer MAY identify the server using its [Application Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) field `applicationUri` or a customer-configured identifier such as a unified -namespace path. A Producer using the WoT profile MUST instead follow its -`source` mapping. For data and event messages, a Producer MUST include -each publisher or writer query parameter REQUIRED by the mapping unless the -full OPC UA Part 14 NetworkMessage envelope or the Context supplies its +namespace path. For data and event messages, a Producer MUST include each +publisher or writer query parameter REQUIRED by the mapping unless the full +OPC UA Part 14 NetworkMessage envelope or the Context supplies its corresponding value. ### type @@ -52,8 +51,11 @@ An OPC UA Producer MAY map `type` to the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) field `MessageType`. A Producer using the WoT profile MUST follow its semantic event-type rules. When the `type` identifies a WoT event contract, a Producer -MUST carry the native `MessageType` as `opcuamessagetype` in the event. The -[WoT mapping section](#wot-mapping) specifies the combined mapping. +MUST carry the native `MessageType` as `opcuamessagetype` when `data` omits +that field from the DataSetMessage header. When a retained NetworkMessage +envelope includes the field, the Producer MUST NOT repeat it as an event +attribute. The [WoT mapping section](#wot-mapping) specifies the combined +mapping. ### WoT mapping @@ -61,35 +63,27 @@ When a CloudEvent uses both this extension and the [WoT profile](./wot.md), the following mappings apply to data and event messages: -- `source` MUST follow the WoT profile's source mapping. - `type` MUST follow the WoT profile's semantic event-type rules instead of mapping to the native `MessageType`. - `subject` MUST follow the WoT profile's resolved-TD pointer rules. - The native PublisherId and at least one DataSetWriter identifier MUST be available from the full Part 14 NetworkMessage envelope, `source`, or the Context, as defined in [Publisher and Writer Metadata](#publisher-and-writer-metadata). - Writer identifiers MUST NOT be appended to `subject`. -- For an event message, the `EventId` remains in the OPC UA event payload and - MUST NOT be appended to `subject`. +- Nothing MUST be appended to `subject`. For an event message, the `EventId` + remains in the OPC UA event payload. - `opcuasequence` MUST carry the native `SequenceNumber`. The CloudEvents `sequence` attribute, when present, MUST satisfy the independent ordering requirements of the Sequence extension and MUST NOT be inferred from `opcuasequence`. The [publisher and writer metadata rules](#publisher-and-writer-metadata) -define the source-query and Context representations of these identifiers. -They do not relocate `source`, `type`, or `subject`, and they do not change -how those Core attributes map. -Native identifiers retained in a full NetworkMessage envelope satisfy the -same presence requirements. +define how OPC UA publisher and writer identifiers are supplied. The Core +attribute mappings above remain unchanged. These conditional mappings replace only the conflicting OPC UA mappings above. All other requirements in this extension remain applicable. A profile that uses only part of this extension MUST NOT claim conformance to it unless the -profile satisfies every applicable requirement in this document. Producers -sharing a WoT `source` MUST assign distinct native `MessageId` values to -distinct events within that source to satisfy Core's `source` and `id` -uniqueness requirement. +profile satisfies every applicable requirement in this document. ## Mapping of OPTIONAL Attributes @@ -216,12 +210,14 @@ than omit the status, wrap the value, or report it as _Good_. ### opcuamessagetype - Type: `String` -- Description: Carries the OPC UA PubSub DataSetMessage type when `type` - identifies a WoT semantic event type. +- Description: Carries the OPC UA PubSub DataSetMessage type when the + DataSetMessage header is omitted from `data`. - Constraints - OPTIONAL - In combination with the WoT profile, the value is REQUIRED for data and - event messages. + event messages when `data` omits the DataSetMessage header. + - MUST NOT be present when `data` retains a full NetworkMessage envelope + that includes the DataSetMessage `MessageType`. - MUST map to the Data Set Message Header `MessageType`. - The value MUST be the native OPC UA message type, such as `ua-keyframe`, `ua-deltaframe` or `ua-event`. @@ -357,15 +353,17 @@ referenced via `dataschema` attribute or selected through Event Context. Otherwise, the payload MUST omit the NetworkMessage and DataSetMessage headers and supply their applicable information through the mappings in this extension. -- OPC UA PubSub JSON messages MUST contain exactly one dataset message. +- OPC UA PubSub JSON messages MUST contain exactly one DataSetMessage, + including when a full NetworkMessage envelope is retained. A retained envelope does not replace the REQUIRED CloudEvents attributes or -the per-event `opcuamessagetype` and `opcuasequence` attributes when the WoT -mapping applies. `opcuamessagetype` identifies the DataSetMessage type, not -the enclosing NetworkMessage's `ua-data` type. Duplicated values MUST agree -with their native fields after applying the specified mappings. The Consumer -MUST report a conflict and MUST NOT interpret a message as conforming to this -extension when they disagree. +the per-event `opcuasequence` attribute when the WoT mapping applies. +`opcuamessagetype` is REQUIRED only when `data` omits the DataSetMessage +header; when the envelope includes that field, the attribute MUST be absent. +The NetworkMessage's `ua-data` type is not the DataSetMessage type. Any +duplicated native values MUST agree after applying the specified mappings. +The Consumer MUST report a conflict and MUST NOT interpret a message as +conforming to this extension when they disagree. ## Shared Stream Metadata in a Context @@ -735,7 +733,6 @@ type: com.example.models.tm.pump.properties.processData.v2 subject: #/properties/processData time: 2026-10-29T12:00:01Z contexturl: https://registry.example/contextgroups/line1/contexts/opcua-pump-process-data/versions/2 -opcuamessagetype: ua-keyframe opcuasequence: 0 ------------------ payload ------------------- @@ -763,7 +760,9 @@ opcuasequence: 0 The native sequence has rolled over from `4294967295` to `0`; it remains `opcuasequence`, not a CloudEvents `sequence`. The event still uses `contexturl` -to select its TD and schema, and carries `opcuamessagetype` in the event. +to select its TD and schema. The DataSetMessage's `MessageType` remains in the +retained NetworkMessage envelope instead of being repeated as +`opcuamessagetype`. ## Context Retrieval Security From 3fb6540266bd08ee7dcf68bd4a3c37fd3b691efc Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 12 Nov 2026 14:17:08 +0100 Subject: [PATCH 25/60] docs(opcua): read message type from retained envelope when present Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 6206366aa..65e7f30b4 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -131,7 +131,8 @@ field `Timestamp`. The following well-known extension attributes apply to data and event messages. When the WoT profile is used, determine the native message type -from `opcuamessagetype`. +from `opcuamessagetype` when present or from the retained NetworkMessage's +DataSetMessage header when it contains `MessageType`. ### sequence From 0f6537f8192a88d51b8a2979b1492d41f20f75f7 Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 14 Nov 2026 15:39:41 +0100 Subject: [PATCH 26/60] Define Descriptor Reference and direct TD subject mapping Signed-off-by: Marc --- cloudevents/extensions/README.md | 2 +- cloudevents/extensions/context.md | 210 --------------- cloudevents/extensions/describedby.md | 372 ++++++++++++++++++++++++++ cloudevents/extensions/opcua.md | 352 ++++++++++++++---------- cloudevents/extensions/wot.md | 372 +++++++++++++++++++------- 5 files changed, 851 insertions(+), 457 deletions(-) delete mode 100644 cloudevents/extensions/context.md create mode 100644 cloudevents/extensions/describedby.md diff --git a/cloudevents/extensions/README.md b/cloudevents/extensions/README.md index 971bdbd4c..7fdfb70f4 100644 --- a/cloudevents/extensions/README.md +++ b/cloudevents/extensions/README.md @@ -45,8 +45,8 @@ for more information. - [Data Classification](data-classification.md) - [Dataref (Claim Check Pattern)](dataref.md) - [Deprecation](deprecation.md) +- [Descriptor Reference](describedby.md) - [Distributed Tracing](distributed-tracing.md) -- [Event Context](context.md) - [Expiry Time](expirytime.md) - [OPC UA](opcua.md) - [Partitioning](partitioning.md) diff --git a/cloudevents/extensions/context.md b/cloudevents/extensions/context.md deleted file mode 100644 index b01fa463f..000000000 --- a/cloudevents/extensions/context.md +++ /dev/null @@ -1,210 +0,0 @@ -# Event Context - -The `contexturl` extension attribute identifies shared information that a -Consumer needs to interpret an event. Instead of repeating a Message definition -URL, schema URL, and emitter description URL in every event, a Producer names -one Context that references those representations by Role. - -This proposal aligns with the [xRegistry Event Context working draft][Context -Registry] in [xregistry/spec#796][Context PR]. The attribute name and the -resolved-view media type remain provisional. A Context is a metadata-only -xRegistry Resource, not a document attached to that Resource. This extension -does not require a Producer to host or query a Registry. - -A Publisher creates Contexts and their referenced representations. A Producer -emits events, and a Consumer processes them. - -## Notational Conventions - -As with the main [CloudEvents specification](../spec.md), the key words "MUST", -"MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", -"RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as -described in [RFC 2119](https://tools.ietf.org/html/rfc2119). - -The scope of these key words is limited to events using this extension. - -## Attributes - -### contexturl - -- Type: `URI` -- Description: The absolute URL of the Context that applies to this event. -- Constraints: - - OPTIONAL. - - If present, MUST identify a Context Resource or Context Version and MUST - NOT contain a fragment. - - SHOULD identify a Context Version. - - Consumers MUST use the value unchanged as the request URL and as the URL - component of the cache key. Cache selection MUST also account for the - selected representation and authorization context. - - Consumers MUST NOT derive other URLs from the value. In particular, they - MUST NOT append `$details`, a view path, or a query parameter, or remove - `/versions/`. - - When absent, this extension supplies no Context for the event. - -In the JSON event format, `contexturl` is a top-level string member. In HTTP -binary content mode, it is the `ce-contexturl` header, encoded and decoded -according to the [HTTP binding](../bindings/http-protocol-binding.md). -Other bindings use their normal extension-attribute mapping. - -## Context Representation - -An ordinary `GET` of `contexturl` with `Accept: application/json` returns -Context metadata directly. The xRegistry Context model sets `hasdocument` to -`false`; no `$details` request or separate Context document is needed. - -The REQUIRED `references` map contains at least one entry. Each key is a Role, -and each value is an object with a REQUIRED `url` member. That member is an -absolute URL without a fragment. Consumers MUST use each referenced URL -unchanged when retrieving its representation. - -The working draft defines these Roles. - -| Role | Referenced representation | -| --- | --- | -| `message` | Message definition metadata describing the event. | -| `schema` | Schema document for the event's `data`. | -| `emitter` | Description of the emitting entity, such as a WoT Thing Description Version document. | -| `target` | Model that the event concerns, such as an OpenUSD asset. | - -Roles follow the working draft's map-key rules. Unprefixed names are reserved -for that draft. Other Roles MUST use an identifying prefix followed by `:`, -such as `acme:policy`. Consumers MUST ignore Roles they do not use and Reference -attributes they do not understand. - -Contexts and References permit extension attributes. A profile can use those -attributes for metadata shared by a message stream. Such metadata is not -automatically a CloudEvents attribute: the profile MUST define its meaning and -how it relates to attributes carried in the event. - -## Processing and Versioning - -When including `contexturl`, a Producer MUST name a Context whose references -apply to the event. A Publisher MUST make referenced representations available -before configuring Producers with the Context URL. Producers SHOULD reuse a -configured Context Version URL for events with the same shared information. -A Context with a `message` Reference applies to one event type; Producers -that emit several types use a separate Context for each type in that case. - -A Publisher MUST NOT change a Context Version's `references` after any -Producer is configured with its URL. Changing references requires a new -Version and reconfigured Producers. Profiles that store shared metadata in -Context extension attributes MUST define equivalent stability rules for those -values. - -A Context Resource URL serves the current default Version. That default can -change without changing `contexturl`, so Consumers SHOULD bound the lifetime -of cached Resource representations. A Context Version fixes its references, -not the bytes of referenced representations. Publishers SHOULD reference -explicit Target Versions when replay requires reproducible interpretation and -SHOULD retain Contexts and referenced representations for the replay period. - -A Consumer retrieves the Context from the unchanged URL or uses a valid cache -entry for that URL, representation, and authorization context. It MUST check -the response status, media type, and Context representation against the -working draft. A failed response, unsupported representation, or missing or -empty `references` map makes the Context unavailable. For a valid Context, the -Consumer retrieves the representations for the Roles it needs, subject to its -access and content-trust policies. A missing Role that the Consumer needs -makes the Context incomplete. - -When retrieval fails or the Context is invalid or incomplete, the Consumer -MUST NOT derive replacement URLs from `contexturl`. It SHOULD record the -condition. Local policy determines whether to defer, reject, or process the -event without that information, unless another profile requires a particular -outcome. - -### Resolved Context view - -A supporting server can return the Context and all directly referenced -representations in one response. A Consumer requests that view at the same -unchanged URL with: - -```http -Accept: application/vnd.xregistry.context-view+json, application/json;q=0.5 -``` - -The Consumer MUST inspect `Content-Type` rather than assume that the server -supports the view. Ordinary `application/json` returns Context metadata; -`application/vnd.xregistry.context-view+json` returns `context` and `documents` -as defined by the working draft. The view includes every direct Reference or -returns an error. It does not recursively retrieve their dependencies or -establish a snapshot across Registries. - -## Relationship to Other Attributes - -Core attributes retain their meaning. In particular, `contexturl` does not -replace REQUIRED `id`, `source`, or `type`, and does not locate the event's -`data` as the [Dataref extension](dataref.md) does. - -A Consumer selects the first applicable schema source in this order: - -1. The event's `dataschema`. -2. The Context's `schema` Reference. -3. The schema declared by the Context's `message` representation. - -Producers SHOULD omit `dataschema` when the Context supplies the schema. -Publishers and Producers SHOULD supply only one schema source, or identify -the same schema when several are supplied. Consumers apply the precedence -without comparing the sources. - -An `emitter` Reference does not authenticate the event or redefine `source`. -The [WoT profile](wot.md) requires this extension and defines how `emitter` -selects a Thing Description (TD). The -[OPC UA extension](opcua.md#shared-stream-metadata-in-a-context) -defines which stream metadata can be supplied by a Context. Neither rule -applies to generic events merely because they contain `contexturl`. - -## Example - -This event references shared emitter and payload-schema information. - -```json -{ - "specversion": "1.0", - "id": "sample-4711", - "source": "mqtt://site/line/cell/device/sensor", - "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "#/properties/processData", - "datacontenttype": "application/json", - "contexturl": "https://registry.example/contextgroups/line1/contexts/pump-process-data/versions/1", - "data": { - "Speed": 1500, - "Pressure": 4.5 - } -} -``` - -The Context Version has the following metadata. Other Core metadata is omitted -from this excerpt. - -```json -{ - "contextid": "pump-process-data", - "versionid": "1", - "references": { - "emitter": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - }, - "schema": { - "url": "https://example.com/schemas/pump-process-data/versions/3" - } - } -} -``` - -## Security Considerations - -Consumers and servers that assemble resolved views MUST apply authorization, -URL, redirect, and content-trust policies before retrieving or using a Context -or any referenced representation. An event-provided URL MUST NOT authorize -arbitrary network access or credential forwarding. Implementations SHOULD -bound response sizes, retrieval times, and dependency processing. - -Caches MUST NOT share representations across authorization contexts unless -the applicable access policy permits it. A resolved view does not bypass the -Consumer's trust checks. Context Versions and Target Versions do not by -themselves authenticate content or prove that its bytes are unchanged. - -[Context PR]: https://github.com/xregistry/spec/pull/796 -[Context Registry]: https://github.com/xregistry/spec/blob/e46561facacb672ed3d7603be1574a75b1a11789/workingdrafts/models/context/spec.md diff --git a/cloudevents/extensions/describedby.md b/cloudevents/extensions/describedby.md new file mode 100644 index 000000000..27bedc731 --- /dev/null +++ b/cloudevents/extensions/describedby.md @@ -0,0 +1,372 @@ +# Descriptor Reference + +The OPTIONAL `describedby` extension attribute identifies a Descriptor +containing shared information for interpreting an event. A Descriptor can +reference schemas, Message definitions, WoT Thing Descriptions or other +representations, and can contain typed metadata such as a publisher identity. It +describes information relevant to the event, not necessarily only the event's +source or subject. + +This proposal is developed with the Descriptor Registry revision of +[xregistry/spec#796][Descriptor Registry]. That domain defines the metadata-only +Descriptor Resource, its Asset, Actor and Context specializations, named +References, selectors and OPTIONAL bundle. These are drafts, not released +standards. This document defines their CloudEvents binding; it does not require +a Producer to host or query a Registry. + +A Publisher publishes Descriptors and their referenced representations. A +Producer emits events, and a Consumer processes them. A publication profile is +an agreement defining message interpretation and REQUIRED inputs. Producers and +Consumers establish that agreement through a specification or configuration, not +by trusting a profile asserted in untrusted metadata. + +## Notational Conventions + +As with the main [CloudEvents specification](../spec.md), the key words "MUST", +"MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", +"RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as +described in [RFC 2119](https://tools.ietf.org/html/rfc2119). + +The scope of these key words is limited to events using this extension or a +profile that explicitly uses its description-selection rules. + +## Attributes + +### describedby + +- Type: `URI` +- Description: The absolute URL of the Descriptor selected for interpreting + this event. +- Constraints: + - OPTIONAL. + - If present, MUST identify a Descriptor Resource or Descriptor Version + and MUST NOT contain a fragment. + - SHOULD identify a Descriptor Version. Profiles MAY require one. + - Consumers MUST use the value unchanged as the request URL and as the URL + component of the cache key. Cache selection MUST also account for the + selected representation and authorization context. + - Consumers MUST NOT derive other URLs from the value. In particular, they + MUST NOT append `$details`, a view path or query parameter, or remove + `/versions/`. + - An empty string or otherwise invalid set value is invalid, not absent. + +In the JSON event format, `describedby` is a top-level string member. In HTTP +binary content mode, it is the `ce-describedby` header, encoded and decoded +according to the [HTTP binding](../bindings/http-protocol-binding.md). Other +bindings use their normal extension-attribute mapping. + +Consumers MUST apply the event format's decoding rules before testing attribute +presence. In particular, the [JSON +format](../formats/json-format.md#22-type-system-mapping) treats `"describedby": +null` as unset, equivalent to omission. That is not a failed explicit reference +and does not prohibit a profile-defined route for events without `describedby`. +The same presence rule applies to the migration check for simultaneous old and +new attributes. + +The name expresses a descriptive relationship, consistent with the +[`describedby` Web link relation][Link Relations]; it does not define an HTTP +`Link` header or a list of links. + +## Core Attributes and Description Selection + +Core attributes retain their meaning: + +| Attribute | Meaning | +| --- | --- | +| `source` | Identifies the context in which the event occurred. It is not necessarily one physical Producer. | +| `subject` | Identifies what the event concerns within that originating context. It is a String, not inherently a retrieval URL. | +| `dataschema` | Identifies the schema that the event's `data` adheres to. | +| `describedby` | Identifies additional shared information for interpreting the event. It does not replace any of the above. | + +A Producer SHOULD omit `describedby` when the event and agreed profile already +supply all REQUIRED inputs. If only an external payload schema is needed, +`dataschema` supplies that relationship without a Descriptor. + +### Profile-defined source and subject retrieval + +A profile MAY use a Descriptor URL as `source` when that URL also identifies the +originating context. It MAY define a subject that identifies a Thing or other +entity and permits retrieval of its description. Such a profile MUST define the +selected representation, any fragment processing, REQUIRED inputs and failure +behavior. An arbitrary processing metadata URL MUST NOT replace `subject` if it +no longer identifies what the event concerns under that profile. + +Generic Consumers MUST NOT infer retrieval from an HTTPS scheme, a URL path +containing `descriptors`, or the absence of `describedby`. They MUST NOT resolve +arbitrary subject strings against `source`. Core URNs and relative source +references remain valid; a profile needing direct retrieval MUST define an +appropriate retrievable value or use `describedby`. + +The [WoT profile](wot.md#description-selection) defines both Descriptor-relative +subjects and self-contained TD URL subjects. The latter can select a TD without +any Descriptor. This extension does not define a universal syntax for following +references from an entity record into another document. + +### One selected processing description + +| Condition | Processing | +| --- | --- | +| `describedby` is present and valid | Select that Descriptor, whether or not source or subject descriptions are also available. | +| `describedby` is present but invalid, unavailable or incomplete | Report the condition. Do not fall back to source or subject descriptions. | +| `describedby` is absent and the agreed profile defines source or subject retrieval | Use the profile's selected route. | +| `describedby` is absent and no retrieval mapping applies | This extension supplies no description. Do not probe source or subject. | +| `source` and `describedby` have the same URL | One retrieval per representation and authorization context can serve both uses; event identity is unchanged. | + +When present, `describedby` MUST select a Descriptor supplying all Descriptor +inputs REQUIRED by the profile. It need not duplicate information already +supplied by the event. A Consumer MUST NOT merge missing fields from a source or +subject description, including when both descriptions identify the same entity. +The Source Descriptor and Processing Descriptor can describe different entities, +such as an actor and a device; differing entity identities alone are not a +metadata conflict. + +When `describedby` is absent, a profile MUST distinguish its retrieval routes +before access. There is no general "try source, then subject" algorithm. A +failure in the selected route MUST NOT cause an implicit switch to another +route. OPTIONAL descriptive lookups for display do not supply missing processing +inputs. + +For example, a source description might contain PublisherId. If an explicit +Processing Descriptor and the event omit that REQUIRED OPC UA value, the +Consumer reports missing metadata rather than borrowing it from the source +description. Conversely, an unavailable source description does not prevent +processing when the explicit Descriptor and event supply all REQUIRED inputs. + +## Descriptor Representation and Processing + +An ordinary `GET` of the selected Descriptor URL with `Accept: application/json` +returns Descriptor metadata directly. Its `hasdocument` model aspect is `false`; +no `$details` request or separate Descriptor document is needed. + +The [Descriptor Registry][Descriptor Registry] defines these members: + +| Member | Use | +| --- | --- | +| `references` | REQUIRED map of local Reference names to objects containing `class` and `url`. An empty map is valid. | +| `entityid`, `entitytype` | Describe a primary entity when one exists; not replacements for event source identity or authenticated principals. | +| `messageref`, `schemaref` | Select named Message and payload-schema References. | +| Profile attributes | Typed shared metadata whose meaning and relation to event fields are defined by the applicable profile. | + +Representation classes include `message`, `schema`, `thingdescription`, +`thingmodel` and `usdasset`. Vendor classes use URI identifiers. Multiple +References can have the same class. Reference names do not establish emitter, +target, authority or execution roles. + +A Consumer MUST check response status, media type and Descriptor validity +against that domain. A missing or incorrectly typed `references` map is invalid. +An empty map can be valid but insufficient for a profile requiring a TD or +schema. Explicit selectors MUST name an existing Reference of the expected +class, even when the event supplies `dataschema`. + +For a valid Descriptor, the Consumer retrieves only the representations it +needs, subject to its access and content-trust policies. It MUST use their URLs +unchanged. A Reference's `class` identifies a representation, not a requirement +to retrieve it or permission to execute anything it describes. An unknown class +can be ignored if the profile does not need it; an unsupported REQUIRED input +makes interpretation unavailable. Entity identity and class URIs are not +automatic retrieval instructions. + +### Message and schema selection + +The Consumer uses the Descriptor Registry's selection rule: an explicit selector +names one Reference; without a selector, a unique Reference of the requested +class is selected. Zero candidates means absence; multiple candidates mean +ambiguity, not permission to select the first entry. + +The Consumer selects the first applicable payload schema source: + +1. The event's `dataschema`. +2. The Processing Descriptor's selected `schema` Reference. +3. The schema declared by its selected `message` representation. + +Only absence permits proceeding to the next source. Ambiguity, an invalid +selector, unavailable selected content or an unsupported selected format MUST +NOT cause fallback to a different schema. With no Processing Descriptor, the +second and third candidates are absent; the Consumer MUST NOT synthesize one +from the TD or other retrieved content. + +When `dataschema` is present, otherwise unselected schema inventory is +irrelevant to precedence. Explicit Descriptor selector validity is still +checked. Publishers and Producers SHOULD supply one applicable schema source, or +identify the same schema when several are supplied. Consumers apply the +precedence without comparing schema documents. + +The Producer MUST ensure that the selected schema describes the actual `data` +representation, including any protocol envelope. A TD containing several +DataSchemas is not automatically the payload schema. The selected Message +definition applies only according to the publication profile; Consumers MUST NOT +guess it by matching `type` or by inspecting names when selection is ambiguous. + +### Failure outcomes + +| Condition | Result | +| --- | --- | +| REQUIRED inputs obtained and selected | Processing context available; this does not itself validate the payload or authorize an operation. | +| Missing, ambiguous, unavailable or unsupported REQUIRED input | Processing context unavailable. | +| Invalid shape, selector or profile value | Invalid metadata. | +| Repeated profile-defined values disagree after REQUIRED decoding | Metadata conflict. | +| Applicable validation completed | Payload valid or invalid, according to that validator. | +| Validation not performed or could not complete | Payload not checked; not a successful validation. | + +These are processing outcomes, not new event attributes or HTTP error codes. The +Consumer SHOULD record a failure. Unless a profile requires an outcome, local +policy determines whether to defer, reject, or retain/forward the event without +that interpretation. It MUST NOT claim successful interpretation or validation +when the REQUIRED inputs are missing. Retaining an uninterpreted event does not +permit bypassing a failed explicit `describedby`. + +## Publication, Identity and Replay + +The Descriptor Registry defines publication and Version stability for all +processing-significant fields, including References, selectors and typed +metadata. A Publisher MUST make the representations REQUIRED by the profile +available before configuring Producers to emit the selected Descriptor URL. A +Producer MUST select information applicable to the event and SHOULD reuse +configured Version URLs when that information is unchanged. Producers are not +REQUIRED to perform runtime validation of each event by this extension. + +A Descriptor Resource URL selects its current default Version, which can change. +Consumers SHOULD bound the freshness of cached Resource responses. A Version +fixes its published metadata, not the bytes at referenced URLs. Publishers +SHOULD pin REQUIRED representation Versions and retain them with the Descriptor +for the replay period. There is no lookup of the Version intended at event +`time`, and an ETag does not reconstruct that history. + +`source` plus `id` retains its Core uniqueness rule. Changing `source`, +including a Version segment or query, changes the identity and source-wide +Sequence scope. Changing only `describedby` does not. Producers MUST NOT reuse +event identities or restart a claimed source-wide sequence when returning to an +earlier source. + +Changing `subject` can change subscription filtering and correlation; it does +not change the source-plus-id identity scope. A profile using a versioned +description URL as subject MUST account for that coupling. A stable subject with +an independently versioned `describedby` avoids it. + +## OPTIONAL Descriptor Bundle + +A supporting endpoint can return the Descriptor and its direct referenced +representations at the same URL: + +```http +Accept: application/vnd.xregistry.descriptor-bundle+json, application/json;q=0.5 +``` + +The Consumer MUST inspect `Content-Type`. Ordinary `application/json` returns +metadata; the bundle media type returns `descriptor` and `documents` as defined +by the [Descriptor Registry][Descriptor Registry]. Each document entry uses the +same Reference name and records its exact URL, content type, content or base64 +bytes, and redirect base URL when applicable. + +The bundle covers each direct `references.*.url` or returns an error. It does +not fetch `planurl`, entity/class identifiers or transitive dependencies, and is +not a snapshot across Registries. An empty Reference map has an empty document +map. Relative dependencies use the target's recorded retrieval base, not the +Descriptor's URL. + +This behavior is additional to Core metadata serving. Content negotiation alone +does not collect referenced URLs. A Publisher can prebuild a bundle for a +suitably configured endpoint, but the same completeness, access, freshness and +representation requirements apply. + +A Consumer MAY retry ordinary JSON at the same unchanged Descriptor URL after a +bundle error and retrieve only its REQUIRED representations. This is a +representation retry, not fallback to another Descriptor or source. Consumers +and caches MUST distinguish negotiated representations and authorization +contexts, following the bundle's `Vary` and freshness rules. + +## Examples + +### Actor and processing description + +An application profile reports an actor's maintenance decision about Pump 7. It +defines `pump7` as the subject identifier within that actor's context; this +generic example does not assert the WoT or OPC UA profile. + +```json +{ + "specversion": "1.0", + "id": "decision-47", + "source": "https://registry.example/descriptorgroups/actors/descriptors/planner7", + "subject": "pump7", + "type": "com.example.maintenance.decision.v1", + "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-maintenance/versions/1", + "datacontenttype": "application/json", + "data": { + "inspectionNeeded": true + } +} +``` + +The Processing Descriptor contains the following metadata; Core bookkeeping is +omitted. Its schema describes the decision payload, not the TD document. + +```json +{ + "descriptorid": "pump7-maintenance", + "versionid": "1", + "schemaref": "payload", + "references": { + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" + }, + "payload": { + "class": "schema", + "url": "https://schemas.example/maintenance-decision/versions/1" + } + } +} +``` + +The actor's independently retrieved description can have `references: {}` and +actor identity metadata. It is not merged with the Processing Descriptor. +Neither description is an authorization to inspect or operate the pump. + +### Without an additional link + +For the same application profile, if the event and an explicit `dataschema` +already supply every REQUIRED input, no `describedby` is needed. A profile can +also select a sufficient Descriptor through `source`, or retrieve a subject +description through a defined mapping. Neither case is inferred by a generic +Consumer. + +The [WoT examples](wot.md#examples) show a concrete direct TD subject without a +Descriptor and a source-selected Descriptor. The [OPC UA +mapping](opcua.md#shared-stream-metadata-in-a-descriptor) defines when a +selected Descriptor Version supplies native stream metadata. + +## Migration from Event Context + +This revision replaces the draft `contexturl` extension and Role-keyed Context +representation. Existing events retain their original attribute and profile +semantics; Consumers MUST NOT silently reinterpret them as the new binding. +Deployments retaining such events need the old reader or an explicit conversion +policy. A profile using this revision MUST reject an event with both +`contexturl` and `describedby` unless a separate migration agreement defines +that combination. + +Do not rewrite historical sources merely to adopt registry-based identity. Names +discussed only during design, such as `contracturl`, `refset` and `contextref`, +are not aliases defined by this extension. + +## Security Considerations + +Consumers and bundle endpoints MUST apply authorization, URL, redirect and +content-trust policies before retrieving or using Descriptors or their +representations. An event-provided URL MUST NOT authorize arbitrary network +access or credential forwarding. Implementations SHOULD bound response sizes, +decompression, retrieval time, redirects and dependency processing. + +Read access to a Descriptor does not grant access to its targets. Caches MUST +NOT share representations across authorization contexts unless the applicable +access policy permits it. A bundle does not bypass trust checks. Versions do not +authenticate content or prove unchanged bytes. + +Descriptive entity IDs, TD security declarations and references to actions are +not authenticated principals, execution grants or current readiness. Device +admission and operation outcomes remain governed by their own protocols and +trusted authorities. + +[Descriptor Registry]: https://github.com/xregistry/spec/pull/796 +[Link Relations]: https://www.iana.org/assignments/link-relations/ diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 65e7f30b4..e4db2b9da 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -6,14 +6,16 @@ DataSetMessages to CloudEvents for routing over supported protocols. It defines mappings for Core and other extension attributes and specifies OPC UA extension attributes. -When used with the [Event Context extension](context.md) and the xRegistry -Context model, metadata that stays constant for a message stream is preferably -stored in the Context rather than repeated in each event. The existing OPC UA -attributes remain defined and usable. A Producer MUST supply publisher and -writer metadata REQUIRED by this mapping in the `source` query when neither -the full Part 14 NetworkMessage envelope nor the Context provides it. The -[shared metadata rules](#shared-stream-metadata-in-a-context) describe how a -Consumer obtains these values. +When used with the [Descriptor Reference extension](describedby.md) and the +xRegistry Descriptor model, metadata that stays constant for a message stream is +preferably stored in the selected Descriptor rather than repeated in each event. +The existing OPC UA attributes remain defined and usable. A Producer MUST supply +publisher and writer metadata REQUIRED by this mapping in the `source` query +when neither the full Part 14 NetworkMessage envelope nor the selected +Descriptor supplies it. The [shared metadata +rules](#shared-stream-metadata-in-a-descriptor) describe how a Consumer obtains +these values. A direct WoT TD subject can identify its description without a +Descriptor, but does not supply these native identities. ## Notational Conventions @@ -37,13 +39,12 @@ field `MessageId`. ### source -An OPC UA Producer MAY identify the server using its -[Application Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) -field `applicationUri` or a customer-configured identifier such as a unified -namespace path. For data and event messages, a Producer MUST include each -publisher or writer query parameter REQUIRED by the mapping unless the full -OPC UA Part 14 NetworkMessage envelope or the Context supplies its -corresponding value. +An OPC UA Producer MAY identify the server using its [Application +Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) field +`applicationUri` or a customer-configured identifier such as a unified namespace +path. For data and event messages, a Producer MUST include each publisher or +writer query parameter REQUIRED by the mapping unless the full OPC UA Part 14 +NetworkMessage envelope or the Descriptor supplies its corresponding value. ### type @@ -65,10 +66,12 @@ messages: - `type` MUST follow the WoT profile's semantic event-type rules instead of mapping to the native `MessageType`. -- `subject` MUST follow the WoT profile's resolved-TD pointer rules. +- `subject` MUST follow the WoT profile's Descriptor-relative or direct-TD + subject rules. - The native PublisherId and at least one DataSetWriter identifier MUST be available from the full Part 14 NetworkMessage envelope, `source`, or the - Context, as defined in [Publisher and Writer Metadata](#publisher-and-writer-metadata). + selected Descriptor, as defined in [Publisher and Writer + Metadata](#publisher-and-writer-metadata). - Nothing MUST be appended to `subject`. For an event message, the `EventId` remains in the OPC UA event payload. - `opcuasequence` MUST carry the native `SequenceNumber`. The CloudEvents @@ -101,20 +104,21 @@ separate format like [JSON schema](https://json-schema.org/specification) or [Avro schema](https://avro.apache.org/docs/1.11.1/specification/) or others. For those cases the attribute references the schema and is used for versioning. -When the Event Context extension is used, a Producer MAY reference a Context -whose `schema` Reference or `message` representation supplies this schema -instead. The Consumer follows that extension's schema precedence, and the -Producer SHOULD omit `dataschema` when the Context supplies the schema. The -selected schema MUST describe the actual `data`, including the full -NetworkMessage envelope when one is retained. +When the Descriptor Reference selection rules are used, a Producer MAY select a +Descriptor whose schema Reference or Message definition supplies this schema +instead. The Consumer follows that extension's [schema +precedence](describedby.md#message-and-schema-selection), including its selector +and ambiguity rules. The Producer SHOULD omit `dataschema` when the selected +Descriptor supplies the schema. The selected schema MUST describe the actual +`data`, including the full NetworkMessage envelope when one is retained. ### subject For metadata, data, and event messages, a Producer MAY map `subject` to `DataSetWriterId` or `DataSetWriterName` from the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164). -A Producer using the WoT profile MUST instead follow its -resolved-TD pointer mapping. +A Producer using the WoT profile MUST instead follow its Descriptor-relative or +direct-TD subject mapping. For an OPC UA event message (`type` equals `ua-event`), a Producer using the OPC UA-specific `subject` mapping MUST append "/" and the @@ -242,12 +246,11 @@ than omit the status, wrap the value, or report it as _Good_. ## Publisher and Writer Metadata -The following values identify the OPC UA Publisher and DataSetWriter. They -are not CloudEvents extension attributes. A Producer MUST supply each -REQUIRED value as a query parameter in `source` or an extension attribute of -the applicable Context Version unless the full Part 14 NetworkMessage -envelope supplies it. The names are the same in the query and Context -representations. +The following values identify the OPC UA Publisher and DataSetWriter. They are +not CloudEvents extension attributes. A Producer MUST supply each REQUIRED value +as a query parameter in `source` or an extension attribute of the applicable +Descriptor Version unless the full Part 14 NetworkMessage envelope supplies it. +The names are the same in the query and Descriptor representations. | Name | Value | | --- | --- | @@ -255,11 +258,11 @@ representations. | `opcuadatasetwriterid` | The native DataSetWriterId, represented as an integer. | | `opcuadatasetwritername` | The configured DataSetWriterName, represented as a string. | -In a full [Part 14 NetworkMessage][UA NetworkMessage], the Consumer obtains -the PublisherId from the NetworkMessage header and the DataSetWriterId or +In a full [Part 14 NetworkMessage][UA NetworkMessage], the Consumer obtains the +PublisherId from the NetworkMessage header and the DataSetWriterId or DataSetWriterName from its single DataSetMessage header. Those fields retain -their native names and encodings. The following representation rules apply -to their equivalents in `source` and the Context. +their native names and encodings. The following representation rules apply to +their equivalents in `source` and the Descriptor. `opcuapublisherid` MUST use `:`. The type MUST be `Byte`, `UInt16`, `UInt32`, `UInt64`, or `String`, as defined for the native @@ -280,21 +283,21 @@ configured name. For JSON message mapping, this is the DataSetMessage; otherwise the Producer obtains it from configuration. The native PublisherId and at least one of DataSetWriterId and DataSetWriterName -are REQUIRED for all data and event messages, whether or not the WoT profile -is used. Each value MUST be supplied by the envelope or by the corresponding -query parameter or Context attribute. A full envelope that omits an identifier -does not satisfy that identifier's presence requirement. If both writer values -are supplied, they MUST identify the same DataSetWriter. A writer name MUST -uniquely identify the DataSetWriter within the PublisherId scope. Consumers -MUST compare names exactly, without case folding or Unicode normalization. +are REQUIRED for all data and event messages, whether or not the WoT profile is +used. Each value MUST be supplied by the envelope or by the corresponding query +parameter or Descriptor attribute. A full envelope that omits an identifier does +not satisfy that identifier's presence requirement. If both writer values are +supplied, they MUST identify the same DataSetWriter. A writer name MUST uniquely +identify the DataSetWriter within the PublisherId scope. Consumers MUST compare +names exactly, without case folding or Unicode normalization. When an identity is supplied in more than one place, the representations MUST identify the same native Publisher or DataSetWriter. To compare a query or -Context value with an envelope field, the Consumer MUST decode that value and +Descriptor value with an envelope field, the Consumer MUST decode that value and apply the field's native Part 14 encoding. For example, `UInt16:12` is encoded -as `"12"` in a JSON NetworkMessage. The Consumer MUST report a metadata -conflict and MUST NOT interpret the payload as a conforming OPC UA message if -the values disagree. +as `"12"` in a JSON NetworkMessage. The Consumer MUST report a metadata conflict +and MUST NOT interpret the payload as a conforming OPC UA message if the values +disagree. A Consumer MUST report invalid metadata and MUST NOT interpret the payload as a conforming OPC UA message if a supplied publisher or writer value violates @@ -304,9 +307,9 @@ these representation or range constraints. When these values are supplied in `source`, the query parameters carry stream-constant metadata. The Producer SHOULD omit a query parameter when the -full OPC UA Part 14 NetworkMessage envelope or the Context supplies its value. -For each REQUIRED publisher or writer value that neither supplies, the -Producer MUST include the corresponding parameter in `source`. +full OPC UA Part 14 NetworkMessage envelope or the selected Descriptor supplies +its value. For each REQUIRED publisher or writer value that neither supplies, +the Producer MUST include the corresponding parameter in `source`. The Producer MUST use `name=value` for each of these parameters, with a non-empty value. It MUST separate them from each other and from preceding @@ -327,12 +330,12 @@ A Consumer MUST split the query at `;` before decoding these values. It MUST reject an empty or duplicate recognized parameter, an invalid percent escape, invalid UTF-8, or an unescaped character outside the permitted set. It MUST percent-decode each value exactly once and MUST NOT interpret `+` as a space. -The writer ID uses unsigned decimal notation without a sign or leading zeros -in the query and an integer in the Context; the other two values use strings -in both places. +The writer ID uses unsigned decimal notation without a sign or leading zeros in +the query and an integer in the Descriptor; the other two values use strings in +both places. -For example, the following source supplies the PublisherId and writer name -when neither the envelope nor the Context supplies them. The writer name is +For example, the following source supplies the PublisherId and writer name when +neither the envelope nor the Descriptor supplies them. The writer name is `Pump&Process`. ```text @@ -349,7 +352,7 @@ returns to a previously used `source`. - OPC UA messages MUST use `binary-mode` of CloudEvents. - OPC UA PubSub JSON messages MUST be encoded using non-reversible encoding as the decoding information is contained in metadata messages or by schema -referenced via `dataschema` attribute or selected through Event Context. +referenced via `dataschema` attribute or selected through a Descriptor. - A Producer MAY retain the full Part 14 NetworkMessage envelope in `data`. Otherwise, the payload MUST omit the NetworkMessage and DataSetMessage headers and supply their applicable information through the mappings in @@ -366,86 +369,118 @@ duplicated native values MUST agree after applying the specified mappings. The Consumer MUST report a conflict and MUST NOT interpret a message as conforming to this extension when they disagree. -## Shared Stream Metadata in a Context +## Shared Stream Metadata in a Descriptor A message stream here is a configured flow from one Publisher and DataSetWriter with a defined payload contract. It is not necessarily a broker topic or a CloudEvents `source`; either can carry several streams. -When Producers and Consumers agree to use this extension with the -[Event Context extension](context.md), the Context Publisher SHOULD store -metadata that is constant for the stream as Context Version extension -attributes. Each event then carries `contexturl`. Storing stream-constant -values once in the Context avoids repeating them in event attributes or the -`source` query. The Context has no document body: these values are members -of its metadata object, alongside `references`. - -The Context Publisher MAY store the following values in the Context when they -remain constant for every event using that Context Version. When a Context -supplies any of these values, `contexturl` MUST identify a Context Version. -A Context Resource URL can select a different default Version when a delayed -or replayed event is processed. - -| Context attribute | Meaning and conditions | +When Producers and Consumers agree to use this extension with the [Descriptor +Reference selection rules](describedby.md#one-selected-processing-description), +the Publisher SHOULD store metadata that is constant for the stream as +Descriptor Version extension attributes. The agreed binding selects the +Descriptor through `describedby` or a profile-defined source or subject mapping. +Storing stream-constant values once avoids repeating them in event attributes or +the `source` query. The Descriptor has no document body: these values are +members of its metadata object, alongside `references`. + +The Publisher MAY store the following values in the Descriptor when they remain +constant for every event using that Version. When a Descriptor supplies any of +these values, its selected URL MUST identify a Descriptor Version, whether +selected explicitly or through a profile-defined mapping. A Resource URL can +select a different default Version when a delayed or replayed event is +processed. + +| Descriptor attribute | Meaning and conditions | | --- | --- | | `opcuapublisherid` | The stream's native PublisherId. | | `opcuadatasetwriterid` | The stream's native DataSetWriterId, when used. | | `opcuadatasetwritername` | The stream's configured DataSetWriterName, when used. | +| `opcuadatasetname` | The non-empty `Name` of the applicable DataSet metadata; descriptive, not a writer identifier. | | `opcuametadatamajorversion` | The MajorVersion of the applicable native metadata, when no payload schema is selected. | | `opcuametadataminorversion` | The MinorVersion of the applicable native metadata, when no payload schema is selected. | -These members MUST use the value constraints and native field mappings -defined in [Attributes](#attributes) and -[Publisher and Writer Metadata](#publisher-and-writer-metadata). For example, -a Context's `opcuadatasetwriterid` is a JSON integer, not a string. The -Context's `schema` Reference identifies an external payload schema. Native -metadata-version attributes MUST NOT be supplied in the event or Context -when a schema is selected through `dataschema` or the Context. - -For the listed values, an applicable Context satisfies this extension's -presence requirements, including those of the combined WoT mapping. A Producer -MAY omit the corresponding event attribute or source query parameter. Other -event attributes, including `opcuamessagetype`, MUST NOT be replaced by Context -members. +Publisher, writer and metadata-version members MUST use the constraints and +mappings defined in [Attributes](#attributes) and [Publisher and Writer +Metadata](#publisher-and-writer-metadata). For example, a Descriptor's +`opcuadatasetwriterid` is a JSON integer, not a string. The Descriptor's +selected schema Reference identifies an external payload schema. Native +metadata-version attributes MUST NOT be supplied in the event or Descriptor when +a schema is selected through `dataschema` or the Descriptor. + +`opcuadatasetname` is an OPTIONAL Descriptor attribute, not a new CloudEvents +attribute or source query parameter. If supplied, it MUST be a non-empty String +equal to `DataSetMetaDataType.Name` in the applicable [DataSet metadata][UA +DataSet Metadata], obtained from that metadata or its approved configuration. A +Producer MUST NOT infer it from a writer name, topic or TD affordance name. It +need not be unique and MUST NOT substitute for a REQUIRED PublisherId or +DataSetWriter identity. Repeated dataset-name representations, when the profile +supplies them, MUST compare exactly without case folding or Unicode +normalization. A mismatch is a metadata conflict. This attribute does not permit +removal of native fields REQUIRED by the selected encoding. + +For the listed values, an applicable Descriptor satisfies this extension's +presence requirements for the corresponding field, including those of the +combined WoT mapping. The dataset name satisfies no publisher or writer identity +requirement. A Producer MAY omit the corresponding event attribute or source +query parameter. Other event attributes, including `opcuamessagetype`, MUST NOT +be replaced by Descriptor members. If a publisher or writer value appears in both the `source` query and the -Context, the values MUST agree after decoding and type conversion. If an event -attribute and the Context both supply a metadata version, their typed values -MUST agree. The same consistency requirement applies to publisher and writer -identities retained in the envelope. On a conflict, the Consumer MUST report a -metadata conflict and MUST NOT interpret the payload as a conforming OPC UA -message. If a REQUIRED value is absent from all applicable locations, the +Descriptor, the values MUST agree after decoding and type conversion. If an +event attribute and the Descriptor both supply a metadata version, their typed +values MUST agree. The same consistency requirement applies to publisher and +writer identities retained in the envelope. On a conflict, the Consumer MUST +report a metadata conflict and MUST NOT interpret the payload as a conforming +OPC UA message. If a REQUIRED value is absent from all applicable locations, the Consumer MUST report missing metadata and MUST NOT interpret the payload as a conforming OPC UA message. -A Consumer that cannot retrieve the Context MAY process the event using -its envelope, source query, and explicit event attributes if they satisfy every -applicable requirement. When the WoT profile is used, the Consumer also needs -the Context to resolve the TD and MUST follow the WoT profile's failure rules. - -The Context Publisher MUST NOT change these values in a Context Version after -any Producer is configured with its URL. A change requires a new Context Version -and reconfigured Producers. Consumers MUST NOT retain values from a previous -Context when processing an event that selects another Context. A changed -payload contract also requires a changed WoT `type` revision when that profile -is used; changing only `contexturl` is not sufficient. +A Consumer MUST use only the Descriptor selected by the agreed binding. If +`describedby` is present, missing values MUST NOT be taken from a source or +subject description. If its Descriptor cannot be retrieved, the Consumer MAY +interpret the native payload using the envelope, source query and explicit event +attributes when they supply every native requirement, but MUST NOT report +successful Descriptor-based interpretation or WoT correlation. The WoT profile's +explicit-link failure rules still apply. + +Without `describedby`, the revised WoT profile can select a direct TD subject +without a Descriptor. Native publisher and writer requirements then have to be +satisfied by the retained envelope or the existing source query. A direct TD +MUST NOT be treated as a source of missing OPC UA metadata. Consumers MUST NOT +retrieve a source Descriptor as an implicit supplement. + +The Descriptor Publisher MUST NOT change these values in a Descriptor Version +after any Producer is configured with its URL. A change requires a new +Descriptor Version and reconfigured Producers. Consumers MUST NOT retain values +from a previous Descriptor when processing an event that selects another +Descriptor. A changed payload contract also requires a changed WoT `type` +revision when that profile is used; changing only `describedby` is not +sufficient. Values that vary by occurrence remain in each event. In particular, `opcuamessagetype`, `opcuasequence`, `opcuastatus` when REQUIRED, `id`, and -`time` MUST NOT be supplied by the Context as replacements for their event +`time` MUST NOT be supplied by the Descriptor as replacements for their event attributes. Tracing, recording times, and a CloudEvents `sequence`, when used, -also remain in the event. A Consumer MUST NOT use Context members with those -names as event values. Core attributes retain their normal placement and -meaning even when their values happen to be constant for a stream. - -Without a `contexturl`, no Context supplies missing OPC UA values. This -preserves the existing event attributes and lets a Producer supply publisher -and writer metadata in the `source` query. Producers SHOULD use Context -metadata only when they know that the intended Consumers support this mapping. +also remain in the event. A Consumer MUST NOT use Descriptor members with those +names as event values. Core attributes retain their normal placement and meaning +even when their values happen to be constant for a stream. + +When the agreed route selects no Descriptor, the Producer MUST supply all +REQUIRED OPC UA values through the other locations defined above. An absent +`describedby` alone does not determine whether a Descriptor was selected. +Producers SHOULD use Descriptor metadata only when the intended Consumers +support the agreed mapping. + +When `source` is itself a Descriptor URL, Producers SHOULD supply shared +identity metadata in the selected versioned Descriptor instead of appending +query parameters to that URL. Appending a query changes the event's source +identity and can change the retrieved resource. Consumers MUST NOT strip a query +to make source-based retrieval work. ## Examples -The examples without a Context use publisher `UInt16:12` and writer name +The examples preceding the WoT section use publisher `UInt16:12` and writer name `energy-consumption-asset`. Their payloads omit the native headers, so their `source` queries supply both identifiers. @@ -646,14 +681,13 @@ recordedtime: 2024-03-28T23:59:59Z ### WoT and OPC UA telemetry message -This binary-mode keyframe uses the WoT event type and affordance subject. -Its Context supplies the resolved TD, payload schema, and PublisherId. The -`source` query supplies the DataSetWriterId because the Context does not -identify the writer. The native OPC UA message type and sequence remain in the -event because they can vary within this stream. The example uses writer ID -`17` within publisher `UInt16:12`. The CloudEvents `sequence` attribute is -absent because this example does not define a source-wide ordering across -DataSetWriters. +This binary-mode keyframe uses the WoT event type and named affordance subject. +Its Descriptor supplies the resolved TD, payload schema, PublisherId, +DataSetWriter identity and dataset name. The native OPC UA message type and +sequence remain in the event because they can vary within this stream. The +example uses writer ID `17` within publisher `UInt16:12`. The CloudEvents +`sequence` attribute is absent because this example does not define a +source-wide ordering across DataSetWriters. ```text ------------------ PUBLISH ------------------- @@ -665,11 +699,11 @@ Content Type: application/json specversion: 1.0 id: ua-message-25460 -source: mqtt://site/line/cell/device/sensor?opcuadatasetwriterid=17;site=north +source: https://registry.example/descriptorgroups/devices/descriptors/pump7 type: com.example.models.tm.pump.properties.processData.v1 -subject: #/properties/processData +subject: pump7#/properties/processData time: 2026-10-29T12:00:00Z -contexturl: https://registry.example/contextgroups/line1/contexts/opcua-pump-process-data/versions/1 +describedby: https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1 opcuamessagetype: ua-keyframe opcuasequence: 4294967295 @@ -683,41 +717,61 @@ opcuasequence: 4294967295 ----------------------------------------------- ``` -The referenced Context Version has the following metadata. Other Core +The referenced Descriptor Version has the following metadata. Other Core metadata is omitted from this excerpt. ```json { - "contextid": "opcua-pump-process-data", + "descriptorid": "pump7-telemetry", "versionid": "1", + "schemaref": "payload", "references": { - "emitter": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3", + "planurl": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7-plan/versions/3" }, - "schema": { - "url": "https://example.com/schemas/pump-process-data/versions/3" + "gateway1": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1" + }, + "payload": { + "class": "schema", + "url": "https://schemas.example/pump-process-data/versions/3" + }, + "geometry": { + "class": "usdasset", + "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" } }, - "opcuapublisherid": "UInt16:12" + "opcuapublisherid": "UInt16:12", + "opcuadatasetwriterid": 17, + "opcuadatasetwritername": "pump7-process", + "opcuadatasetname": "PumpProcessData" } ``` -The Consumer uses the writer ID from `source` and the PublisherId from the -Context with the event's `opcuamessagetype` and `opcuasequence`. It evaluates -`subject` against the TD selected by `emitter` and uses the schema selected by -`schema`. +The Consumer uses the selected Descriptor's PublisherId and writer identity with +the event's `opcuamessagetype` and `opcuasequence`. The subject's `pump7` prefix +selects the TD among two candidates; `schemaref` selects the payload schema. The +dataset name and writer name deliberately differ. + +With an agreed source-Descriptor binding, a Producer can instead use the +stream's Descriptor Version URL as `source` and omit `describedby`. This changes +the source identity; it is not an identity-preserving rewrite of already +published events. -#### Retaining the NetworkMessage envelope +#### Direct TD subject with the NetworkMessage envelope This event retains the full Part 14 NetworkMessage envelope. Its PublisherId and DataSetWriterId satisfy the identity requirements, so `source` needs no publisher or writer query parameters. Part 14 JSON encodes the configured PublisherId `UInt16:12` as the string `"12"`. -Context Version `2` retains the same `emitter` Reference and points its `schema` -Reference to `https://example.com/schemas/pump-process-data-envelope/versions/1`. -It contains no publisher or writer attributes. The event type uses revision -`v2` because retaining the envelope changes the payload contract. +The direct subject supplies the TD URL and affordance pointer; `dataschema` +supplies the envelope's schema. No Descriptor is REQUIRED, so `describedby` is +omitted. The event type uses revision `v2` because retaining the envelope +changes the payload contract. ```text ------------------ PUBLISH ------------------- @@ -731,9 +785,9 @@ specversion: 1.0 id: ua-message-25461 source: mqtt://site/line/cell/device/sensor?site=north type: com.example.models.tm.pump.properties.processData.v2 -subject: #/properties/processData +subject: https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3#/properties/processData time: 2026-10-29T12:00:01Z -contexturl: https://registry.example/contextgroups/line1/contexts/opcua-pump-process-data/versions/2 +dataschema: https://schemas.example/pump-process-data-envelope/versions/1 opcuasequence: 0 ------------------ payload ------------------- @@ -760,21 +814,23 @@ opcuasequence: 0 ``` The native sequence has rolled over from `4294967295` to `0`; it remains -`opcuasequence`, not a CloudEvents `sequence`. The event still uses `contexturl` -to select its TD and schema. The DataSetMessage's `MessageType` remains in the -retained NetworkMessage envelope instead of being repeated as +`opcuasequence`, not a CloudEvents `sequence`. The subject selects its TD +directly without a source lookup. The DataSetMessage's `MessageType` remains in +the retained NetworkMessage envelope instead of being repeated as `opcuamessagetype`. -## Context Retrieval Security +## Descriptor Retrieval Security -The Event Context extension's retrieval, authorization, and cache rules apply -to this mapping. Stable writer metadata in a Context does not authenticate -the Publisher or authorize access to the referenced TD or schema. A Consumer -MUST establish trust in the Context before using it as OPC UA metadata. +The Descriptor Reference extension's retrieval, authorization and cache rules +apply to this mapping. Stable writer metadata in a Descriptor does not +authenticate the Publisher or authorize access to the referenced TD or schema. A +Consumer MUST establish trust in the Descriptor before using it as OPC UA +metadata. [UA DataSetWriterName]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table185 [UA NetworkMessage]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/7.2.5.3 [UA DataSetWriterId]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.4.1 [UA PublisherId]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.7.1 [UA SequenceNumber]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.3 +[UA DataSet Metadata]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.3 [URI]: https://www.rfc-editor.org/rfc/rfc3986 diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 0d1be6947..cdd0748ff 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -1,16 +1,17 @@ # Web of Things This profile maps a [Web of Things Thing Description][TD] (TD) to CloudEvents -Core context attributes and the [Event Context extension](context.md). -The REQUIRED `contexturl` identifies shared metadata whose `emitter` Reference -selects the resolved TD. The `subject` identifies the part of that TD associated -with the event, and the `type` names the event contract. - -The profile defines no CloudEvents extension attributes. Producers and -Consumers agree on its use through a publication profile or out of band. -It does not define a transport binding, provision a Thing, or require a -particular registry implementation. Events use the xRegistry Context -representation defined by the Event Context extension. +Core context attributes and optionally the [Descriptor Reference +extension](describedby.md). The REQUIRED `subject` identifies a Thing or +affordance, either through a selected Descriptor or through a self-contained TD +document URL. The `type` names the event contract. + +The profile defines no new CloudEvents extension attributes. Producers and +Consumers agree on its use through a publication profile or configuration. It +does not define a transport binding, provision a Thing, or require a particular +registry implementation. A direct TD subject can supply the REQUIRED description +without a Descriptor; an explicit `describedby` can supply additional shared +information when needed. ## Notational Conventions @@ -26,13 +27,20 @@ attribute marked REQUIRED here is not REQUIRED in every CloudEvent. ### source -The Core [`source`](../spec.md#source) identifies the context in which the -event occurred and follows Core's URI-reference rules. This profile leaves -the content of `source` undefined beyond those Core requirements. +The Core [`source`](../spec.md#source) identifies the context in which the event +occurred and follows Core's URI-reference rules. It does not have to identify +the Thing selected by `subject`; an actor can emit an event concerning a +different device. For example, `https://factory.example.com/line1/pump7` and `mqtt://site/line/cell/device/sensor` are valid sources. +An agreed source-Descriptor binding MAY use an absolute, fragment-free +Descriptor URL as `source` when it identifies the originating context. Consumers +MUST NOT infer that binding merely from URL-like spelling. The +[description-selection rules](#description-selection) determine whether the +source is retrieved; a direct TD subject does not require that lookup. + #### Event identity Core requires `source` and `id` together to identify each distinct event. @@ -102,10 +110,9 @@ For example, adding a `quality` member to ignore the new member. A change to an individual value or the presence of a member already defined as -OPTIONAL does not change the contract revision. A change to `contexturl`, its -`emitter` Reference, or the selected schema alone also does not change the -revision; if it changes the payload contract, the Producer MUST use a new -revision. +OPTIONAL does not change the contract revision. A change to `describedby`, the +selected TD URL or the selected schema alone also does not change the revision; +if it changes the payload contract, the Producer MUST use a new revision. The Producer MUST configure a valid complete type when the derivation is unavailable, produces an invalid symbol, or collides with a different event @@ -116,17 +123,39 @@ silently rewriting identifiers or member names. ### subject -The [`subject`](../spec.md#subject) is REQUIRED. It MUST be an -[RFC 6901][JSON Pointer] URI-fragment pointer evaluated against the resolved -TD. For an event describing the whole Thing, the Producer MUST use `#`. For -an affordance event, the pointer MUST identify the concrete affordance in the -resolved TD, for example `#/properties/processData` or `#/events/alarm`. +The [`subject`](../spec.md#subject) is REQUIRED. It MUST be an [RFC 6901][JSON +Pointer] URI-fragment pointer with one of the prefixes defined below. The +pointer is evaluated against the selected ordinary, resolved TD, not Descriptor +metadata or an unresolved projection plan. + +| Subject form | Meaning | +| --- | --- | +| `#` or `#/properties/processData` | Select the unique TD Reference in the selected Descriptor, then the whole Thing or affordance. | +| `pump7#/properties/processData` | Select the Descriptor's named `thingdescription` Reference `pump7`, then its affordance. | +| `https://example.com/td/pump7/versions/3#/properties/processData` | Identify the Thing's affordance through a TD document URL; description selection follows the rules below. | + +The Consumer MUST split the value at the first literal `#`. A missing delimiter +is invalid. It recognizes a direct-URL candidate by an `http://` or `https://` +prefix, case-insensitively, and MUST validate that prefix as a complete absolute +HTTP(S) URL. Otherwise, the prefix MUST be empty or a Descriptor Reference name. +Reference names follow the Descriptor Registry's map-key rules and cannot +contain `/`; `http:pump7` can therefore be a name, but is not an HTTP URL. +Invalid input MUST NOT be retried through another form or resolved against +`source`. + +The suffix including `#` MUST be a valid JSON Pointer URI fragment. For the +whole Thing, the Producer MUST use an empty fragment, such as `#`, `pump7#` or +`https://example.com/td/pump7/versions/3#`. For an affordance event, the pointer +MUST identify the concrete affordance in that TD, such as +`#/properties/processData`, `#/actions/setSetpoint` or `#/events/alarm`. The Producer MUST escape JSON Pointer tokens before applying URI-fragment -encoding. For example, the property name `pressure/bar` is addressed by -`#/properties/pressure~1bar`. The Consumer MUST report a failure and leave -the event uncorrelated if the pointer is invalid or does not select the -intended member of the resolved view. +encoding. For example, property `pressure/bar` is addressed by +`#/properties/pressure~1bar`; a literal `#` in a name is percent-encoded. The +Consumer MUST apply URI-fragment decoding once, then JSON Pointer token decoding +as specified by RFC 6901. It MUST report a correlation failure if the encoding +or pointer is invalid or the pointer does not select the intended Thing or +affordance. The subject identifies the Thing or affordance, not an occurrence. Different events can have the same subject and different CloudEvents `id` values. A @@ -136,6 +165,11 @@ appended to this pointer. The concrete TD path and corresponding TM declaration path can differ. This profile does not infer a declaration-lineage mapping between them. +Changing a direct subject's TD Version URL changes the subject string used for +filtering and correlation, not the source-plus-id event identity. A +Descriptor-relative subject with an independently versioned `describedby` can +avoid that coupling. + ### dataschema and datacontenttype Core [`dataschema`](../spec.md#dataschema) identifies the schema that the @@ -143,10 +177,12 @@ CloudEvent's actual `data` adheres to. [`datacontenttype`](../spec.md#datacontenttype) identifies that data's media type. Neither identifies the TD document's format. -The Consumer follows the Event Context extension's schema precedence: -`dataschema`, then the Context's `schema` Reference, then the schema declared -by its `message` representation. The Producer SHOULD omit `dataschema` when -the Context supplies the schema. +The Consumer follows the Descriptor Reference extension's [schema +precedence](describedby.md#message-and-schema-selection): `dataschema`, then the +selected Descriptor's schema, then the schema declared by its selected Message +definition. Without a Descriptor, the second and third sources are absent. The +Producer SHOULD omit `dataschema` when a selected Descriptor already supplies +the schema. A TD describes interactions and can contain several DataSchemas. The Producer MUST NOT use the whole TD as `dataschema` merely because the TD @@ -155,52 +191,83 @@ valid `dataschema` only if the identified representation is itself the schema applicable to `data`. The publication profile or protocol binding defines how the selected -affordance's DataSchema maps to the wire payload. An object containing -several property values, an event payload and a protocol envelope can need -different schemas. When `dataschema` is present, the Producer MUST ensure -that it identifies the schema of the representation actually sent, including -any encoding or envelope selected by the binding. -The same requirement applies to a schema supplied by the Context. +affordance's DataSchema maps to the wire payload. An object containing several +property values, an event payload and a protocol envelope can need different +schemas. When `dataschema` is present, the Producer MUST ensure that it +identifies the schema of the representation actually sent, including any +encoding or envelope selected by the binding. The same requirement applies to a +schema supplied by a Descriptor. An xRegistry Schema Resource's document-view URL can identify that external schema. It is not the WoT Resource's metadata-view URL. A profile MAY require an exact schema Version independently of the selected TD Version. -## contexturl - -Every event using this profile MUST include `contexturl`. The Producer and -Consumer MUST implement the [Event Context extension](context.md). The Context -MUST contain an `emitter` Reference whose `url` identifies the resolved TD -document, not its Registry metadata. The Context Publisher SHOULD reference an -explicit TD Version and publish the resolved TD view at that URL. The Consumer -retrieves the document directly or uses the corresponding document in an -accepted resolved Context view. It MUST NOT derive a TD URL from `contexturl` -or from the `emitter` URL. - -The Context's `emitter` is authoritative for TD selection. The Consumer MUST -evaluate `subject` against that TD and MUST NOT select another TD from `source`. -This rule does not change Core's meaning of `source` or authenticate the -emitting entity. - -If `contexturl` is missing, the Context cannot be retrieved or is invalid, its -`emitter` Reference is missing or invalid, or the referenced TD is unavailable -or not resolved, the Consumer MUST report a resolution failure and leave the -event uncorrelated. It MUST NOT fall back to selection through `source`. It -MAY retain or forward the event without TD-based interpretation. - -The Context Publisher MUST make the TD available before configuring Producers -with the Context Version URL. Changes to its Reference require a new Context -Version. A change to the TD's resolved logical view requires a new TD Version; -the Context Publisher MUST NOT change that view at a previously published -Version URL. Context versioning alone does not make an unversioned TD URL -stable. - -Changing `contexturl` alone does not change event identity or sequence scope. -A Producer MUST NOT reuse an `id` or restart a source-wide sequence merely -because it publishes a new Context Version. - -The event carries no digest of the TD. An exact version or a successful -resolution does not by itself prove that retrieved bytes are unchanged. +## Description Selection + +This profile uses the [Descriptor Reference selection +rules](describedby.md#one-selected-processing-description), including when +`describedby` is absent. Apply event-format decoding before testing presence; +JSON `null` means unset. Selection proceeds as follows: + +1. If `describedby` is present, retrieve and validate its Descriptor. It is + authoritative; a failure MUST NOT cause fallback to source or direct TD + subject retrieval. +2. Otherwise, if `subject` has a direct HTTP(S) TD URL prefix, retrieve that + document. Use the prefix unchanged, including its query; the fragment is + evaluated locally and is not sent in HTTP. Do not retrieve a source + Descriptor or construct a synthetic Descriptor from the TD. +3. Otherwise, use the agreed source-Descriptor binding. Retrieve the exact + `source` URL, which MUST be an absolute URL without a fragment for this + binding. If no such binding was agreed, report a correlation failure. + +When a Descriptor is selected, select its TD Reference as follows: + +- For an empty subject prefix, the Descriptor MUST have exactly one + `thingdescription` Reference. +- For a Reference-name prefix, that entry MUST exist and its `class` MUST be + `thingdescription`. +- For a direct URL prefix, exactly one `thingdescription` Reference MUST + have a `url` equal to that prefix. Consumers MUST compare the strings exactly, + without URI normalization. Missing or duplicate matches are correlation + failures. A named subject can disambiguate duplicate URLs. + +The selected `url` identifies the ordinary TD document, not its Registry +metadata. The Consumer uses that representation directly or from an accepted +Descriptor bundle. It MUST NOT construct another URL from the Descriptor URL or +Reference. Redirect destinations, TD `id` and equal `entityid` values MUST NOT +be used to repair a subject-to-Reference mismatch. + +A `thingmodel` Reference cannot replace an instance TD. A document marked as an +unresolved [WoT projection plan][WoT Projections] MUST NOT be used as an +ordinary TD or re-resolved to replace the published result. OPTIONAL `planurl` +provenance follows the Descriptor Registry's class rules. Failure to retrieve +OPTIONAL provenance does not invalidate an otherwise usable TD, unless the +agreed profile requires that provenance. A detected invalid plan/view pairing is +invalid metadata. + +The Producer MUST supply all REQUIRED inputs through the selected route, the +event and the agreed publication profile. A direct TD subject without a +Descriptor does not supply missing Message definitions or native publisher +metadata. A Producer needing those shared inputs can use a complete Descriptor +with `describedby`. A Consumer MUST NOT merge them from source descriptions. + +If selection, retrieval or correlation fails, the Consumer MUST report the +failure and leave the event uncorrelated. It MAY retain or forward the event +without TD-based interpretation, but MUST NOT switch routes or substitute +another TD. This does not authenticate the originating entity or authorize an +action described by the TD. + +The Publisher MUST make the selected TD available before configuring Producers +with its URL or a Descriptor that references it. The Publisher SHOULD publish an +explicit TD Version. A change to the resolved logical view requires a new TD +Version; the Publisher MUST NOT change that view at a previously published +Version URL. Descriptor publication and Version stability follow the Descriptor +Registry rules. + +Changing only `describedby` does not change identity or sequence scope. A +Producer MUST NOT reuse an `id` or restart a source-wide sequence merely because +a description changes. An exact Version or successful resolution does not itself +prove that retrieved bytes are unchanged. ## Relationship to Other Extensions @@ -212,18 +279,126 @@ MUST follow that extension's conditional WoT mapping. ### Single Affordance -This CloudEvent identifies a pump and its `processData` property. Its Context -selects version `3.0.0` of the resolved TD and supplies the payload schema. +This CloudEvent identifies a pump and its `processData` property. Its Descriptor +selects version `3` of the resolved TD and supplies the payload schema. Another +TD in the same Descriptor describes a gateway. ```json { "specversion": "1.0", "id": "sample-4711", - "source": "mqtt://site/line/cell/device/sensor", + "source": "https://registry.example/descriptorgroups/devices/descriptors/pump7", + "type": "com.example.models.tm.pump.properties.processData.v1", + "subject": "pump7#/properties/processData", + "datacontenttype": "application/json", + "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1", + "data": { + "Speed": 1500, + "Pressure": 4.5 + } +} +``` + +The Descriptor has the following metadata. Core bookkeeping and any +profile-specific shared metadata are omitted from this excerpt. + +```json +{ + "descriptorid": "pump7-telemetry", + "versionid": "1", + "schemaref": "payload", + "references": { + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3", + "planurl": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7-plan/versions/3" + }, + "gateway1": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1" + }, + "payload": { + "class": "schema", + "url": "https://schemas.example/pump-process-data/versions/3" + }, + "geometry": { + "class": "usdasset", + "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" + } + } +} +``` + +The subject prefix selects `pump7`, not the first TD in the map. The suffix +selects its property. The payload directly contains the property's object value +without a `processData` wrapper. The selected schema describes that object, not +the TD document. The OPTIONAL plan and USD asset do not have to be retrieved for +this correlation. + +### Direct TD Subject + +This event needs only the TD and an external payload schema, so it omits +`describedby`. The source identifies an actor's originating context rather than +the pump; it is not retrieved. + +```json +{ + "specversion": "1.0", + "id": "sample-4712", + "source": "urn:example:actor:telemetry-service", + "type": "com.example.models.tm.pump.properties.processData.v1", + "subject": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3#/properties/processData", + "dataschema": "https://schemas.example/pump-process-data/versions/3", + "datacontenttype": "application/json", + "data": { + "Speed": 1500, + "Pressure": 4.5 + } +} +``` + +The Consumer retrieves the subject's fragment-free TD URL and evaluates +`#/properties/processData`. The URI fragment is not sent in HTTP. + +### Direct Subject with a Descriptor + +The preceding event can instead select the same telemetry Descriptor: + +```json +{ + "specversion": "1.0", + "id": "sample-4714", + "source": "urn:example:actor:telemetry-service", + "type": "com.example.models.tm.pump.properties.processData.v1", + "subject": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3#/properties/processData", + "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1", + "datacontenttype": "application/json", + "data": { + "Speed": 1500, + "Pressure": 4.5 + } +} +``` + +The direct subject matches exactly the `pump7` Reference. The Descriptor now +supplies the schema. Changing just the subject's TD Version to `4` would fail +correlation because this Descriptor names Version `3`. Adding another TD +Reference with that same Version `3` URL would also make the direct match +ambiguous; a named subject would then be REQUIRED. + +### Source-selected Descriptor + +When the agreed source-Descriptor binding is enabled, the Single Affordance +event can use the following complete envelope without `describedby`: + +```json +{ + "specversion": "1.0", + "id": "sample-4715", + "source": "https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1", "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "#/properties/processData", + "subject": "pump7#/properties/processData", "datacontenttype": "application/json", - "contexturl": "https://registry.example/contextgroups/line1/contexts/pump-process-data/versions/1", "data": { "Speed": 1500, "Pressure": 4.5 @@ -231,21 +406,17 @@ selects version `3.0.0` of the resolved TD and supplies the payload schema. } ``` -The Context metadata is shown in the -[Event Context example](context.md#example). Its `emitter` selects the TD, -and its `schema` selects the payload schema. -The subject selects the property in that resolved view. The payload directly -contains the property's object value without a `processData` wrapper. The -separate schema describes that object, not the TD document. Another pump can -use the same event type with a different Thing identity in its `source` and a -Context whose `emitter` describes that pump. +This intentionally identifies the stream Descriptor as the originating context. +Its source-plus-id namespace differs from the device-source example. A new +Version in `source` changes that namespace; a new Version in `describedby` alone +does not. ### Whole Thing -This CloudEvent carries aggregated data for the same pump. Its Context -selects version `3.0.0` of the resolved TD and the aggregate payload schema. -The publication profile defines a payload containing the `processData` and -`running` property values. The subject selects the whole TD. +This CloudEvent carries aggregated data for the same pump. Its Descriptor +selects version `3` of the resolved TD and the aggregate payload schema. The +publication profile defines a payload containing the `processData` and `running` +property values. The subject selects the whole TD. ```json { @@ -255,7 +426,7 @@ The publication profile defines a payload containing the `processData` and "type": "com.example.models.tm.pump.v1", "subject": "#", "datacontenttype": "application/json", - "contexturl": "https://registry.example/contextgroups/line1/contexts/pump-state/versions/1", + "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-state/versions/1", "data": { "processData": { "Speed": 1500, @@ -266,26 +437,30 @@ The publication profile defines a payload containing the `processData` and } ``` -The referenced Context Version contains the following metadata. +The referenced Descriptor Version contains the following metadata. ```json { - "contextid": "pump-state", + "descriptorid": "pump7-state", "versionid": "1", + "schemaref": "payload", "references": { - "emitter": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" }, - "schema": { - "url": "https://example.com/schemas/pump-state/versions/3" + "payload": { + "class": "schema", + "url": "https://schemas.example/pump-state/versions/3" } } } ``` -The `emitter` selects the TD used to interpret these property values. The TD -document itself is not the payload. The `schema` identifies the aggregate JSON -object, not the TD or either property's DataSchema alone. +The empty subject prefix selects the unique TD Reference. The TD document itself +is not the payload. `schemaref` selects the schema of the aggregate JSON object, +not the TD or either property's DataSchema alone. A direct whole-Thing subject +would end in `#` after its TD document URL. ## Security Considerations @@ -303,3 +478,4 @@ referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 +[WoT Projections]: https://github.com/marcschier/wot-thing-description/pull/1 From 0f5877775911518621c0d33817b8473c71ceab4e Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 14 Nov 2026 17:51:52 +0100 Subject: [PATCH 27/60] Align Descriptor schema selection and native metadata ranges Signed-off-by: Marc --- cloudevents/extensions/README.md | 2 +- .../{describedby.md => descriptors.md} | 55 ++++++++++--------- cloudevents/extensions/opcua.md | 46 ++++++++++------ cloudevents/extensions/wot.md | 37 +++++++------ 4 files changed, 79 insertions(+), 61 deletions(-) rename cloudevents/extensions/{describedby.md => descriptors.md} (90%) diff --git a/cloudevents/extensions/README.md b/cloudevents/extensions/README.md index 7fdfb70f4..b22e5b2a5 100644 --- a/cloudevents/extensions/README.md +++ b/cloudevents/extensions/README.md @@ -45,7 +45,7 @@ for more information. - [Data Classification](data-classification.md) - [Dataref (Claim Check Pattern)](dataref.md) - [Deprecation](deprecation.md) -- [Descriptor Reference](describedby.md) +- [Descriptor Reference](descriptors.md) - [Distributed Tracing](distributed-tracing.md) - [Expiry Time](expirytime.md) - [OPC UA](opcua.md) diff --git a/cloudevents/extensions/describedby.md b/cloudevents/extensions/descriptors.md similarity index 90% rename from cloudevents/extensions/describedby.md rename to cloudevents/extensions/descriptors.md index 27bedc731..efe2c36be 100644 --- a/cloudevents/extensions/describedby.md +++ b/cloudevents/extensions/descriptors.md @@ -2,7 +2,7 @@ The OPTIONAL `describedby` extension attribute identifies a Descriptor containing shared information for interpreting an event. A Descriptor can -reference schemas, Message definitions, WoT Thing Descriptions or other +reference schemas, WoT Thing Descriptions or other representations, and can contain typed metadata such as a publisher identity. It describes information relevant to the event, not necessarily only the event's source or subject. @@ -144,10 +144,10 @@ The [Descriptor Registry][Descriptor Registry] defines these members: | --- | --- | | `references` | REQUIRED map of local Reference names to objects containing `class` and `url`. An empty map is valid. | | `entityid`, `entitytype` | Describe a primary entity when one exists; not replacements for event source identity or authenticated principals. | -| `messageref`, `schemaref` | Select named Message and payload-schema References. | +| `schemaref` | Selects a named payload-schema Reference. | | Profile attributes | Typed shared metadata whose meaning and relation to event fields are defined by the applicable profile. | -Representation classes include `message`, `schema`, `thingdescription`, +Representation classes include `schema`, `thingdescription`, `thingmodel` and `usdasset`. Vendor classes use URI identifiers. Multiple References can have the same class. Reference names do not establish emitter, target, authority or execution roles. @@ -155,8 +155,8 @@ target, authority or execution roles. A Consumer MUST check response status, media type and Descriptor validity against that domain. A missing or incorrectly typed `references` map is invalid. An empty map can be valid but insufficient for a profile requiring a TD or -schema. Explicit selectors MUST name an existing Reference of the expected -class, even when the event supplies `dataschema`. +schema. An explicit `schemaref` MUST name an existing Reference of class +`schema`, even when the event supplies `dataschema`. For a valid Descriptor, the Consumer retrieves only the representations it needs, subject to its access and content-trust policies. It MUST use their URLs @@ -166,24 +166,24 @@ can be ignored if the profile does not need it; an unsupported REQUIRED input makes interpretation unavailable. Entity identity and class URIs are not automatic retrieval instructions. -### Message and schema selection +### Schema selection -The Consumer uses the Descriptor Registry's selection rule: an explicit selector -names one Reference; without a selector, a unique Reference of the requested -class is selected. Zero candidates means absence; multiple candidates mean -ambiguity, not permission to select the first entry. +The Consumer uses the Descriptor Registry's schema-selection rule: an explicit +`schemaref` names one Reference of class `schema`; without that selector, a +unique Reference of class `schema` is selected. Zero candidates means absence; +multiple candidates mean ambiguity, not permission to select the first entry. The Consumer selects the first applicable payload schema source: 1. The event's `dataschema`. 2. The Processing Descriptor's selected `schema` Reference. -3. The schema declared by its selected `message` representation. Only absence permits proceeding to the next source. Ambiguity, an invalid selector, unavailable selected content or an unsupported selected format MUST NOT cause fallback to a different schema. With no Processing Descriptor, the -second and third candidates are absent; the Consumer MUST NOT synthesize one -from the TD or other retrieved content. +second candidate is absent. If neither source supplies a schema REQUIRED by the +profile, the Consumer MUST report that missing input; it MUST NOT derive another +schema from a TD or other unselected representation. When `dataschema` is present, otherwise unselected schema inventory is irrelevant to precedence. Explicit Descriptor selector validity is still @@ -193,9 +193,9 @@ precedence without comparing schema documents. The Producer MUST ensure that the selected schema describes the actual `data` representation, including any protocol envelope. A TD containing several -DataSchemas is not automatically the payload schema. The selected Message -definition applies only according to the publication profile; Consumers MUST NOT -guess it by matching `type` or by inspecting names when selection is ambiguous. +DataSchemas is not automatically the payload schema. Consumers MUST NOT use +event-type matching or Reference-name conventions to resolve an ambiguous +schema selection. ### Failure outcomes @@ -226,11 +226,13 @@ configured Version URLs when that information is unchanged. Producers are not REQUIRED to perform runtime validation of each event by this extension. A Descriptor Resource URL selects its current default Version, which can change. -Consumers SHOULD bound the freshness of cached Resource responses. A Version -fixes its published metadata, not the bytes at referenced URLs. Publishers -SHOULD pin REQUIRED representation Versions and retain them with the Descriptor -for the replay period. There is no lookup of the Version intended at event -`time`, and an ETag does not reconstruct that history. +Consumers SHOULD bound the freshness of cached Resource responses. Under the +Descriptor Registry's publication rule, the Publisher MUST keep referenced +representations stable for the intended processing and replay period. +Publishers SHOULD pin representation Versions and retain them with the +Descriptor for that period. A Version identifier alone is not evidence that +the Publisher has met the stability requirement. There is no lookup of the +Version intended at event `time`, and an ETag does not reconstruct that history. `source` plus `id` retains its Core uniqueness rule. Changing `source`, including a Version segment or query, changes the identity and source-wide @@ -258,11 +260,12 @@ by the [Descriptor Registry][Descriptor Registry]. Each document entry uses the same Reference name and records its exact URL, content type, content or base64 bytes, and redirect base URL when applicable. -The bundle covers each direct `references.*.url` or returns an error. It does -not fetch `planurl`, entity/class identifiers or transitive dependencies, and is -not a snapshot across Registries. An empty Reference map has an empty document -map. Relative dependencies use the target's recorded retrieval base, not the -Descriptor's URL. +The bundle covers each direct `references.*.url` or returns an error. Additional +representations to be included MUST be listed as named References. An empty +Reference map has an empty document map. Relative dependencies use the +referenced representation's recorded retrieval base, not the Descriptor's URL. +Stable published inputs do not make the bundle an atomic snapshot across +Registries. This behavior is additional to Core metadata serving. Content negotiation alone does not collect referenced URLs. A Publisher can prebuild a bundle for a diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index e4db2b9da..afbb8db9b 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -6,7 +6,7 @@ DataSetMessages to CloudEvents for routing over supported protocols. It defines mappings for Core and other extension attributes and specifies OPC UA extension attributes. -When used with the [Descriptor Reference extension](describedby.md) and the +When used with the [Descriptor Reference extension](descriptors.md) and the xRegistry Descriptor model, metadata that stays constant for a message stream is preferably stored in the selected Descriptor rather than repeated in each event. The existing OPC UA attributes remain defined and usable. A Producer MUST supply @@ -105,9 +105,9 @@ separate format like [JSON schema](https://json-schema.org/specification) or those cases the attribute references the schema and is used for versioning. When the Descriptor Reference selection rules are used, a Producer MAY select a -Descriptor whose schema Reference or Message definition supplies this schema +Descriptor whose selected schema Reference supplies this schema instead. The Consumer follows that extension's [schema -precedence](describedby.md#message-and-schema-selection), including its selector +precedence](descriptors.md#schema-selection), including its selector and ambiguity rules. The Producer SHOULD omit `dataschema` when the selected Descriptor supplies the schema. The selected schema MUST describe the actual `data`, including the full NetworkMessage envelope when one is retained. @@ -198,6 +198,15 @@ field `MetaDataVersion`. - Constraints - OPTIONAL but MUST NOT be present if `dataschema` is used +Both metadata-version event attributes use the CloudEvents `Integer` type. +Their native [VersionTime][UA VersionTime] values are unsigned, so the +representable event-attribute range is `0` to `2147483647`, inclusive. +A Producer encoding a native value in either event attribute MUST preserve +that value exactly. If it exceeds this range, the Producer MUST report an +encoding error rather than truncate, wrap or reinterpret it as a negative +value. The full native range can be carried in the selected Descriptor +metadata described below, or in an applicable native payload representation. + ### opcuastatus - Type: `Integer` @@ -376,7 +385,7 @@ DataSetWriter with a defined payload contract. It is not necessarily a broker topic or a CloudEvents `source`; either can carry several streams. When Producers and Consumers agree to use this extension with the [Descriptor -Reference selection rules](describedby.md#one-selected-processing-description), +Reference selection rules](descriptors.md#one-selected-processing-description), the Publisher SHOULD store metadata that is constant for the stream as Descriptor Version extension attributes. The agreed binding selects the Descriptor through `describedby` or a profile-defined source or subject mapping. @@ -397,16 +406,21 @@ processed. | `opcuadatasetwriterid` | The stream's native DataSetWriterId, when used. | | `opcuadatasetwritername` | The stream's configured DataSetWriterName, when used. | | `opcuadatasetname` | The non-empty `Name` of the applicable DataSet metadata; descriptive, not a writer identifier. | -| `opcuametadatamajorversion` | The MajorVersion of the applicable native metadata, when no payload schema is selected. | -| `opcuametadataminorversion` | The MinorVersion of the applicable native metadata, when no payload schema is selected. | - -Publisher, writer and metadata-version members MUST use the constraints and -mappings defined in [Attributes](#attributes) and [Publisher and Writer -Metadata](#publisher-and-writer-metadata). For example, a Descriptor's -`opcuadatasetwriterid` is a JSON integer, not a string. The Descriptor's -selected schema Reference identifies an external payload schema. Native -metadata-version attributes MUST NOT be supplied in the event or Descriptor when -a schema is selected through `dataschema` or the Descriptor. +| `opcuametadatamajorversion` | The native MajorVersion as a JSON integer in `0` to `4294967295`, when no payload schema is selected. | +| `opcuametadataminorversion` | The native MinorVersion as a JSON integer in `0` to `4294967295`, when no payload schema is selected. | + +Publisher and writer members MUST use the constraints and mappings defined +in [Publisher and Writer Metadata](#publisher-and-writer-metadata). For +example, a Descriptor's `opcuadatasetwriterid` is a JSON integer, not a string. +The Descriptor metadata-version members MUST preserve the full native +`VersionTime` (`UInt32`) range, `0` to `4294967295`, inclusive. These are +Descriptor members, not CloudEvents `Integer` attributes. Consumers MUST +compare duplicate event and Descriptor values without narrowing either value. +Out-of-range Descriptor values are invalid metadata. + +The Descriptor's selected schema Reference identifies an external payload +schema. Native metadata-version attributes MUST NOT be supplied in the event +or Descriptor when a schema is selected through `dataschema` or the Descriptor. `opcuadatasetname` is an OPTIONAL Descriptor attribute, not a new CloudEvents attribute or source query parameter. If supplied, it MUST be a non-empty String @@ -728,8 +742,7 @@ metadata is omitted from this excerpt. "references": { "pump7": { "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3", - "planurl": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7-plan/versions/3" + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" }, "gateway1": { "class": "thingdescription", @@ -833,4 +846,5 @@ metadata. [UA PublisherId]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.7.1 [UA SequenceNumber]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.3 [UA DataSet Metadata]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.3 +[UA VersionTime]: https://reference.opcfoundation.org/specs/OPC-10000-4/v1.05.07/7.43 [URI]: https://www.rfc-editor.org/rfc/rfc3986 diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index cdd0748ff..1046dfd8a 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -2,7 +2,7 @@ This profile maps a [Web of Things Thing Description][TD] (TD) to CloudEvents Core context attributes and optionally the [Descriptor Reference -extension](describedby.md). The REQUIRED `subject` identifies a Thing or +extension](descriptors.md). The REQUIRED `subject` identifies a Thing or affordance, either through a selected Descriptor or through a self-contained TD document URL. The `type` names the event contract. @@ -178,9 +178,9 @@ CloudEvent's actual `data` adheres to. type. Neither identifies the TD document's format. The Consumer follows the Descriptor Reference extension's [schema -precedence](describedby.md#message-and-schema-selection): `dataschema`, then the -selected Descriptor's schema, then the schema declared by its selected Message -definition. Without a Descriptor, the second and third sources are absent. The +precedence](descriptors.md#schema-selection): `dataschema`, then the +selected Descriptor's schema. Without a Descriptor, the second source is +absent. The Producer SHOULD omit `dataschema` when a selected Descriptor already supplies the schema. @@ -205,7 +205,7 @@ an exact schema Version independently of the selected TD Version. ## Description Selection This profile uses the [Descriptor Reference selection -rules](describedby.md#one-selected-processing-description), including when +rules](descriptors.md#one-selected-processing-description), including when `describedby` is absent. Apply event-format decoding before testing presence; JSON `null` means unset. Selection proceeds as follows: @@ -237,18 +237,20 @@ Descriptor bundle. It MUST NOT construct another URL from the Descriptor URL or Reference. Redirect destinations, TD `id` and equal `entityid` values MUST NOT be used to repair a subject-to-Reference mismatch. -A `thingmodel` Reference cannot replace an instance TD. A document marked as an -unresolved [WoT projection plan][WoT Projections] MUST NOT be used as an -ordinary TD or re-resolved to replace the published result. OPTIONAL `planurl` -provenance follows the Descriptor Registry's class rules. Failure to retrieve -OPTIONAL provenance does not invalidate an otherwise usable TD, unless the -agreed profile requires that provenance. A detected invalid plan/view pairing is -invalid metadata. +A `thingmodel` Reference cannot replace an instance TD. The selected +representation MUST be an ordinary resolved TD. The +[WoT Descriptor profile][WoT Descriptor Profile] defines the TD/TM admission +and provenance rules, including profile-specific `planurl` and plan/view +pairing. Consumers using that profile MUST apply its admission and provenance +rules. Failure to obtain or validate a REQUIRED profile input MUST cause a +reported correlation failure. Unavailable OPTIONAL provenance does not prevent +correlation with an otherwise usable TD. The generic Descriptor model does not +define those provenance attributes. The Producer MUST supply all REQUIRED inputs through the selected route, the event and the agreed publication profile. A direct TD subject without a -Descriptor does not supply missing Message definitions or native publisher -metadata. A Producer needing those shared inputs can use a complete Descriptor +Descriptor does not supply an external payload schema or native publisher +metadata. A Producer needing shared inputs can use a complete Descriptor with `describedby`. A Consumer MUST NOT merge them from source descriptions. If selection, retrieval or correlation fails, the Consumer MUST report the @@ -310,8 +312,7 @@ profile-specific shared metadata are omitted from this excerpt. "references": { "pump7": { "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3", - "planurl": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7-plan/versions/3" + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" }, "gateway1": { "class": "thingdescription", @@ -332,7 +333,7 @@ profile-specific shared metadata are omitted from this excerpt. The subject prefix selects `pump7`, not the first TD in the map. The suffix selects its property. The payload directly contains the property's object value without a `processData` wrapper. The selected schema describes that object, not -the TD document. The OPTIONAL plan and USD asset do not have to be retrieved for +the TD document. The USD asset does not have to be retrieved for this correlation. ### Direct TD Subject @@ -478,4 +479,4 @@ referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 -[WoT Projections]: https://github.com/marcschier/wot-thing-description/pull/1 +[WoT Descriptor Profile]: https://github.com/xregistry/spec/pull/796 From 2b122bb9ea420b24ffccb53c6e0a05c20082ac7a Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 14 Nov 2026 17:52:56 +0100 Subject: [PATCH 28/60] Pin relocated WoT Descriptor profile reference Signed-off-by: Marc --- cloudevents/extensions/wot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 1046dfd8a..b5cba94cc 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -479,4 +479,4 @@ referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 -[WoT Descriptor Profile]: https://github.com/xregistry/spec/pull/796 +[WoT Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/28b6d245fb4f634bb172e0505ae8e64fdf882428/workingdrafts/models/wot/spec.md#66-wot-descriptor-profile From 1c4caca73c69a7e076e75fe0727f6a216c83e500 Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 15 Nov 2026 08:58:21 +0100 Subject: [PATCH 29/60] Add subject Descriptor indirection and OPC UA Descriptor profile Signed-off-by: Marc --- cloudevents/extensions/descriptors.md | 67 +++-- cloudevents/extensions/opcua.md | 223 ++++++++++++---- cloudevents/extensions/wot.md | 354 +++++++++++++++++++++----- 3 files changed, 515 insertions(+), 129 deletions(-) diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptors.md index efe2c36be..926c270c0 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptors.md @@ -2,10 +2,9 @@ The OPTIONAL `describedby` extension attribute identifies a Descriptor containing shared information for interpreting an event. A Descriptor can -reference schemas, WoT Thing Descriptions or other -representations, and can contain typed metadata such as a publisher identity. It -describes information relevant to the event, not necessarily only the event's -source or subject. +reference schemas and other representations, and can contain typed metadata +defined by an applicable profile. It describes information relevant to the +event, not necessarily only the event's source or subject. This proposal is developed with the Descriptor Registry revision of [xregistry/spec#796][Descriptor Registry]. That domain defines the metadata-only @@ -78,6 +77,11 @@ Core attributes retain their meaning: | `dataschema` | Identifies the schema that the event's `data` adheres to. | | `describedby` | Identifies additional shared information for interpreting the event. It does not replace any of the above. | +The **Processing Descriptor** is selected for processing inputs. A profile can +separately use a **Subject Descriptor** to describe the subject. These are uses +of a Descriptor, not additional Resource types. Retrieving a Subject Descriptor +does not make it the Processing Descriptor. + A Producer SHOULD omit `describedby` when the event and agreed profile already supply all REQUIRED inputs. If only an external payload schema is needed, `dataschema` supplies that relationship without a Descriptor. @@ -97,10 +101,12 @@ arbitrary subject strings against `source`. Core URNs and relative source references remain valid; a profile needing direct retrieval MUST define an appropriate retrievable value or use `describedby`. -The [WoT profile](wot.md#description-selection) defines both Descriptor-relative -subjects and self-contained TD URL subjects. The latter can select a TD without -any Descriptor. This extension does not define a universal syntax for following -references from an entity record into another document. +The [WoT profile](wot.md#description-selection) defines Descriptor-relative +subjects, self-contained TD URL subjects, and fragment-free Subject Descriptor +Version URLs. The last form supplies the TD selection, pointer and subject +annotations through a Subject Descriptor, independently of processing inputs. +The direct TD form can select a TD without any Descriptor. Each form follows +that profile's representation and validation rules. ### One selected processing description @@ -108,18 +114,30 @@ references from an entity record into another document. | --- | --- | | `describedby` is present and valid | Select that Descriptor, whether or not source or subject descriptions are also available. | | `describedby` is present but invalid, unavailable or incomplete | Report the condition. Do not fall back to source or subject descriptions. | -| `describedby` is absent and the agreed profile defines source or subject retrieval | Use the profile's selected route. | +| `describedby` is absent and the agreed profile defines source or subject retrieval | Use the profile's selected route and role; subject retrieval alone supplies no Processing Descriptor. | | `describedby` is absent and no retrieval mapping applies | This extension supplies no description. Do not probe source or subject. | | `source` and `describedby` have the same URL | One retrieval per representation and authorization context can serve both uses; event identity is unchanged. | +| `subject` and `describedby` explicitly identify the same Descriptor URL | Retrieval can be reused, but subject and processing requirements MUST be evaluated independently. | -When present, `describedby` MUST select a Descriptor supplying all Descriptor -inputs REQUIRED by the profile. It need not duplicate information already -supplied by the event. A Consumer MUST NOT merge missing fields from a source or +When present, `describedby` MUST select a Descriptor supplying all processing +inputs that the profile requires from a Descriptor. Subject selection and +annotations follow their separately defined subject role. The Processing +Descriptor need not duplicate information already supplied by the event. +A Consumer MUST NOT merge missing fields from a source or subject description, including when both descriptions identify the same entity. The Source Descriptor and Processing Descriptor can describe different entities, such as an actor and a device; differing entity identities alone are not a metadata conflict. +A Subject Descriptor supplies only the subject information defined by its +profile. Its schema References, `schemaref` or protocol metadata MUST NOT supply +missing processing inputs. If the same URL is explicitly selected through +`describedby`, that representation can supply processing inputs in its +separately validated processing role. Equal URLs permit reuse of an authorized +representation; they do not imply a role that the event did not select. A +profile MAY require consistency between a Subject Descriptor and the Processing +Descriptor without merging their contents. + When `describedby` is absent, a profile MUST distinguish its retrieval routes before access. There is no general "try source, then subject" algorithm. A failure in the selected route MUST NOT cause an implicit switch to another @@ -147,10 +165,10 @@ The [Descriptor Registry][Descriptor Registry] defines these members: | `schemaref` | Selects a named payload-schema Reference. | | Profile attributes | Typed shared metadata whose meaning and relation to event fields are defined by the applicable profile. | -Representation classes include `schema`, `thingdescription`, -`thingmodel` and `usdasset`. Vendor classes use URI identifiers. Multiple -References can have the same class. Reference names do not establish emitter, -target, authority or execution roles. +The Descriptor base defines the representation class `schema`. Technology +profiles own other class definitions and identify them by URI; Consumers compare +those identifiers exactly. Multiple References can have the same class. +Reference names do not establish emitter, target, authority or execution roles. A Consumer MUST check response status, media type and Descriptor validity against that domain. A missing or incorrectly typed `references` map is invalid. @@ -185,6 +203,11 @@ second candidate is absent. If neither source supplies a schema REQUIRED by the profile, the Consumer MUST report that missing input; it MUST NOT derive another schema from a TD or other unselected representation. +In particular, a Subject Descriptor is not the second candidate unless the event +also explicitly selects it as the Processing Descriptor. A subject-only route +uses the event's `dataschema` when an external payload schema is needed; it does +not trigger a source lookup or a schema search in the subject record. + When `dataschema` is present, otherwise unselected schema inventory is irrelevant to precedence. Explicit Descriptor selector validity is still checked. Publishers and Producers SHOULD supply one applicable schema source, or @@ -263,7 +286,7 @@ bytes, and redirect base URL when applicable. The bundle covers each direct `references.*.url` or returns an error. Additional representations to be included MUST be listed as named References. An empty Reference map has an empty document map. Relative dependencies use the -referenced representation's recorded retrieval base, not the Descriptor's URL. +referenced representation's recorded retrieval base, not the descriptor's URL. Stable published inputs do not make the bundle an atomic snapshot across Registries. @@ -302,7 +325,8 @@ generic example does not assert the WoT or OPC UA profile. ``` The Processing Descriptor contains the following metadata; Core bookkeeping is -omitted. Its schema describes the decision payload, not the TD document. +omitted. Its schema describes the decision payload, not the TD document. The +TD's URI class is defined by the WoT profile, not the Descriptor base. ```json { @@ -311,7 +335,7 @@ omitted. Its schema describes the decision payload, not the TD document. "schemaref": "payload", "references": { "pump7": { - "class": "thingdescription", + "class": "https://xregistry.io/classes/thingdescription", "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" }, "payload": { @@ -334,8 +358,9 @@ also select a sufficient Descriptor through `source`, or retrieve a subject description through a defined mapping. Neither case is inferred by a generic Consumer. -The [WoT examples](wot.md#examples) show a concrete direct TD subject without a -Descriptor and a source-selected Descriptor. The [OPC UA +The [WoT examples](wot.md#examples) show a direct TD subject without a +Descriptor, a source-selected Processing Descriptor and a Subject Descriptor +Version used independently of processing inputs. The [OPC UA mapping](opcua.md#shared-stream-metadata-in-a-descriptor) defines when a selected Descriptor Version supplies native stream metadata. diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index afbb8db9b..c5a7c2c79 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -8,14 +8,15 @@ attributes. When used with the [Descriptor Reference extension](descriptors.md) and the xRegistry Descriptor model, metadata that stays constant for a message stream is -preferably stored in the selected Descriptor rather than repeated in each event. -The existing OPC UA attributes remain defined and usable. A Producer MUST supply -publisher and writer metadata REQUIRED by this mapping in the `source` query -when neither the full Part 14 NetworkMessage envelope nor the selected +preferably stored in the Processing Descriptor rather than repeated in each +event. The existing OPC UA attributes remain defined and usable. A Producer MUST +supply publisher and writer metadata REQUIRED by this mapping in the `source` +query when neither the full Part 14 NetworkMessage envelope nor the selected Descriptor supplies it. The [shared metadata rules](#shared-stream-metadata-in-a-descriptor) describe how a Consumer obtains these values. A direct WoT TD subject can identify its description without a -Descriptor, but does not supply these native identities. +Processing Descriptor. A Subject Descriptor can supply the TD pointer and +annotations. Neither subject route supplies these native identities. ## Notational Conventions @@ -44,7 +45,8 @@ Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) field `applicationUri` or a customer-configured identifier such as a unified namespace path. For data and event messages, a Producer MUST include each publisher or writer query parameter REQUIRED by the mapping unless the full OPC UA Part 14 -NetworkMessage envelope or the Descriptor supplies its corresponding value. +NetworkMessage envelope or the Processing Descriptor supplies its corresponding +value. ### type @@ -66,11 +68,11 @@ messages: - `type` MUST follow the WoT profile's semantic event-type rules instead of mapping to the native `MessageType`. -- `subject` MUST follow the WoT profile's Descriptor-relative or direct-TD - subject rules. +- `subject` MUST follow the WoT profile's Descriptor-relative, direct-TD or + Subject Descriptor Version rules. - The native PublisherId and at least one DataSetWriter identifier MUST be available from the full Part 14 NetworkMessage envelope, `source`, or the - selected Descriptor, as defined in [Publisher and Writer + Processing Descriptor, as defined in [Publisher and Writer Metadata](#publisher-and-writer-metadata). - Nothing MUST be appended to `subject`. For an event message, the `EventId` remains in the OPC UA event payload. @@ -117,8 +119,8 @@ Descriptor supplies the schema. The selected schema MUST describe the actual For metadata, data, and event messages, a Producer MAY map `subject` to `DataSetWriterId` or `DataSetWriterName` from the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164). -A Producer using the WoT profile MUST instead follow its Descriptor-relative or -direct-TD subject mapping. +A Producer using the WoT profile MUST instead follow its Descriptor-relative, +direct-TD or Subject Descriptor Version mapping. For an OPC UA event message (`type` equals `ua-event`), a Producer using the OPC UA-specific `subject` mapping MUST append "/" and the @@ -258,8 +260,8 @@ than omit the status, wrap the value, or report it as _Good_. The following values identify the OPC UA Publisher and DataSetWriter. They are not CloudEvents extension attributes. A Producer MUST supply each REQUIRED value as a query parameter in `source` or an extension attribute of the applicable -Descriptor Version unless the full Part 14 NetworkMessage envelope supplies it. -The names are the same in the query and Descriptor representations. +Processing Descriptor Version unless the full Part 14 NetworkMessage envelope +supplies it. The names are the same in the query and Descriptor representations. | Name | Value | | --- | --- | @@ -378,20 +380,41 @@ duplicated native values MUST agree after applying the specified mappings. The Consumer MUST report a conflict and MUST NOT interpret a message as conforming to this extension when they disagree. -## Shared Stream Metadata in a Descriptor +## OPC UA Descriptor Profile + +This profile defines how a CloudEvent and a selected xRegistry Processing +Descriptor convey native OPC UA PubSub metadata. OPC UA Part 14 defines the +native Publisher, DataSetWriter, DataSet and ConfigurationVersion concepts. This +section owns their Descriptor field names, representations, selection and +duplicate-value handling. + +Use of a Descriptor is OPTIONAL. A Producer and Consumer can satisfy the native +metadata requirements through the event's supported fields and retained envelope +without selecting a Descriptor. The Version requirement below applies when the +profile's shared fields are supplied by a Processing Descriptor, not merely +because the WoT profile or a Subject Descriptor is used. + +### Shared Stream Metadata in a Descriptor A message stream here is a configured flow from one Publisher and DataSetWriter with a defined payload contract. It is not necessarily a broker topic or a CloudEvents `source`; either can carry several streams. +In this section, shared metadata is read only from a Descriptor selected in the +processing role. Publishers MUST obtain the values from the native writer and +applicable metadata configuration governing the emitted message. A Subject +Descriptor's annotations do not establish that association. + When Producers and Consumers agree to use this extension with the [Descriptor Reference selection rules](descriptors.md#one-selected-processing-description), the Publisher SHOULD store metadata that is constant for the stream as -Descriptor Version extension attributes. The agreed binding selects the -Descriptor through `describedby` or a profile-defined source or subject mapping. -Storing stream-constant values once avoids repeating them in event attributes or -the `source` query. The Descriptor has no document body: these values are -members of its metadata object, alongside `references`. +Processing Descriptor Version extension attributes. The agreed binding selects +that Descriptor through `describedby` or its defined processing route. In the +WoT profile, the source-selected processing route applies only to short +Descriptor-relative subjects when `describedby` is absent. Storing +stream-constant values once avoids repeating them in event attributes or the +`source` query. The Descriptor has no document body: these values are members of +its metadata object, alongside `references`. The Publisher MAY store the following values in the Descriptor when they remain constant for every event using that Version. When a Descriptor supplies any of @@ -400,14 +423,18 @@ selected explicitly or through a profile-defined mapping. A Resource URL can select a different default Version when a delayed or replayed event is processed. -| Descriptor attribute | Meaning and conditions | -| --- | --- | -| `opcuapublisherid` | The stream's native PublisherId. | -| `opcuadatasetwriterid` | The stream's native DataSetWriterId, when used. | -| `opcuadatasetwritername` | The stream's configured DataSetWriterName, when used. | -| `opcuadatasetname` | The non-empty `Name` of the applicable DataSet metadata; descriptive, not a writer identifier. | -| `opcuametadatamajorversion` | The native MajorVersion as a JSON integer in `0` to `4294967295`, when no payload schema is selected. | -| `opcuametadataminorversion` | The native MinorVersion as a JSON integer in `0` to `4294967295`, when no payload schema is selected. | +| Descriptor attribute | JSON representation | Meaning and conditions | +| --- | --- | --- | +| `opcuapublisherid` | String | The stream's typed native PublisherId, under the rules in [Publisher and Writer Metadata](#publisher-and-writer-metadata). | +| `opcuadatasetwriterid` | Integer, `1` to `65535` | The stream's native DataSetWriterId, when used. | +| `opcuadatasetwritername` | Non-empty String | The stream's exact configured DataSetWriterName, when used. | +| `opcuadatasetname` | Non-empty String | The `Name` of the applicable DataSet metadata; descriptive, not a writer identifier. | +| `opcuametadatamajorversion` | Integer, `0` to `4294967295` | The native MajorVersion, when no payload schema is selected. | +| `opcuametadataminorversion` | Integer, `0` to `4294967295` | The native MinorVersion, when no payload schema is selected. | + +All ranges in this table are inclusive. These are native Descriptor values, not +new CloudEvents extension attributes. The metadata-version event attributes +retain their separate CloudEvents `Integer` constraints. Publisher and writer members MUST use the constraints and mappings defined in [Publisher and Writer Metadata](#publisher-and-writer-metadata). For @@ -418,6 +445,10 @@ Descriptor members, not CloudEvents `Integer` attributes. Consumers MUST compare duplicate event and Descriptor values without narrowing either value. Out-of-range Descriptor values are invalid metadata. +Metadata-version values retain their native [ConfigurationVersion][UA +ConfigurationVersion] meaning. Descriptor versioning does not change when Part +14 requires a MajorVersion or MinorVersion update. + The Descriptor's selected schema Reference identifies an external payload schema. Native metadata-version attributes MUST NOT be supplied in the event or Descriptor when a schema is selected through `dataschema` or the Descriptor. @@ -450,19 +481,31 @@ OPC UA message. If a REQUIRED value is absent from all applicable locations, the Consumer MUST report missing metadata and MUST NOT interpret the payload as a conforming OPC UA message. -A Consumer MUST use only the Descriptor selected by the agreed binding. If -`describedby` is present, missing values MUST NOT be taken from a source or -subject description. If its Descriptor cannot be retrieved, the Consumer MAY -interpret the native payload using the envelope, source query and explicit event -attributes when they supply every native requirement, but MUST NOT report -successful Descriptor-based interpretation or WoT correlation. The WoT profile's -explicit-link failure rules still apply. - -Without `describedby`, the revised WoT profile can select a direct TD subject -without a Descriptor. Native publisher and writer requirements then have to be -satisfied by the retained envelope or the existing source query. A direct TD -MUST NOT be treated as a source of missing OPC UA metadata. Consumers MUST NOT -retrieve a source Descriptor as an implicit supplement. +A Consumer MUST use only the Processing Descriptor selected by the agreed +binding for shared schema and native metadata inputs. If `describedby` is +present, missing values MUST NOT be taken from a source or subject description. +If its Descriptor cannot be retrieved, the Consumer MAY interpret the native +payload using the envelope, source query and explicit event attributes when they +supply every native requirement, but MUST NOT report successful Descriptor-based +interpretation or WoT correlation. The WoT profile's explicit-link failure rules +still apply. + +Without `describedby`, the WoT profile can select a direct TD subject or a +Subject Descriptor Version without selecting a Processing Descriptor. Native +publisher and writer requirements then have to be satisfied by the retained +envelope or the existing source query. A direct TD, Subject Descriptor or its +`wotsubject` annotations MUST NOT supply missing OPC UA metadata or a payload +schema. Consumers MUST NOT retrieve a source Descriptor as an implicit +supplement. + +With `describedby`, a Subject Descriptor's selected TD URL MUST match exactly +one TD Reference in the Processing Descriptor under the [WoT correlation +rules](wot.md#subject-descriptor-selection). The Subject Descriptor supplies +only the TD pointer and subject annotations. If the same URL is explicitly +selected by both `subject` and `describedby`, the representation MAY supply +native metadata in its separately validated processing role. Neither equal URLs +nor the presence of native metadata in the subject record establishes that role +without explicit selection. The Descriptor Publisher MUST NOT change these values in a Descriptor Version after any Producer is configured with its URL. A change requires a new @@ -480,11 +523,11 @@ also remain in the event. A Consumer MUST NOT use Descriptor members with those names as event values. Core attributes retain their normal placement and meaning even when their values happen to be constant for a stream. -When the agreed route selects no Descriptor, the Producer MUST supply all -REQUIRED OPC UA values through the other locations defined above. An absent -`describedby` alone does not determine whether a Descriptor was selected. -Producers SHOULD use Descriptor metadata only when the intended Consumers -support the agreed mapping. +When the agreed route selects no Processing Descriptor, the Producer MUST supply +all REQUIRED OPC UA values through the other locations defined above. An absent +`describedby` alone does not determine whether a Processing Descriptor was +selected. Producers SHOULD use Descriptor metadata only when the intended +Consumers support the agreed mapping. When `source` is itself a Descriptor URL, Producers SHOULD supply shared identity metadata in the selected versioned Descriptor instead of appending @@ -492,6 +535,59 @@ query parameters to that URL. Appending a query changes the event's source identity and can change the retrieved resource. Consumers MUST NOT strip a query to make source-based retrieval work. +### xRegistry Model Mapping + +A deployment can add these OPTIONAL Version attributes to its Descriptor +Resource model: + +```json +{ + "opcuapublisherid": { + "name": "opcuapublisherid", + "type": "string" + }, + "opcuadatasetwriterid": { + "name": "opcuadatasetwriterid", + "type": "uinteger" + }, + "opcuadatasetwritername": { + "name": "opcuadatasetwritername", + "type": "string" + }, + "opcuadatasetname": { + "name": "opcuadatasetname", + "type": "string" + }, + "opcuametadatamajorversion": { + "name": "opcuametadatamajorversion", + "type": "uinteger" + }, + "opcuametadataminorversion": { + "name": "opcuametadataminorversion", + "type": "uinteger" + } +} +``` + +This fragment declares storage types, not every range or native consistency +rule. The Consumer MUST report invalid metadata when supplied values violate +this profile's type, range or native mapping constraints. Core write/null rules +apply to Descriptor updates; CE event-attribute null decoding is not a way to +accept null as a supplied native Descriptor value. + +JSON integers in this profile preserve the full native ranges. An alternate +serialization or generated schema MUST preserve those same values, or report +that it cannot represent them. In particular, an Avro `int` cannot represent the +upper half of UInt32; an appropriate wider encoding is needed rather than +narrowing or wrapping the value. This profile does not change the generic +xRegistry schema generator. + +Descriptor identity, References, schema selection and publication stability +follow the Descriptor Registry. Publishers MUST retain stable referenced +representations, selectors and shared metadata for the intended processing and +replay period. A new Descriptor Version conveys changed inputs; it does not make +the native writer identity equal to a Descriptor identifier. + ## Examples The examples preceding the WoT section use publisher `UInt16:12` and writer name @@ -741,11 +837,11 @@ metadata is omitted from this excerpt. "schemaref": "payload", "references": { "pump7": { - "class": "thingdescription", + "class": "https://xregistry.io/classes/thingdescription", "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" }, "gateway1": { - "class": "thingdescription", + "class": "https://xregistry.io/classes/thingdescription", "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1" }, "payload": { @@ -753,7 +849,7 @@ metadata is omitted from this excerpt. "url": "https://schemas.example/pump-process-data/versions/3" }, "geometry": { - "class": "usdasset", + "class": "https://xregistry.io/classes/usdasset", "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" } }, @@ -774,6 +870,36 @@ stream's Descriptor Version URL as `source` and omit `describedby`. This changes the source identity; it is not an identity-preserving rewrite of already published events. +#### Subject Descriptor with separate processing metadata + +The following binary-mode event uses the [Subject Descriptor +example](wot.md#subject-descriptor-with-separate-processing-inputs) for its TD +pointer. Its `describedby` selects the complete `pump7-telemetry` Processing +Descriptor shown above. + +```http +POST /events HTTP/1.1 +Host: consumer.example +Content-Type: application/json +ce-specversion: 1.0 +ce-id: ua-message-25462 +ce-source: urn:example:actor:telemetry-service +ce-type: com.example.models.tm.pump.properties.processData.v1 +ce-subject: https://registry.example/descriptorgroups/subjects/descriptors/pump7-process/versions/1 +ce-describedby: https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1 +ce-opcuamessagetype: ua-keyframe +ce-opcuasequence: 18 + +{"Speed":1500,"Pressure":4.5} +``` + +The Subject Descriptor selects the same TD URL as exactly one TD Reference in +the Processing Descriptor. Its string-form pointer selects +`/properties/processData`. The payload schema, `UInt16:12` PublisherId and +writer identity come only from the Processing Descriptor. Removing `describedby` +from this event would leave those processing inputs missing: the Subject +Descriptor does not replace them and the source is not queried. + #### Direct TD subject with the NetworkMessage envelope This event retains the full Part 14 NetworkMessage envelope. Its PublisherId @@ -847,4 +973,5 @@ metadata. [UA SequenceNumber]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.3 [UA DataSet Metadata]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.3 [UA VersionTime]: https://reference.opcfoundation.org/specs/OPC-10000-4/v1.05.07/7.43 +[UA ConfigurationVersion]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.6 [URI]: https://www.rfc-editor.org/rfc/rfc3986 diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index b5cba94cc..7f49d6a9e 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -3,8 +3,9 @@ This profile maps a [Web of Things Thing Description][TD] (TD) to CloudEvents Core context attributes and optionally the [Descriptor Reference extension](descriptors.md). The REQUIRED `subject` identifies a Thing or -affordance, either through a selected Descriptor or through a self-contained TD -document URL. The `type` names the event contract. +affordance through a Processing Descriptor, a self-contained TD document URL, or +a Subject Descriptor Version containing a TD pointer and subject annotations. +The `type` names the event contract. The profile defines no new CloudEvents extension attributes. Producers and Consumers agree on its use through a publication profile or configuration. It @@ -13,6 +14,19 @@ registry implementation. A direct TD subject can supply the REQUIRED description without a Descriptor; an explicit `describedby` can supply additional shared information when needed. +The [WoT Descriptor profile][WoT Descriptor Profile] owns these representation +class identifiers: + +| Representation | Class identifier | +| --- | --- | +| Thing Description | `https://xregistry.io/classes/thingdescription` | +| Thing Model | `https://xregistry.io/classes/thingmodel` | + +In this document, a **TD Reference** has the first URI as its exact `class` +value. A **TM Reference** has the second URI. The former bare class names +`thingdescription` and `thingmodel` are not aliases. The class identifiers are +not retrieval instructions. + ## Notational Conventions As with the main [CloudEvents specification](../spec.md), the key words "MUST", @@ -39,7 +53,8 @@ An agreed source-Descriptor binding MAY use an absolute, fragment-free Descriptor URL as `source` when it identifies the originating context. Consumers MUST NOT infer that binding merely from URL-like spelling. The [description-selection rules](#description-selection) determine whether the -source is retrieved; a direct TD subject does not require that lookup. +source is retrieved. A direct TD subject or Subject Descriptor URL does not +trigger that lookup. #### Event identity @@ -114,6 +129,10 @@ OPTIONAL does not change the contract revision. A change to `describedby`, the selected TD URL or the selected schema alone also does not change the revision; if it changes the payload contract, the Producer MUST use a new revision. +A change to a Subject Descriptor's pointer or annotations follows the same rule: +whether the payload contract changed determines the type revision, not the +presence of a new Descriptor Version. + The Producer MUST configure a valid complete type when the derivation is unavailable, produces an invalid symbol, or collides with a different event contract in the Producer's type namespace. A slash-to-dot conversion is not @@ -123,28 +142,44 @@ silently rewriting identifiers or member names. ### subject -The [`subject`](../spec.md#subject) is REQUIRED. It MUST be an [RFC 6901][JSON -Pointer] URI-fragment pointer with one of the prefixes defined below. The -pointer is evaluated against the selected ordinary, resolved TD, not Descriptor -metadata or an unresolved projection plan. +The [`subject`](../spec.md#subject) is REQUIRED. It MUST use one of the forms +below. The agreed profile determines their meaning before retrieval; Consumers +MUST NOT choose a form by inspecting a response body or guessing from a URL +path. Each form ultimately selects the ordinary resolved TD and the Thing or +affordance that the event concerns. | Subject form | Meaning | | --- | --- | -| `#` or `#/properties/processData` | Select the unique TD Reference in the selected Descriptor, then the whole Thing or affordance. | -| `pump7#/properties/processData` | Select the Descriptor's named `thingdescription` Reference `pump7`, then its affordance. | +| `#` or `#/properties/processData` | Select the unique TD Reference in the Processing Descriptor, then the whole Thing or affordance. | +| `pump7#/properties/processData` | Select the Processing Descriptor's named TD Reference `pump7`, then its affordance. | | `https://example.com/td/pump7/versions/3#/properties/processData` | Identify the Thing's affordance through a TD document URL; description selection follows the rules below. | +| `https://example.com/descriptorgroups/subjects/descriptors/pump7-process/versions/1` | Identify a Subject Descriptor Version whose `wotsubject` selects the TD and pointer. The URL has no literal `#`. | + +After event-format decoding, the Consumer MUST classify the subject as follows: + +1. If there is no literal `#`, the value MUST be an absolute HTTP(S) URL. + It selects a Subject Descriptor Version under the rules below. +2. Otherwise, split at the first literal `#`. If the prefix begins with + `http://` or `https://`, case-insensitively, it MUST be a valid absolute + HTTP(S) URL and selects the direct-TD form. +3. Any other prefix MUST be empty or a valid Descriptor Reference name. + It selects the Descriptor-relative form. + +The absence of a fragment and an empty fragment are different forms. +`https://example.com/document#` selects a whole TD; +`https://example.com/document` selects a Subject Descriptor Version and MUST +meet that form's requirements. A percent-encoded `%23` is part of the URL, not +the delimiter. Consumers MUST classify before percent-decoding a fragment. -The Consumer MUST split the value at the first literal `#`. A missing delimiter -is invalid. It recognizes a direct-URL candidate by an `http://` or `https://` -prefix, case-insensitively, and MUST validate that prefix as a complete absolute -HTTP(S) URL. Otherwise, the prefix MUST be empty or a Descriptor Reference name. Reference names follow the Descriptor Registry's map-key rules and cannot -contain `/`; `http:pump7` can therefore be a name, but is not an HTTP URL. -Invalid input MUST NOT be retried through another form or resolved against +contain `/`; `http:pump7#` can use a Reference name, but is not an HTTP URL. A +name without a literal `#` is invalid. Invalid input or an unexpected +representation MUST NOT be retried through another form or resolved against `source`. -The suffix including `#` MUST be a valid JSON Pointer URI fragment. For the -whole Thing, the Producer MUST use an empty fragment, such as `#`, `pump7#` or +For the forms containing `#`, the suffix including it MUST be a valid [RFC +6901][JSON Pointer] URI fragment. For the whole Thing, the Producer MUST use an +empty fragment, such as `#`, `pump7#` or `https://example.com/td/pump7/versions/3#`. For an affordance event, the pointer MUST identify the concrete affordance in that TD, such as `#/properties/processData`, `#/actions/setSetpoint` or `#/events/alarm`. @@ -157,6 +192,13 @@ as specified by RFC 6901. It MUST report a correlation failure if the encoding or pointer is invalid or the pointer does not select the intended Thing or affordance. +For a Subject Descriptor, the profile's `wotsubject.pointer` uses the JSON +Pointer **string** representation: `""` selects the whole Thing, and a non-empty +pointer starts with `/`. Consumers MUST NOT apply URI-fragment or percent +decoding to that stored pointer. For example, `/properties/pressure~1bar` +selects `pressure/bar`, while `/properties/pressure%2Fbar` selects the literal +name `pressure%2Fbar`. The latter MUST NOT be interpreted as `pressure/bar`. + The subject identifies the Thing or affordance, not an occurrence. Different events can have the same subject and different CloudEvents `id` values. A binding-specific writer identifier or native occurrence identifier is not @@ -165,10 +207,11 @@ appended to this pointer. The concrete TD path and corresponding TM declaration path can differ. This profile does not infer a declaration-lineage mapping between them. -Changing a direct subject's TD Version URL changes the subject string used for -filtering and correlation, not the source-plus-id event identity. A -Descriptor-relative subject with an independently versioned `describedby` can -avoid that coupling. +Changing a direct subject's TD Version URL or a Subject Descriptor Version URL +changes the subject string used for filtering and correlation, not the +source-plus-id event identity. A Descriptor-relative subject with an +independently versioned `describedby` can avoid that coupling when subject +annotations do not need their own versioned description. ### dataschema and datacontenttype @@ -178,11 +221,11 @@ CloudEvent's actual `data` adheres to. type. Neither identifies the TD document's format. The Consumer follows the Descriptor Reference extension's [schema -precedence](descriptors.md#schema-selection): `dataschema`, then the -selected Descriptor's schema. Without a Descriptor, the second source is -absent. The -Producer SHOULD omit `dataschema` when a selected Descriptor already supplies -the schema. +precedence](descriptors.md#schema-selection): `dataschema`, then the selected +Processing Descriptor's schema. A Subject Descriptor does not supply that second +candidate merely because it contains schema References or `schemaref`. Without a +Processing Descriptor, the second source is absent. The Producer SHOULD omit +`dataschema` when a selected Processing Descriptor already supplies the schema. A TD describes interactions and can contain several DataSchemas. The Producer MUST NOT use the whole TD as `dataschema` merely because the TD @@ -207,26 +250,35 @@ an exact schema Version independently of the selected TD Version. This profile uses the [Descriptor Reference selection rules](descriptors.md#one-selected-processing-description), including when `describedby` is absent. Apply event-format decoding before testing presence; -JSON `null` means unset. Selection proceeds as follows: +JSON `null` means unset, including for `subject`. An unset subject fails this +profile's REQUIRED-subject constraint. Selection proceeds as follows: 1. If `describedby` is present, retrieve and validate its Descriptor. It is - authoritative; a failure MUST NOT cause fallback to source or direct TD - subject retrieval. -2. Otherwise, if `subject` has a direct HTTP(S) TD URL prefix, retrieve that + authoritative for processing inputs; a failure MUST NOT cause fallback to + source, direct TD or Subject Descriptor processing. +2. If the subject is a fragment-free HTTP(S) URL, retrieve its Subject + Descriptor Version and apply [Subject Descriptor + selection](#subject-descriptor-selection). `describedby`, when present, + remains the Processing Descriptor. When absent, this route selects no + Processing Descriptor and MUST NOT trigger source retrieval. +3. Otherwise, for a direct-TD subject without `describedby`, retrieve its TD document. Use the prefix unchanged, including its query; the fragment is evaluated locally and is not sent in HTTP. Do not retrieve a source Descriptor or construct a synthetic Descriptor from the TD. -3. Otherwise, use the agreed source-Descriptor binding. Retrieve the exact - `source` URL, which MUST be an absolute URL without a fragment for this - binding. If no such binding was agreed, report a correlation failure. - -When a Descriptor is selected, select its TD Reference as follows: - -- For an empty subject prefix, the Descriptor MUST have exactly one - `thingdescription` Reference. -- For a Reference-name prefix, that entry MUST exist and its `class` MUST be - `thingdescription`. -- For a direct URL prefix, exactly one `thingdescription` Reference MUST +4. Otherwise, use the Processing Descriptor selected through `describedby`, + or the agreed source-Descriptor binding if `describedby` is absent. In the + latter case, retrieve the exact `source` URL, which MUST be an absolute URL + without a fragment. If no such binding was agreed, report a correlation + failure. + +For a Descriptor-relative or direct-TD subject using a Processing Descriptor, +select its TD Reference as follows: + +- For an empty subject prefix, the Processing Descriptor MUST have exactly + one TD Reference. +- For a Reference-name prefix, that entry MUST exist and MUST be a TD + Reference. +- For a direct URL prefix, exactly one TD Reference MUST have a `url` equal to that prefix. Consumers MUST compare the strings exactly, without URI normalization. Missing or duplicate matches are correlation failures. A named subject can disambiguate duplicate URLs. @@ -237,21 +289,21 @@ Descriptor bundle. It MUST NOT construct another URL from the Descriptor URL or Reference. Redirect destinations, TD `id` and equal `entityid` values MUST NOT be used to repair a subject-to-Reference mismatch. -A `thingmodel` Reference cannot replace an instance TD. The selected -representation MUST be an ordinary resolved TD. The -[WoT Descriptor profile][WoT Descriptor Profile] defines the TD/TM admission -and provenance rules, including profile-specific `planurl` and plan/view -pairing. Consumers using that profile MUST apply its admission and provenance -rules. Failure to obtain or validate a REQUIRED profile input MUST cause a -reported correlation failure. Unavailable OPTIONAL provenance does not prevent -correlation with an otherwise usable TD. The generic Descriptor model does not -define those provenance attributes. +A TM Reference cannot replace an instance TD. The selected representation MUST +be an ordinary resolved TD. The [WoT Descriptor profile][WoT Descriptor Profile] +defines the TD/TM admission and provenance rules, including profile-specific +`planurl` and plan/view pairing. Consumers using that profile MUST apply its +admission and provenance rules. Failure to obtain or validate a REQUIRED profile +input MUST cause a reported correlation failure. Unavailable OPTIONAL provenance +does not prevent correlation with an otherwise usable TD. The generic Descriptor +model does not define those provenance attributes. The Producer MUST supply all REQUIRED inputs through the selected route, the -event and the agreed publication profile. A direct TD subject without a -Descriptor does not supply an external payload schema or native publisher -metadata. A Producer needing shared inputs can use a complete Descriptor -with `describedby`. A Consumer MUST NOT merge them from source descriptions. +event and the agreed publication profile. A direct TD or a Subject Descriptor +alone does not supply an external payload schema or native publisher metadata. A +Producer needing shared processing inputs can use a complete Processing +Descriptor with `describedby`. A Consumer MUST NOT merge them from source or +subject descriptions. If selection, retrieval or correlation fails, the Consumer MUST report the failure and leave the event uncorrelated. It MAY retain or forward the event @@ -264,13 +316,76 @@ with its URL or a Descriptor that references it. The Publisher SHOULD publish an explicit TD Version. A change to the resolved logical view requires a new TD Version; the Publisher MUST NOT change that view at a previously published Version URL. Descriptor publication and Version stability follow the Descriptor -Registry rules. +Registry rules. This also applies to a Subject Descriptor's selected pointer, +annotations and TD Reference: publishing a changed subject description requires +a new Descriptor Version. Changing only `describedby` does not change identity or sequence scope. A Producer MUST NOT reuse an `id` or restart a source-wide sequence merely because a description changes. An exact Version or successful resolution does not itself prove that retrieved bytes are unchanged. +### Subject Descriptor selection + +The subject URL MUST identify a Descriptor **Version**, not a Resource's +changing default. The Producer and Consumer MUST use an agreed registry or +publication binding that identifies the Version addressed by this URL. Consumers +MUST verify that the retrieved Descriptor is that Version. + +For the xRegistry HTTP binding, a configured Registry base and Descriptor model +provide the Version-addressing structure: +`/////versions/`. The Consumer validates the +request URL under that complete binding and checks the returned Descriptor +identity and `versionid` against the addressed entity. It MUST NOT infer Version +identity merely from an arbitrary `/versions/` substring or the presence of +`versionid` in a response: default Resource responses also expose Version +metadata. + +An external publication binding MAY map an opaque absolute URL to a fixed +Descriptor Version. That mapping MUST identify the Version and define how the +Consumer verifies it. If no supported binding can establish the Version +identity, the Consumer MUST report a correlation failure. Redirects do not +authorize substitution of a default or different Version. Requests use the +subject URL unchanged; they do not append or remove a version segment. + +The Consumer MUST validate the Subject Descriptor and its `wotsubject` according +to the [WoT Descriptor profile][WoT Descriptor Profile]. That object requires an +exact local `reference` naming a TD Reference and a `pointer` in RFC 6901 string +form. The object and both members MUST be present and non-null; an empty pointer +string is valid. CE's event-attribute null decoding does not apply to members of +retrieved Descriptor metadata. Typed subject annotations follow the defining +profile's value and null rules. + +The selected Reference MUST identify an ordinary resolved TD. The stored pointer +MUST select the intended whole Thing or concrete affordance. Consumers MUST +report missing or malformed subject metadata, a wrong Reference class, an +invalid pointer, an unavailable TD or a pointer that does not select the +intended member. Other References do not become retrieval prerequisites solely +because they occur in the same Descriptor. The Consumer MUST NOT follow +recursive Subject Descriptor chains. + +If `describedby` is present, the selected Subject Descriptor TD URL MUST match +the `url` of exactly one TD Reference in the Processing Descriptor. This +comparison is byte-for-byte, without URI normalization, redirect substitution or +inference from TD or entity IDs. A missing or duplicate match is a correlation +failure. The Consumer uses the matching TD representation with the Subject +Descriptor's pointer and annotations; it does not merge Descriptor fields or +substitute the Processing Descriptor's own subject pointer for a missing or +invalid one. + +If `describedby` is absent, the Subject Descriptor still supplies only subject +semantics. Its `schemaref`, schema References, publisher or writer metadata MUST +NOT supply processing inputs. The event and agreed profile MUST supply those +inputs; an external payload schema uses `dataschema`. The Consumer MUST NOT +query source metadata to supplement this route. + +The same Version URL MAY be explicitly used for both `subject` and +`describedby`. Consumers MAY reuse an authorized cached or retrieved +representation for the same URL, representation and authorization context, but +MUST validate each role independently, including the exactly-one TD URL match. +The explicit processing role MAY then supply the schema and shared metadata; the +subject role alone cannot do so. + ## Relationship to Other Extensions This profile does not redefine native message types, sequence counters, or @@ -311,11 +426,11 @@ profile-specific shared metadata are omitted from this excerpt. "schemaref": "payload", "references": { "pump7": { - "class": "thingdescription", + "class": "https://xregistry.io/classes/thingdescription", "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" }, "gateway1": { - "class": "thingdescription", + "class": "https://xregistry.io/classes/thingdescription", "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1" }, "payload": { @@ -323,7 +438,7 @@ profile-specific shared metadata are omitted from this excerpt. "url": "https://schemas.example/pump-process-data/versions/3" }, "geometry": { - "class": "usdasset", + "class": "https://xregistry.io/classes/usdasset", "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" } } @@ -412,6 +527,125 @@ Its source-plus-id namespace differs from the device-source example. A new Version in `source` changes that namespace; a new Version in `describedby` alone does not. +### Subject Descriptor with Separate Processing Inputs + +This event selects a Subject Descriptor Version through a fragment-free +`subject` URL. Its `describedby` independently selects the `pump7-telemetry` +Processing Descriptor shown in the Single Affordance example. For these +examples, the configured xRegistry HTTP base is `https://registry.example`, with +`descriptorgroups` and `descriptors` as the Descriptor collections. + +```json +{ + "specversion": "1.0", + "id": "sample-4716", + "source": "urn:example:actor:telemetry-service", + "type": "com.example.models.tm.pump.properties.processData.v1", + "subject": "https://registry.example/descriptorgroups/subjects/descriptors/pump7-process/versions/1", + "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1", + "datacontenttype": "application/json", + "data": { + "Speed": 1500, + "Pressure": 4.5 + } +} +``` + +The Subject Descriptor at the event's `subject` URL contains the following +metadata. Core bookkeeping is omitted. This example's deployment profile defines +`acme_purpose` as an OPTIONAL non-empty String annotation on `wotsubject`; a +present null is invalid under that example profile. It describes the purpose of +the subject view, not processing policy. + +```json +{ + "descriptorid": "pump7-process", + "versionid": "1", + "wotsubject": { + "reference": "pump7", + "pointer": "/properties/processData", + "acme_purpose": "maintenance" + }, + "references": { + "pump7": { + "class": "https://xregistry.io/classes/thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" + } + } +} +``` + +For this example, the selected TD at that Reference's URL is: + +```json +{ + "@context": "https://www.w3.org/2022/wot/td/v1.1", + "id": "urn:example:asset:pump7", + "title": "Pump 7", + "securityDefinitions": { + "nosec_sc": { + "scheme": "nosec" + } + }, + "security": ["nosec_sc"], + "properties": { + "processData": { + "type": "object", + "readOnly": true, + "properties": { + "Speed": { "type": "number" }, + "Pressure": { "type": "number" } + }, + "required": ["Speed", "Pressure"], + "forms": [ + { + "href": "https://devices.example/pump7/process-data", + "op": "readproperty", + "contentType": "application/json" + } + ] + } + } +} +``` + +The TD URL matches exactly one TD Reference in the Processing Descriptor. The +Consumer evaluates `/properties/processData` as a stored JSON Pointer, uses +`acme_purpose` only as defined subject annotation, and selects the payload +schema from the Processing Descriptor's `schemaref`. It does not read the TD +form merely to correlate the event. The TD's example security declaration does +not authorize access to either Descriptor. + +Changing the Subject Descriptor's TD URL to Version `4` without a matching +Processing Descriptor update fails correlation. Adding a second matching TD URL +to the Processing Descriptor also fails. Changing the pointer to null fails even +when the Processing Descriptor contains a usable pointer; there is no +cross-Descriptor repair. + +The following variant retains the Subject Descriptor but selects no Processing +Descriptor. Its external schema is carried by the event: + +```json +{ + "specversion": "1.0", + "id": "sample-4717", + "source": "urn:example:actor:telemetry-service", + "type": "com.example.models.tm.pump.properties.processData.v1", + "subject": "https://registry.example/descriptorgroups/subjects/descriptors/pump7-process/versions/1", + "dataschema": "https://schemas.example/pump-process-data/versions/3", + "datacontenttype": "application/json", + "data": { + "Speed": 1500, + "Pressure": 4.5 + } +} +``` + +Adding a schema Reference to the Subject Descriptor would not replace this +event's `dataschema`. If a REQUIRED schema were missing, the Consumer would +report that condition rather than select it from the Subject Descriptor or query +the source. + ### Whole Thing This CloudEvent carries aggregated data for the same pump. Its Descriptor @@ -447,7 +681,7 @@ The referenced Descriptor Version contains the following metadata. "schemaref": "payload", "references": { "pump7": { - "class": "thingdescription", + "class": "https://xregistry.io/classes/thingdescription", "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" }, "payload": { @@ -479,4 +713,4 @@ referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 -[WoT Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/28b6d245fb4f634bb172e0505ae8e64fdf882428/workingdrafts/models/wot/spec.md#66-wot-descriptor-profile +[WoT Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/12024152a0b10588e98ed33879fd7a5269f1290b/workingdrafts/models/wot/spec.md#66-wot-descriptor-profile From 75c2fa8d93d426db06e17f75fddae5ddd23c1b5c Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 15 Nov 2026 09:26:08 +0100 Subject: [PATCH 30/60] Address Descriptor extension review feedback Signed-off-by: Marc --- cloudevents/extensions/descriptors.md | 98 +++++++++------------------ cloudevents/extensions/opcua.md | 7 +- cloudevents/extensions/wot.md | 6 +- 3 files changed, 38 insertions(+), 73 deletions(-) diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptors.md index 926c270c0..0b73eddc5 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptors.md @@ -6,18 +6,19 @@ reference schemas and other representations, and can contain typed metadata defined by an applicable profile. It describes information relevant to the event, not necessarily only the event's source or subject. -This proposal is developed with the Descriptor Registry revision of -[xregistry/spec#796][Descriptor Registry]. That domain defines the metadata-only -Descriptor Resource, its Asset, Actor and Context specializations, named -References, selectors and OPTIONAL bundle. These are drafts, not released -standards. This document defines their CloudEvents binding; it does not require -a Producer to host or query a Registry. - -A Publisher publishes Descriptors and their referenced representations. A -Producer emits events, and a Consumer processes them. A publication profile is -an agreement defining message interpretation and REQUIRED inputs. Producers and -Consumers establish that agreement through a specification or configuration, not -by trusting a profile asserted in untrusted metadata. +The [xRegistry Descriptor Registry][Descriptor Registry] defines the +metadata-only Descriptor Resource, its Asset, Actor and Context specializations, +named References, selectors and OPTIONAL bundle. This document defines their +CloudEvents binding; it does not require a Producer to host or query a Registry. + +A Descriptor publisher publishes Descriptors and their referenced +representations. A Producer emits events, and a Consumer processes them. + +A publication profile specifies the agreed payload representation, +description-selection rules, REQUIRED processing inputs and failure behavior +for a set of events. Producers and Consumers agree on that profile through a +specification or deployment configuration before interpreting events. +Untrusted event or Descriptor metadata alone does not establish that agreement. ## Notational Conventions @@ -101,13 +102,6 @@ arbitrary subject strings against `source`. Core URNs and relative source references remain valid; a profile needing direct retrieval MUST define an appropriate retrievable value or use `describedby`. -The [WoT profile](wot.md#description-selection) defines Descriptor-relative -subjects, self-contained TD URL subjects, and fragment-free Subject Descriptor -Version URLs. The last form supplies the TD selection, pointer and subject -annotations through a Subject Descriptor, independently of processing inputs. -The direct TD form can select a TD without any Descriptor. Each form follows -that profile's representation and validation rules. - ### One selected processing description | Condition | Processing | @@ -210,9 +204,9 @@ not trigger a source lookup or a schema search in the subject record. When `dataschema` is present, otherwise unselected schema inventory is irrelevant to precedence. Explicit Descriptor selector validity is still -checked. Publishers and Producers SHOULD supply one applicable schema source, or -identify the same schema when several are supplied. Consumers apply the -precedence without comparing schema documents. +checked. Descriptor publishers and Producers SHOULD supply one applicable +schema source, or identify the same schema when several are supplied. +Consumers apply the precedence without comparing schema documents. The Producer MUST ensure that the selected schema describes the actual `data` representation, including any protocol envelope. A TD containing several @@ -242,65 +236,35 @@ permit bypassing a failed explicit `describedby`. The Descriptor Registry defines publication and Version stability for all processing-significant fields, including References, selectors and typed -metadata. A Publisher MUST make the representations REQUIRED by the profile -available before configuring Producers to emit the selected Descriptor URL. A +metadata. A Descriptor publisher MUST make the representations REQUIRED by +the profile available before configuring Producers to emit the selected +Descriptor URL. A Producer MUST select information applicable to the event and SHOULD reuse configured Version URLs when that information is unchanged. Producers are not REQUIRED to perform runtime validation of each event by this extension. A Descriptor Resource URL selects its current default Version, which can change. Consumers SHOULD bound the freshness of cached Resource responses. Under the -Descriptor Registry's publication rule, the Publisher MUST keep referenced -representations stable for the intended processing and replay period. -Publishers SHOULD pin representation Versions and retain them with the -Descriptor for that period. A Version identifier alone is not evidence that -the Publisher has met the stability requirement. There is no lookup of the -Version intended at event `time`, and an ETag does not reconstruct that history. +Descriptor Registry's publication rule, the Descriptor publisher MUST keep +referenced representations stable for the intended processing and replay +period. Descriptor publishers SHOULD pin representation Versions and retain +them with the Descriptor for that period. A Version identifier alone is not +evidence that the Descriptor publisher has met the stability requirement. +There is no lookup of the Version intended at event `time`, and an ETag does +not reconstruct that history. `source` plus `id` retains its Core uniqueness rule. Changing `source`, including a Version segment or query, changes the identity and source-wide -Sequence scope. Changing only `describedby` does not. Producers MUST NOT reuse -event identities or restart a claimed source-wide sequence when returning to an -earlier source. +Sequence scope. Changing only `describedby` does not. When returning to an +earlier `source`, Producers MUST preserve the uniqueness of `source` plus `id`. +When using the [Sequence extension](sequence.md), their `sequence` values MUST +remain ordered relative to earlier events from that same source. Changing `subject` can change subscription filtering and correlation; it does not change the source-plus-id identity scope. A profile using a versioned description URL as subject MUST account for that coupling. A stable subject with an independently versioned `describedby` avoids it. -## OPTIONAL Descriptor Bundle - -A supporting endpoint can return the Descriptor and its direct referenced -representations at the same URL: - -```http -Accept: application/vnd.xregistry.descriptor-bundle+json, application/json;q=0.5 -``` - -The Consumer MUST inspect `Content-Type`. Ordinary `application/json` returns -metadata; the bundle media type returns `descriptor` and `documents` as defined -by the [Descriptor Registry][Descriptor Registry]. Each document entry uses the -same Reference name and records its exact URL, content type, content or base64 -bytes, and redirect base URL when applicable. - -The bundle covers each direct `references.*.url` or returns an error. Additional -representations to be included MUST be listed as named References. An empty -Reference map has an empty document map. Relative dependencies use the -referenced representation's recorded retrieval base, not the descriptor's URL. -Stable published inputs do not make the bundle an atomic snapshot across -Registries. - -This behavior is additional to Core metadata serving. Content negotiation alone -does not collect referenced URLs. A Publisher can prebuild a bundle for a -suitably configured endpoint, but the same completeness, access, freshness and -representation requirements apply. - -A Consumer MAY retry ordinary JSON at the same unchanged Descriptor URL after a -bundle error and retrieve only its REQUIRED representations. This is a -representation retry, not fallback to another Descriptor or source. Consumers -and caches MUST distinguish negotiated representations and authorization -contexts, following the bundle's `Vary` and freshness rules. - ## Examples ### Actor and processing description @@ -396,5 +360,5 @@ not authenticated principals, execution grants or current readiness. Device admission and operation outcomes remain governed by their own protocols and trusted authorities. -[Descriptor Registry]: https://github.com/xregistry/spec/pull/796 +[Descriptor Registry]: https://github.com/xregistry/spec/blob/ee4a11a789914e664c867d1e08f37a3cac1e910c/workingdrafts/models/descriptor/spec.md [Link Relations]: https://www.iana.org/assignments/link-relations/ diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index c5a7c2c79..5f7821464 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -354,9 +354,10 @@ mqtt://site/line/cell/device/sensor?opcuapublisherid=UInt16:12;opcuadatasetwrite ``` Changing `source`, including its query parameters, changes the CloudEvents -event-identity and [Sequence extension](sequence.md) scope. A Producer MUST -NOT reuse event identities or restart a claimed source-wide sequence when it -returns to a previously used `source`. +event-identity and [Sequence extension](sequence.md) scope. When returning to +an earlier `source`, the Producer MUST preserve the uniqueness of `source` +plus `id`. When using the Sequence extension, its `sequence` values MUST +remain ordered relative to earlier events from that same source. ## General Constraints diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 7f49d6a9e..be94f1c07 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -61,9 +61,9 @@ trigger that lookup. Core requires `source` and `id` together to identify each distinct event. Changing the `source` changes the event identity and [Sequence extension](sequence.md) scope. -Returning to an earlier `source` returns to its existing scope: Producers MUST -NOT reuse event identities or restart a claimed source-wide sequence within -that scope. +When returning to an earlier `source`, Producers MUST preserve the uniqueness +of `source` plus `id`. When using the Sequence extension, their `sequence` +values MUST remain ordered relative to earlier events from that same source. ### type From dde518722ff50ac6ea6f09275385e947dc974037 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 19 Nov 2026 10:02:37 +0100 Subject: [PATCH 31/60] Use type-keyed Descriptor buckets in CloudEvents profiles Signed-off-by: Marc --- cloudevents/extensions/descriptors.md | 317 ++++---------------- cloudevents/extensions/opcua.md | 397 +++++++++++-------------- cloudevents/extensions/wot.md | 409 ++++++++++++++------------ 3 files changed, 443 insertions(+), 680 deletions(-) diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptors.md index 0b73eddc5..ab754e9b2 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptors.md @@ -1,24 +1,15 @@ # Descriptor Reference -The OPTIONAL `describedby` extension attribute identifies a Descriptor -containing shared information for interpreting an event. A Descriptor can -reference schemas and other representations, and can contain typed metadata -defined by an applicable profile. It describes information relevant to the -event, not necessarily only the event's source or subject. +The OPTIONAL `describedby` attribute identifies an [xRegistry +Descriptor][Descriptor Registry] with shared inputs for interpreting an +event. A **Processing Descriptor** supplies the inputs REQUIRED by the +applicable profile. It need not describe the event's source or subject. -The [xRegistry Descriptor Registry][Descriptor Registry] defines the -metadata-only Descriptor Resource, its Asset, Actor and Context specializations, -named References, selectors and OPTIONAL bundle. This document defines their -CloudEvents binding; it does not require a Producer to host or query a Registry. - -A Descriptor publisher publishes Descriptors and their referenced -representations. A Producer emits events, and a Consumer processes them. - -A publication profile specifies the agreed payload representation, -description-selection rules, REQUIRED processing inputs and failure behavior -for a set of events. Producers and Consumers agree on that profile through a -specification or deployment configuration before interpreting events. -Untrusted event or Descriptor metadata alone does not establish that agreement. +xRegistry defines the Descriptor representation, retrieval of its metadata +and bundles, and [publication and Version stability][Publication Stability]. +Producers need not host or query a Registry. Producers and Consumers agree +on the profile through a specification or configuration, not through +untrusted event or Descriptor metadata. ## Notational Conventions @@ -41,13 +32,10 @@ profile that explicitly uses its description-selection rules. - OPTIONAL. - If present, MUST identify a Descriptor Resource or Descriptor Version and MUST NOT contain a fragment. - - SHOULD identify a Descriptor Version. Profiles MAY require one. - - Consumers MUST use the value unchanged as the request URL and as the URL - component of the cache key. Cache selection MUST also account for the - selected representation and authorization context. - - Consumers MUST NOT derive other URLs from the value. In particular, they - MUST NOT append `$details`, a view path or query parameter, or remove - `/versions/`. + - Consumers MUST use the URL unchanged for requests and cache lookup. + Cache selection MUST account for representation and authorization context. + - Consumers MUST NOT derive other URLs, including by adding `$details`, + a view path or query parameter, or removing `/versions/`. - An empty string or otherwise invalid set value is invalid, not absent. In the JSON event format, `describedby` is a top-level string member. In HTTP @@ -55,164 +43,33 @@ binary content mode, it is the `ce-describedby` header, encoded and decoded according to the [HTTP binding](../bindings/http-protocol-binding.md). Other bindings use their normal extension-attribute mapping. -Consumers MUST apply the event format's decoding rules before testing attribute -presence. In particular, the [JSON -format](../formats/json-format.md#22-type-system-mapping) treats `"describedby": -null` as unset, equivalent to omission. That is not a failed explicit reference -and does not prohibit a profile-defined route for events without `describedby`. -The same presence rule applies to the migration check for simultaneous old and -new attributes. +Consumers MUST decode attributes before checking presence, including for +migration. In the [JSON +format](../formats/json-format.md#22-type-system-mapping), `"describedby": +null` means unset, so the profile can use its route for an +omitted `describedby`. This is not a failed explicit reference. The name expresses a descriptive relationship, consistent with the [`describedby` Web link relation][Link Relations]; it does not define an HTTP `Link` header or a list of links. -## Core Attributes and Description Selection - -Core attributes retain their meaning: - -| Attribute | Meaning | -| --- | --- | -| `source` | Identifies the context in which the event occurred. It is not necessarily one physical Producer. | -| `subject` | Identifies what the event concerns within that originating context. It is a String, not inherently a retrieval URL. | -| `dataschema` | Identifies the schema that the event's `data` adheres to. | -| `describedby` | Identifies additional shared information for interpreting the event. It does not replace any of the above. | - -The **Processing Descriptor** is selected for processing inputs. A profile can -separately use a **Subject Descriptor** to describe the subject. These are uses -of a Descriptor, not additional Resource types. Retrieving a Subject Descriptor -does not make it the Processing Descriptor. - -A Producer SHOULD omit `describedby` when the event and agreed profile already -supply all REQUIRED inputs. If only an external payload schema is needed, -`dataschema` supplies that relationship without a Descriptor. - -### Profile-defined source and subject retrieval - -A profile MAY use a Descriptor URL as `source` when that URL also identifies the -originating context. It MAY define a subject that identifies a Thing or other -entity and permits retrieval of its description. Such a profile MUST define the -selected representation, any fragment processing, REQUIRED inputs and failure -behavior. An arbitrary processing metadata URL MUST NOT replace `subject` if it -no longer identifies what the event concerns under that profile. - -Generic Consumers MUST NOT infer retrieval from an HTTPS scheme, a URL path -containing `descriptors`, or the absence of `describedby`. They MUST NOT resolve -arbitrary subject strings against `source`. Core URNs and relative source -references remain valid; a profile needing direct retrieval MUST define an -appropriate retrievable value or use `describedby`. - -### One selected processing description - -| Condition | Processing | -| --- | --- | -| `describedby` is present and valid | Select that Descriptor, whether or not source or subject descriptions are also available. | -| `describedby` is present but invalid, unavailable or incomplete | Report the condition. Do not fall back to source or subject descriptions. | -| `describedby` is absent and the agreed profile defines source or subject retrieval | Use the profile's selected route and role; subject retrieval alone supplies no Processing Descriptor. | -| `describedby` is absent and no retrieval mapping applies | This extension supplies no description. Do not probe source or subject. | -| `source` and `describedby` have the same URL | One retrieval per representation and authorization context can serve both uses; event identity is unchanged. | -| `subject` and `describedby` explicitly identify the same Descriptor URL | Retrieval can be reused, but subject and processing requirements MUST be evaluated independently. | - -When present, `describedby` MUST select a Descriptor supplying all processing -inputs that the profile requires from a Descriptor. Subject selection and -annotations follow their separately defined subject role. The Processing -Descriptor need not duplicate information already supplied by the event. -A Consumer MUST NOT merge missing fields from a source or -subject description, including when both descriptions identify the same entity. -The Source Descriptor and Processing Descriptor can describe different entities, -such as an actor and a device; differing entity identities alone are not a -metadata conflict. - -A Subject Descriptor supplies only the subject information defined by its -profile. Its schema References, `schemaref` or protocol metadata MUST NOT supply -missing processing inputs. If the same URL is explicitly selected through -`describedby`, that representation can supply processing inputs in its -separately validated processing role. Equal URLs permit reuse of an authorized -representation; they do not imply a role that the event did not select. A -profile MAY require consistency between a Subject Descriptor and the Processing -Descriptor without merging their contents. - -When `describedby` is absent, a profile MUST distinguish its retrieval routes -before access. There is no general "try source, then subject" algorithm. A -failure in the selected route MUST NOT cause an implicit switch to another -route. OPTIONAL descriptive lookups for display do not supply missing processing -inputs. - -For example, a source description might contain PublisherId. If an explicit -Processing Descriptor and the event omit that REQUIRED OPC UA value, the -Consumer reports missing metadata rather than borrowing it from the source -description. Conversely, an unavailable source description does not prevent -processing when the explicit Descriptor and event supply all REQUIRED inputs. - -## Descriptor Representation and Processing - -An ordinary `GET` of the selected Descriptor URL with `Accept: application/json` -returns Descriptor metadata directly. Its `hasdocument` model aspect is `false`; -no `$details` request or separate Descriptor document is needed. - -The [Descriptor Registry][Descriptor Registry] defines these members: +## Descriptor Retrieval -| Member | Use | -| --- | --- | -| `references` | REQUIRED map of local Reference names to objects containing `class` and `url`. An empty map is valid. | -| `entityid`, `entitytype` | Describe a primary entity when one exists; not replacements for event source identity or authenticated principals. | -| `schemaref` | Selects a named payload-schema Reference. | -| Profile attributes | Typed shared metadata whose meaning and relation to event fields are defined by the applicable profile. | - -The Descriptor base defines the representation class `schema`. Technology -profiles own other class definitions and identify them by URI; Consumers compare -those identifiers exactly. Multiple References can have the same class. -Reference names do not establish emitter, target, authority or execution roles. - -A Consumer MUST check response status, media type and Descriptor validity -against that domain. A missing or incorrectly typed `references` map is invalid. -An empty map can be valid but insufficient for a profile requiring a TD or -schema. An explicit `schemaref` MUST name an existing Reference of class -`schema`, even when the event supplies `dataschema`. - -For a valid Descriptor, the Consumer retrieves only the representations it -needs, subject to its access and content-trust policies. It MUST use their URLs -unchanged. A Reference's `class` identifies a representation, not a requirement -to retrieve it or permission to execute anything it describes. An unknown class -can be ignored if the profile does not need it; an unsupported REQUIRED input -makes interpretation unavailable. Entity identity and class URIs are not -automatic retrieval instructions. - -### Schema selection - -The Consumer uses the Descriptor Registry's schema-selection rule: an explicit -`schemaref` names one Reference of class `schema`; without that selector, a -unique Reference of class `schema` is selected. Zero candidates means absence; -multiple candidates mean ambiguity, not permission to select the first entry. - -The Consumer selects the first applicable payload schema source: - -1. The event's `dataschema`. -2. The Processing Descriptor's selected `schema` Reference. - -Only absence permits proceeding to the next source. Ambiguity, an invalid -selector, unavailable selected content or an unsupported selected format MUST -NOT cause fallback to a different schema. With no Processing Descriptor, the -second candidate is absent. If neither source supplies a schema REQUIRED by the -profile, the Consumer MUST report that missing input; it MUST NOT derive another -schema from a TD or other unselected representation. - -In particular, a Subject Descriptor is not the second candidate unless the event -also explicitly selects it as the Processing Descriptor. A subject-only route -uses the event's `dataschema` when an external payload schema is needed; it does -not trigger a source lookup or a schema search in the subject record. +When `describedby` is present, the Consumer MUST use it to select the +Processing Descriptor. Retrieve the Descriptor at the supplied URL with +HTTP `GET`, using `Accept: application/json` for metadata or bundle +negotiation as defined by the [Descriptor Registry][Descriptor Registry]. +The Consumer MUST check response status, media type and Descriptor validity +before using it, including any applicable selectors. `describedby` MUST +identify a Descriptor that supplies the processing inputs the profile requires +from it. Those inputs need not duplicate inputs already in the event. The +Consumer MUST NOT supplement them from another description. -When `dataschema` is present, otherwise unselected schema inventory is -irrelevant to precedence. Explicit Descriptor selector validity is still -checked. Descriptor publishers and Producers SHOULD supply one applicable -schema source, or identify the same schema when several are supplied. -Consumers apply the precedence without comparing schema documents. - -The Producer MUST ensure that the selected schema describes the actual `data` -representation, including any protocol envelope. A TD containing several -DataSchemas is not automatically the payload schema. Consumers MUST NOT use -event-type matching or Reference-name conventions to resolve an ambiguous -schema selection. +A Producer SHOULD omit `describedby` if the event and agreed profile +already supply all REQUIRED inputs. An absent `describedby` supplies no +Descriptor through this extension and does not authorize lookup through +another attribute. The applicable profile defines how it interprets other +event attributes and whether it requires a Descriptor Version. ### Failure outcomes @@ -221,49 +78,16 @@ schema selection. | REQUIRED inputs obtained and selected | Processing context available; this does not itself validate the payload or authorize an operation. | | Missing, ambiguous, unavailable or unsupported REQUIRED input | Processing context unavailable. | | Invalid shape, selector or profile value | Invalid metadata. | -| Repeated profile-defined values disagree after REQUIRED decoding | Metadata conflict. | | Applicable validation completed | Payload valid or invalid, according to that validator. | | Validation not performed or could not complete | Payload not checked; not a successful validation. | -These are processing outcomes, not new event attributes or HTTP error codes. The -Consumer SHOULD record a failure. Unless a profile requires an outcome, local -policy determines whether to defer, reject, or retain/forward the event without -that interpretation. It MUST NOT claim successful interpretation or validation -when the REQUIRED inputs are missing. Retaining an uninterpreted event does not -permit bypassing a failed explicit `describedby`. - -## Publication, Identity and Replay - -The Descriptor Registry defines publication and Version stability for all -processing-significant fields, including References, selectors and typed -metadata. A Descriptor publisher MUST make the representations REQUIRED by -the profile available before configuring Producers to emit the selected -Descriptor URL. A -Producer MUST select information applicable to the event and SHOULD reuse -configured Version URLs when that information is unchanged. Producers are not -REQUIRED to perform runtime validation of each event by this extension. - -A Descriptor Resource URL selects its current default Version, which can change. -Consumers SHOULD bound the freshness of cached Resource responses. Under the -Descriptor Registry's publication rule, the Descriptor publisher MUST keep -referenced representations stable for the intended processing and replay -period. Descriptor publishers SHOULD pin representation Versions and retain -them with the Descriptor for that period. A Version identifier alone is not -evidence that the Descriptor publisher has met the stability requirement. -There is no lookup of the Version intended at event `time`, and an ETag does -not reconstruct that history. - -`source` plus `id` retains its Core uniqueness rule. Changing `source`, -including a Version segment or query, changes the identity and source-wide -Sequence scope. Changing only `describedby` does not. When returning to an -earlier `source`, Producers MUST preserve the uniqueness of `source` plus `id`. -When using the [Sequence extension](sequence.md), their `sequence` values MUST -remain ordered relative to earlier events from that same source. - -Changing `subject` can change subscription filtering and correlation; it does -not change the source-plus-id identity scope. A profile using a versioned -description URL as subject MUST account for that coupling. A stable subject with -an independently versioned `describedby` avoids it. +If an explicit `describedby` is invalid, unavailable or incomplete, the +Consumer MUST report the failure and MUST NOT substitute another description +for it. A profile MAY permit processing that does not depend on the Descriptor, +but the Consumer MUST NOT report successful Descriptor-based interpretation or +validation without REQUIRED inputs. Unless the profile dictates the outcome, +local policy determines whether to defer, reject, retain or forward an +uninterpreted event. These outcomes add no event attributes or HTTP error codes. ## Examples @@ -288,9 +112,10 @@ generic example does not assert the WoT or OPC UA profile. } ``` -The Processing Descriptor contains the following metadata; Core bookkeeping is -omitted. Its schema describes the decision payload, not the TD document. The -TD's URI class is defined by the WoT profile, not the Descriptor base. +The Processing Descriptor below omits Core bookkeeping. Its schema +describes the decision payload, not the TD document. The WoT profile defines +the `thingdescription` Reference type; the Schema Descriptor profile defines +`schema`. The type keys group References; `pump7` and `payload` name entries. ```json { @@ -298,49 +123,32 @@ TD's URI class is defined by the WoT profile, not the Descriptor base. "versionid": "1", "schemaref": "payload", "references": { - "pump7": { - "class": "https://xregistry.io/classes/thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" + "thingdescription": { + "pump7": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + } }, - "payload": { - "class": "schema", - "url": "https://schemas.example/maintenance-decision/versions/1" + "schema": { + "payload": { + "url": "https://schemas.example/maintenance-decision/versions/1" + } } } } ``` -The actor's independently retrieved description can have `references: {}` and -actor identity metadata. It is not merged with the Processing Descriptor. -Neither description is an authorization to inspect or operate the pump. - -### Without an additional link - -For the same application profile, if the event and an explicit `dataschema` -already supply every REQUIRED input, no `describedby` is needed. A profile can -also select a sufficient Descriptor through `source`, or retrieve a subject -description through a defined mapping. Neither case is inferred by a generic -Consumer. - -The [WoT examples](wot.md#examples) show a direct TD subject without a -Descriptor, a source-selected Processing Descriptor and a Subject Descriptor -Version used independently of processing inputs. The [OPC UA -mapping](opcua.md#shared-stream-metadata-in-a-descriptor) defines when a -selected Descriptor Version supplies native stream metadata. +The Consumer does not need the actor's description to use this Descriptor. +The [WoT](wot.md#description-selection) and [OPC +UA](opcua.md#opc-ua-descriptor-profile) profiles define their own mappings. ## Migration from Event Context -This revision replaces the draft `contexturl` extension and Role-keyed Context -representation. Existing events retain their original attribute and profile -semantics; Consumers MUST NOT silently reinterpret them as the new binding. -Deployments retaining such events need the old reader or an explicit conversion -policy. A profile using this revision MUST reject an event with both -`contexturl` and `describedby` unless a separate migration agreement defines -that combination. - -Do not rewrite historical sources merely to adopt registry-based identity. Names -discussed only during design, such as `contracturl`, `refset` and `contextref`, -are not aliases defined by this extension. +This binding replaces the draft `contexturl` extension and Role-keyed +Context representation. Consumers MUST preserve the original semantics of +stored events through an old reader or explicit conversion, and MUST reject +events with both `contexturl` and `describedby` unless a migration agreement +defines that combination. Do not rewrite historical sources just to adopt +Registry URLs. `contracturl`, `refset` and `contextref` are not aliases. ## Security Considerations @@ -360,5 +168,6 @@ not authenticated principals, execution grants or current readiness. Device admission and operation outcomes remain governed by their own protocols and trusted authorities. -[Descriptor Registry]: https://github.com/xregistry/spec/blob/ee4a11a789914e664c867d1e08f37a3cac1e910c/workingdrafts/models/descriptor/spec.md +[Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md +[Publication Stability]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md#46-versions-and-publication-stability [Link Relations]: https://www.iana.org/assignments/link-relations/ diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 5f7821464..10b8300b0 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -2,21 +2,14 @@ This extension maps [OPC UA](https://reference.opcfoundation.org/Core/Part1/v105/docs/) [PubSub](https://reference.opcfoundation.org/Core/Part14/v105/docs/) -DataSetMessages to CloudEvents for routing over supported protocols. It defines -mappings for Core and other extension attributes and specifies OPC UA extension -attributes. - -When used with the [Descriptor Reference extension](descriptors.md) and the -xRegistry Descriptor model, metadata that stays constant for a message stream is -preferably stored in the Processing Descriptor rather than repeated in each -event. The existing OPC UA attributes remain defined and usable. A Producer MUST -supply publisher and writer metadata REQUIRED by this mapping in the `source` -query when neither the full Part 14 NetworkMessage envelope nor the selected -Descriptor supplies it. The [shared metadata -rules](#shared-stream-metadata-in-a-descriptor) describe how a Consumer obtains -these values. A direct WoT TD subject can identify its description without a -Processing Descriptor. A Subject Descriptor can supply the TD pointer and -annotations. Neither subject route supplies these native identities. +DataSetMessages to CloudEvents for routing over supported protocols. It maps +Core and existing extension attributes and defines OPC UA attributes. + +The [OPC UA Descriptor profile](#opc-ua-descriptor-profile) uses the +[Descriptor Reference extension](descriptors.md) and xRegistry model to +share stream metadata. Native identity comes from the NetworkMessage +envelope, Processing Descriptor or `source` query, not from either WoT +subject route (direct TD or Subject Descriptor). ## Notational Conventions @@ -25,10 +18,7 @@ As with the main [CloudEvents specification](../spec.md), the key words "MUST", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119). -However, the scope of these key words is limited to when this extension is used. -For example, an attribute being marked as "REQUIRED" does not mean it needs to -be in all CloudEvents, rather it needs to be included only when this extension -is being used. +These requirements apply only to events using this extension. ## Mapping of REQUIRED Attributes @@ -52,13 +42,15 @@ value. An OPC UA Producer MAY map `type` to the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) -field `MessageType`. A Producer using the WoT profile MUST follow its semantic -event-type rules. When the `type` identifies a WoT event contract, a Producer -MUST carry the native `MessageType` as `opcuamessagetype` when `data` omits -that field from the DataSetMessage header. When a retained NetworkMessage -envelope includes the field, the Producer MUST NOT repeat it as an event -attribute. The [WoT mapping section](#wot-mapping) specifies the combined -mapping. +field `MessageType`. For data and event messages without the WoT profile, +the Producer MUST use that native value as `type` when the DataSetMessage +`MessageType` field is absent from `data`. A retained header does not +guarantee that field is present: the native content mask controls inclusion. + +A Producer using the WoT profile MUST instead follow its semantic +event-type rules and the [opcuamessagetype](#opcuamessagetype) requirements +for conveying the native message type. The [WoT mapping section](#wot-mapping) +specifies the combined mapping. ### WoT mapping @@ -66,14 +58,11 @@ When a CloudEvent uses both this extension and the [WoT profile](./wot.md), the following mappings apply to data and event messages: -- `type` MUST follow the WoT profile's semantic event-type rules instead of - mapping to the native `MessageType`. -- `subject` MUST follow the WoT profile's Descriptor-relative, direct-TD or - Subject Descriptor Version rules. -- The native PublisherId and at least one DataSetWriter identifier MUST be - available from the full Part 14 NetworkMessage envelope, `source`, or the - Processing Descriptor, as defined in [Publisher and Writer - Metadata](#publisher-and-writer-metadata). +- The Producer MUST use the WoT [`type`](wot.md#type) and + [`subject`](wot.md#subject) mappings and convey native `MessageType` under + [`opcuamessagetype`](#opcuamessagetype). +- The Producer MUST supply the PublisherId and writer identity under the + [Publisher and Writer Metadata](#publisher-and-writer-metadata) rules. - Nothing MUST be appended to `subject`. For an event message, the `EventId` remains in the OPC UA event payload. - `opcuasequence` MUST carry the native `SequenceNumber`. The CloudEvents @@ -81,14 +70,8 @@ messages: requirements of the Sequence extension and MUST NOT be inferred from `opcuasequence`. -The [publisher and writer metadata rules](#publisher-and-writer-metadata) -define how OPC UA publisher and writer identifiers are supplied. The Core -attribute mappings above remain unchanged. - -These conditional mappings replace only the conflicting OPC UA mappings above. -All other requirements in this extension remain applicable. A profile that -uses only part of this extension MUST NOT claim conformance to it unless the -profile satisfies every applicable requirement in this document. +These mappings override only conflicting rules. A profile MUST meet every +other applicable requirement to conform to this extension. ## Mapping of OPTIONAL Attributes @@ -99,20 +82,28 @@ MUST be `application/json` for OPC UA PubSub JSON payload and MAY be appended wi ### dataschema -OPC UA provides type information as part of PubSub metadata messages, for non -OPC UA consumers or when different payload encoding like Avro is used, it is -REQUIRED to provide schema information (based on metadata information) in a -separate format like [JSON schema](https://json-schema.org/specification) or -[Avro schema](https://avro.apache.org/docs/1.11.1/specification/) or others. For -those cases the attribute references the schema and is used for versioning. - -When the Descriptor Reference selection rules are used, a Producer MAY select a -Descriptor whose selected schema Reference supplies this schema -instead. The Consumer follows that extension's [schema -precedence](descriptors.md#schema-selection), including its selector -and ambiguity rules. The Producer SHOULD omit `dataschema` when the selected -Descriptor supplies the schema. The selected schema MUST describe the actual -`data`, including the full NetworkMessage envelope when one is retained. +PubSub metadata messages carry type information. For non-OPC UA Consumers +or alternate encodings such as Avro, a schema based on that metadata is +REQUIRED, for example [JSON Schema](https://json-schema.org/specification) +or [Avro Schema](https://avro.apache.org/docs/1.11.1/specification/). +`dataschema` identifies and versions that schema. + +A Processing Descriptor MAY supply the schema. The Consumer MUST use +`dataschema` when present; otherwise, select a Reference from the Processing +Descriptor's `references.schema` bucket under the [Schema Descriptor +profile][Schema Descriptor Profile]. Without a Processing Descriptor, +`dataschema` is the only external schema candidate. A Subject Descriptor +supplies a schema only if separately selected as the Processing Descriptor. + +The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, +invalid selector, unavailable schema or unsupported format MUST NOT cause +fallback to another schema. If `dataschema` is present, the Consumer MUST +still validate applicable Descriptor selectors, without selecting a +Descriptor schema or comparing schema documents. Producers and Descriptor +publishers SHOULD supply one schema source or identify the same schema in +both. The Producer SHOULD omit `dataschema` when the Descriptor supplies +the schema. The selected schema MUST describe `data`, including the +NetworkMessage envelope if retained. ### subject @@ -122,8 +113,8 @@ Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table1 A Producer using the WoT profile MUST instead follow its Descriptor-relative, direct-TD or Subject Descriptor Version mapping. -For an OPC UA event message (`type` equals `ua-event`), a Producer using the -OPC UA-specific `subject` mapping MUST append "/" and the +For a native OPC UA event message (`MessageType` equals `ua-event`), a +Producer using the OPC UA-specific `subject` mapping MUST append "/" and the [Base Event Type](https://reference.opcfoundation.org/Core/Part5/v104/docs/6.4.2) field `EventId`. @@ -136,34 +127,24 @@ field `Timestamp`. ## Mapping for other extensions The following well-known extension attributes apply to data and event -messages. When the WoT profile is used, determine the native message type -from `opcuamessagetype` when present or from the retained NetworkMessage's -DataSetMessage header when it contains `MessageType`. +messages. Determine the native message type from the retained DataSetMessage +`MessageType` field when present. Otherwise, use `opcuamessagetype` for the +WoT mapping or `type` for the non-WoT mapping, as specified above. ### sequence -Without the WoT profile, a `sequence` attribute, when present, MUST map to -the native DataSetMessage `SequenceNumber`. The OPC UA Publisher assigns and -increments this counter for messages from a DataSetWriter, as defined in -[OPC UA Part 14, Section 7.2.3][UA SequenceNumber]. This is the existing -OPC UA mapping for the [Sequence extension](./sequence.md), but it does not by -itself establish an ordering across multiple DataSetWriters that share one -CloudEvents `source`. A Publisher using this mapping MUST scope `source` to the -DataSetWriter's ordering scope; otherwise, it MUST NOT present the per-writer -counter as the CloudEvents `sequence`. - -The Sequence extension compares String values lexicographically. The Producer -MUST format the mapped counter so that string comparison preserves the event -order; padding the unsigned decimal value to ten digits is one way to do so. -A reset or rollover can reverse that order within the same source scope. The -Producer MUST NOT use the counter for `sequence` when it cannot preserve the -ordering defined by the Sequence extension. - -When the WoT profile is also used, `subject` identifies a TD or affordance, not -the DataSetWriter. `opcuasequence` therefore carries the native OPC UA counter; -a CloudEvents `sequence`, if present, MUST satisfy the Sequence extension's -ordering requirements independently and MUST NOT be inferred from -`opcuasequence`. +Without WoT, `sequence`, if present, MUST map to the native DataSetMessage +[`SequenceNumber`][UA SequenceNumber]. The Publisher increments it per +DataSetWriter; it does not order multiple writers sharing a `source`. +The Producer MUST scope `source` to the writer's ordering scope and format +`sequence` so lexical comparison preserves event order, for example by +padding the unsigned decimal value to ten digits. The Producer MUST NOT +use the counter if a reset, rollover or shared source prevents that ordering. + +With WoT, the subject identifies a Thing or affordance rather than the +writer. `opcuasequence` carries the native counter. If `sequence` is present, +it MUST satisfy the [Sequence extension](./sequence.md) independently and +MUST NOT be inferred from `opcuasequence`. ### traceparent @@ -200,14 +181,11 @@ field `MetaDataVersion`. - Constraints - OPTIONAL but MUST NOT be present if `dataschema` is used -Both metadata-version event attributes use the CloudEvents `Integer` type. -Their native [VersionTime][UA VersionTime] values are unsigned, so the -representable event-attribute range is `0` to `2147483647`, inclusive. -A Producer encoding a native value in either event attribute MUST preserve -that value exactly. If it exceeds this range, the Producer MUST report an -encoding error rather than truncate, wrap or reinterpret it as a negative -value. The full native range can be carried in the selected Descriptor -metadata described below, or in an applicable native payload representation. +Both event attributes map unsigned [VersionTime][UA VersionTime] to +CloudEvents `Integer` (`0` to `2147483647`, inclusive). Producers MUST +preserve the value or report an encoding error, without truncation, wrap +or signed reinterpretation. Descriptor metadata and applicable native +payload representations can carry the full native range. ### opcuastatus @@ -226,12 +204,13 @@ than omit the status, wrap the value, or report it as _Good_. ### opcuamessagetype - Type: `String` -- Description: Carries the OPC UA PubSub DataSetMessage type when the - DataSetMessage header is omitted from `data`. +- Description: Carries the OPC UA PubSub DataSetMessage type when its + `MessageType` field is absent from `data`. - Constraints - OPTIONAL - In combination with the WoT profile, the value is REQUIRED for data and - event messages when `data` omits the DataSetMessage header. + event messages when `data` omits the DataSetMessage `MessageType` field, + including when other DataSetMessage header fields are retained. - MUST NOT be present when `data` retains a full NetworkMessage envelope that includes the DataSetMessage `MessageType`. - MUST map to the Data Set Message Header `MessageType`. @@ -296,7 +275,7 @@ DataSetMessage; otherwise the Producer obtains it from configuration. The native PublisherId and at least one of DataSetWriterId and DataSetWriterName are REQUIRED for all data and event messages, whether or not the WoT profile is used. Each value MUST be supplied by the envelope or by the corresponding query -parameter or Descriptor attribute. A full envelope that omits an identifier does +parameter or Descriptor field. A full envelope that omits an identifier does not satisfy that identifier's presence requirement. If both writer values are supplied, they MUST identify the same DataSetWriter. A writer name MUST uniquely identify the DataSetWriter within the PublisherId scope. Consumers MUST compare @@ -374,8 +353,9 @@ referenced via `dataschema` attribute or selected through a Descriptor. A retained envelope does not replace the REQUIRED CloudEvents attributes or the per-event `opcuasequence` attribute when the WoT mapping applies. -`opcuamessagetype` is REQUIRED only when `data` omits the DataSetMessage -header; when the envelope includes that field, the attribute MUST be absent. +Native message type conveyance follows [type](#type) and +[opcuamessagetype](#opcuamessagetype), according to whether the WoT profile +is used and whether the DataSetMessage `MessageType` field is present. The NetworkMessage's `ua-data` type is not the DataSetMessage type. Any duplicated native values MUST agree after applying the specified mappings. The Consumer MUST report a conflict and MUST NOT interpret a message as @@ -383,17 +363,11 @@ conforming to this extension when they disagree. ## OPC UA Descriptor Profile -This profile defines how a CloudEvent and a selected xRegistry Processing -Descriptor convey native OPC UA PubSub metadata. OPC UA Part 14 defines the -native Publisher, DataSetWriter, DataSet and ConfigurationVersion concepts. This -section owns their Descriptor field names, representations, selection and -duplicate-value handling. - -Use of a Descriptor is OPTIONAL. A Producer and Consumer can satisfy the native -metadata requirements through the event's supported fields and retained envelope -without selecting a Descriptor. The Version requirement below applies when the -profile's shared fields are supplied by a Processing Descriptor, not merely -because the WoT profile or a Subject Descriptor is used. +This profile defines Descriptor fields for OPC UA Part 14 Publisher, +DataSetWriter, DataSet and ConfigurationVersion metadata. A Processing +Descriptor is OPTIONAL: the event and native envelope can supply the +inputs. This OPC UA profile requires a Version URL only when the Processing +Descriptor supplies shared fields. ### Shared Stream Metadata in a Descriptor @@ -401,30 +375,19 @@ A message stream here is a configured flow from one Publisher and DataSetWriter with a defined payload contract. It is not necessarily a broker topic or a CloudEvents `source`; either can carry several streams. -In this section, shared metadata is read only from a Descriptor selected in the -processing role. Publishers MUST obtain the values from the native writer and -applicable metadata configuration governing the emitted message. A Subject -Descriptor's annotations do not establish that association. - -When Producers and Consumers agree to use this extension with the [Descriptor -Reference selection rules](descriptors.md#one-selected-processing-description), -the Publisher SHOULD store metadata that is constant for the stream as -Processing Descriptor Version extension attributes. The agreed binding selects -that Descriptor through `describedby` or its defined processing route. In the -WoT profile, the source-selected processing route applies only to short -Descriptor-relative subjects when `describedby` is absent. Storing -stream-constant values once avoids repeating them in event attributes or the -`source` query. The Descriptor has no document body: these values are members of -its metadata object, alongside `references`. - -The Publisher MAY store the following values in the Descriptor when they remain -constant for every event using that Version. When a Descriptor supplies any of -these values, its selected URL MUST identify a Descriptor Version, whether -selected explicitly or through a profile-defined mapping. A Resource URL can -select a different default Version when a delayed or replayed event is -processed. - -| Descriptor attribute | JSON representation | Meaning and conditions | +Publishers MUST derive shared values from the native writer and metadata +configuration for the emitted message. For an agreed [Descriptor +binding](descriptors.md#descriptor-retrieval), they SHOULD store stream-constant +values in the Descriptor's `data.opcuawriter` object instead of repeating them +in events. Those values MUST stay constant across events using that Version. +When the object supplies such values, the selected URL MUST identify the +Version, not a Resource whose default can change before replay. + +With WoT, only Descriptor-relative subjects without `describedby` can select +a Processing Descriptor through `source`. A Subject Descriptor or its +annotations do not establish the writer association. + +| Member of `data.opcuawriter` | JSON representation | Meaning and conditions | | --- | --- | --- | | `opcuapublisherid` | String | The stream's typed native PublisherId, under the rules in [Publisher and Writer Metadata](#publisher-and-writer-metadata). | | `opcuadatasetwriterid` | Integer, `1` to `65535` | The stream's native DataSetWriterId, when used. | @@ -433,37 +396,28 @@ processed. | `opcuametadatamajorversion` | Integer, `0` to `4294967295` | The native MajorVersion, when no payload schema is selected. | | `opcuametadataminorversion` | Integer, `0` to `4294967295` | The native MinorVersion, when no payload schema is selected. | -All ranges in this table are inclusive. These are native Descriptor values, not -new CloudEvents extension attributes. The metadata-version event attributes -retain their separate CloudEvents `Integer` constraints. - -Publisher and writer members MUST use the constraints and mappings defined -in [Publisher and Writer Metadata](#publisher-and-writer-metadata). For -example, a Descriptor's `opcuadatasetwriterid` is a JSON integer, not a string. -The Descriptor metadata-version members MUST preserve the full native -`VersionTime` (`UInt32`) range, `0` to `4294967295`, inclusive. These are -Descriptor members, not CloudEvents `Integer` attributes. Consumers MUST -compare duplicate event and Descriptor values without narrowing either value. -Out-of-range Descriptor values are invalid metadata. +Ranges are inclusive. Publisher and writer fields MUST follow [Publisher +and Writer Metadata](#publisher-and-writer-metadata). The Descriptor's +metadata-version fields MUST preserve the full `VersionTime` (`UInt32`) range, +independent of the CloudEvents `Integer` limit. Consumers MUST compare +duplicate values without narrowing. Out-of-range fields are invalid metadata. Metadata-version values retain their native [ConfigurationVersion][UA ConfigurationVersion] meaning. Descriptor versioning does not change when Part 14 requires a MajorVersion or MinorVersion update. The Descriptor's selected schema Reference identifies an external payload -schema. Native metadata-version attributes MUST NOT be supplied in the event -or Descriptor when a schema is selected through `dataschema` or the Descriptor. - -`opcuadatasetname` is an OPTIONAL Descriptor attribute, not a new CloudEvents -attribute or source query parameter. If supplied, it MUST be a non-empty String -equal to `DataSetMetaDataType.Name` in the applicable [DataSet metadata][UA -DataSet Metadata], obtained from that metadata or its approved configuration. A -Producer MUST NOT infer it from a writer name, topic or TD affordance name. It -need not be unique and MUST NOT substitute for a REQUIRED PublisherId or -DataSetWriter identity. Repeated dataset-name representations, when the profile -supplies them, MUST compare exactly without case folding or Unicode -normalization. A mismatch is a metadata conflict. This attribute does not permit -removal of native fields REQUIRED by the selected encoding. +schema. Native metadata-version values MUST NOT be supplied in the event +or `data.opcuawriter` when a schema is selected through `dataschema` or the +Descriptor. + +`opcuadatasetname` is OPTIONAL and valid only in Descriptor metadata. +It MUST equal `DataSetMetaDataType.Name` from the applicable +[DataSet metadata][UA DataSet Metadata] or its approved configuration, not +a name inferred from the writer, topic or TD affordance. It need not be +unique and MUST NOT replace a REQUIRED PublisherId, DataSetWriter identity +or native field. Repeated dataset names MUST match exactly, without case +folding or Unicode normalization; a mismatch is a metadata conflict. For the listed values, an applicable Descriptor satisfies this extension's presence requirements for the corresponding field, including those of the @@ -485,28 +439,24 @@ conforming OPC UA message. A Consumer MUST use only the Processing Descriptor selected by the agreed binding for shared schema and native metadata inputs. If `describedby` is present, missing values MUST NOT be taken from a source or subject description. -If its Descriptor cannot be retrieved, the Consumer MAY interpret the native -payload using the envelope, source query and explicit event attributes when they -supply every native requirement, but MUST NOT report successful Descriptor-based -interpretation or WoT correlation. The WoT profile's explicit-link failure rules -still apply. +If the Consumer cannot retrieve that Descriptor, it MAY interpret the native +payload when the envelope, source query and explicit event attributes supply +every native requirement. It MUST NOT report that result as successful WoT +correlation. This is native-only interpretation, not a fallback to another +Descriptor. The [Descriptor Reference failure +rules](descriptors.md#failure-outcomes) still apply. Without `describedby`, the WoT profile can select a direct TD subject or a Subject Descriptor Version without selecting a Processing Descriptor. Native publisher and writer requirements then have to be satisfied by the retained envelope or the existing source query. A direct TD, Subject Descriptor or its -`wotsubject` annotations MUST NOT supply missing OPC UA metadata or a payload -schema. Consumers MUST NOT retrieve a source Descriptor as an implicit -supplement. - -With `describedby`, a Subject Descriptor's selected TD URL MUST match exactly -one TD Reference in the Processing Descriptor under the [WoT correlation -rules](wot.md#subject-descriptor-selection). The Subject Descriptor supplies -only the TD pointer and subject annotations. If the same URL is explicitly -selected by both `subject` and `describedby`, the representation MAY supply -native metadata in its separately validated processing role. Neither equal URLs -nor the presence of native metadata in the subject record establishes that role -without explicit selection. +subject annotations MUST NOT supply missing OPC UA metadata or a payload schema. +Consumers MUST NOT retrieve a source Descriptor as an implicit supplement. + +Apply the [WoT correlation rules](wot.md#subject-descriptor-selection) to +match the subject's TD URL to exactly one Processing Descriptor Reference. +If `subject` and `describedby` explicitly select the same URL, only the +separately validated processing role MAY supply native metadata. The Descriptor Publisher MUST NOT change these values in a Descriptor Version after any Producer is configured with its URL. A change requires a new @@ -538,43 +488,17 @@ to make source-based retrieval work. ### xRegistry Model Mapping -A deployment can add these OPTIONAL Version attributes to its Descriptor -Resource model: - -```json -{ - "opcuapublisherid": { - "name": "opcuapublisherid", - "type": "string" - }, - "opcuadatasetwriterid": { - "name": "opcuadatasetwriterid", - "type": "uinteger" - }, - "opcuadatasetwritername": { - "name": "opcuadatasetwritername", - "type": "string" - }, - "opcuadatasetname": { - "name": "opcuadatasetname", - "type": "string" - }, - "opcuametadatamajorversion": { - "name": "opcuametadatamajorversion", - "type": "uinteger" - }, - "opcuametadataminorversion": { - "name": "opcuametadataminorversion", - "type": "uinteger" - } -} -``` +The Descriptor Registry's `data` map holds the OPTIONAL `opcuawriter` +object. Each member above is OPTIONAL in the object; the binding determines +which values the event needs. An absent or empty object supplies none. A +top-level Descriptor attribute with the same name as a member does not supply +that value. -This fragment declares storage types, not every range or native consistency -rule. The Consumer MUST report invalid metadata when supplied values violate -this profile's type, range or native mapping constraints. Core write/null rules -apply to Descriptor updates; CE event-attribute null decoding is not a way to -accept null as a supplied native Descriptor value. +The Consumer MUST report invalid metadata if `opcuawriter` is not an object +or if a supplied member violates this profile's type, range or native mapping +constraints. This includes a null object or a null value for a listed member. +Core write/null rules apply to Descriptor updates; CloudEvents event-attribute +null decoding does not apply to a retrieved Descriptor. JSON integers in this profile preserve the full native ranges. An alternate serialization or generated schema MUST preserve those same values, or report @@ -837,27 +761,33 @@ metadata is omitted from this excerpt. "versionid": "1", "schemaref": "payload", "references": { - "pump7": { - "class": "https://xregistry.io/classes/thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" - }, - "gateway1": { - "class": "https://xregistry.io/classes/thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1" + "thingdescription": { + "pump7": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + }, + "gateway1": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1.0.0" + } }, - "payload": { - "class": "schema", - "url": "https://schemas.example/pump-process-data/versions/3" + "schema": { + "payload": { + "url": "https://schemas.example/pump-process-data/versions/3" + } }, - "geometry": { - "class": "https://xregistry.io/classes/usdasset", - "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" + "usdasset": { + "geometry": { + "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" + } } }, - "opcuapublisherid": "UInt16:12", - "opcuadatasetwriterid": 17, - "opcuadatasetwritername": "pump7-process", - "opcuadatasetname": "PumpProcessData" + "data": { + "opcuawriter": { + "opcuapublisherid": "UInt16:12", + "opcuadatasetwriterid": 17, + "opcuadatasetwritername": "pump7-process", + "opcuadatasetname": "PumpProcessData" + } + } } ``` @@ -874,9 +804,9 @@ published events. #### Subject Descriptor with separate processing metadata The following binary-mode event uses the [Subject Descriptor -example](wot.md#subject-descriptor-with-separate-processing-inputs) for its TD -pointer. Its `describedby` selects the complete `pump7-telemetry` Processing -Descriptor shown above. +example](wot.md#subject-descriptor-with-separate-processing-inputs) for its +Thing reference and affordance selector. Its `describedby` selects the +complete `pump7-telemetry` Processing Descriptor shown above. ```http POST /events HTTP/1.1 @@ -894,8 +824,8 @@ ce-opcuasequence: 18 {"Speed":1500,"Pressure":4.5} ``` -The Subject Descriptor selects the same TD URL as exactly one TD Reference in -the Processing Descriptor. Its string-form pointer selects +The Subject Descriptor's `thingref` selects the same TD URL as exactly one TD +Reference in the Processing Descriptor. Its `affordanceselector.pointer` selects `/properties/processData`. The payload schema, `UInt16:12` PublisherId and writer identity come only from the Processing Descriptor. Removing `describedby` from this event would leave those processing inputs missing: the Subject @@ -925,7 +855,7 @@ specversion: 1.0 id: ua-message-25461 source: mqtt://site/line/cell/device/sensor?site=north type: com.example.models.tm.pump.properties.processData.v2 -subject: https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3#/properties/processData +subject: https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0#/properties/processData time: 2026-10-29T12:00:01Z dataschema: https://schemas.example/pump-process-data-envelope/versions/1 opcuasequence: 0 @@ -976,3 +906,4 @@ metadata. [UA VersionTime]: https://reference.opcfoundation.org/specs/OPC-10000-4/v1.05.07/7.43 [UA ConfigurationVersion]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.6 [URI]: https://www.rfc-editor.org/rfc/rfc3986 +[Schema Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md#9-schema-descriptor-profile diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index be94f1c07..063b69efd 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -1,31 +1,24 @@ # Web of Things -This profile maps a [Web of Things Thing Description][TD] (TD) to CloudEvents -Core context attributes and optionally the [Descriptor Reference -extension](descriptors.md). The REQUIRED `subject` identifies a Thing or -affordance through a Processing Descriptor, a self-contained TD document URL, or -a Subject Descriptor Version containing a TD pointer and subject annotations. -The `type` names the event contract. - -The profile defines no new CloudEvents extension attributes. Producers and -Consumers agree on its use through a publication profile or configuration. It -does not define a transport binding, provision a Thing, or require a particular -registry implementation. A direct TD subject can supply the REQUIRED description -without a Descriptor; an explicit `describedby` can supply additional shared -information when needed. - -The [WoT Descriptor profile][WoT Descriptor Profile] owns these representation -class identifiers: - -| Representation | Class identifier | -| --- | --- | -| Thing Description | `https://xregistry.io/classes/thingdescription` | -| Thing Model | `https://xregistry.io/classes/thingmodel` | - -In this document, a **TD Reference** has the first URI as its exact `class` -value. A **TM Reference** has the second URI. The former bare class names -`thingdescription` and `thingmodel` are not aliases. The class identifiers are -not retrieval instructions. +This profile maps [Web of Things][TD] (WoT) Thing Descriptions (TDs) to +CloudEvents Core attributes and the OPTIONAL +[Descriptor Reference extension](descriptors.md). The REQUIRED `subject` +identifies a Thing or affordance through a Processing Descriptor, a TD URL, +or a Subject Descriptor Version. The `type` names the event contract. + +Producers and Consumers agree on the profile through a publication profile +or configuration. A direct TD subject can stand alone. If `describedby` is +also present, its Processing Descriptor MUST contain exactly one TD +Reference whose `url` exactly matches the subject's TD URL without the +fragment. See [Description Selection](#description-selection). The mapping +adds no attributes, transport binding or provisioning rules, and requires +no particular Registry implementation. + +The [WoT Descriptor profile][WoT Descriptor Profile] defines the Reference +types `thingdescription` and `thingmodel`. A **TD Reference** is a named +entry in `references.thingdescription`; a **TM Reference** is a named entry in +`references.thingmodel`. `thingref` and named subjects select local Reference +names, not types. ## Notational Conventions @@ -49,12 +42,11 @@ different device. For example, `https://factory.example.com/line1/pump7` and `mqtt://site/line/cell/device/sensor` are valid sources. -An agreed source-Descriptor binding MAY use an absolute, fragment-free -Descriptor URL as `source` when it identifies the originating context. Consumers -MUST NOT infer that binding merely from URL-like spelling. The -[description-selection rules](#description-selection) determine whether the -source is retrieved. A direct TD subject or Subject Descriptor URL does not -trigger that lookup. +An agreed binding MAY use an absolute, fragment-free Descriptor URL as +`source` if it identifies the originating context. Consumers MUST NOT infer +that binding from URL syntax. [Description Selection](#description-selection) +defines when to retrieve the source; neither direct TD nor Subject +Descriptor URLs trigger that lookup. #### Event identity @@ -67,20 +59,16 @@ values MUST remain ordered relative to earlier events from that same source. ### type -The Core [`type`](../spec.md#type) identifies the event contract. The contract -is the payload representation defined by the publication profile or protocol -binding, including its members, member types, and semantics. Two Things can -produce events of the same type when their event contracts are the same. This -profile uses a dot-separated symbol so a Consumer can map the type to a -code-generation symbol. +Core [`type`](../spec.md#type) identifies the event contract: the payload +representation, members, types and semantics defined by the publication +profile or protocol binding. Things can share a type when they share a +contract. The dot-separated type supports code generation. The type MUST contain one or more segments separated by single dots. Each -segment MUST start with an ASCII letter or underscore and contain only ASCII -letters, digits, or underscores thereafter. These character restrictions apply -only to `type`; they do not change the Thing identifier, TD member names, -`source`, `subject`, or payload. A code generator remains responsible for -language-specific keywords. The final segment MUST identify the event-contract -revision as `vN`, where `N` is a positive decimal integer without leading zeros. +segment MUST start with an ASCII letter or underscore; the rest can contain +only ASCII letters, digits and underscores. These restrictions apply only +to `type`; generators still handle language keywords. The last segment MUST +be the contract revision `vN`, with positive decimal `N` and no leading zeros. A Producer MAY configure the complete type. Otherwise, it derives the type from a governing [Thing Model][TM] (TM) and, for an affordance event, the @@ -124,14 +112,10 @@ For example, adding a `quality` member to `com.example.models.tm.pump.properties.processData.v2`, even if Consumers can ignore the new member. -A change to an individual value or the presence of a member already defined as -OPTIONAL does not change the contract revision. A change to `describedby`, the -selected TD URL or the selected schema alone also does not change the revision; -if it changes the payload contract, the Producer MUST use a new revision. - -A change to a Subject Descriptor's pointer or annotations follows the same rule: -whether the payload contract changed determines the type revision, not the -presence of a new Descriptor Version. +Changing a value or omitting or including an OPTIONAL member does not change +the revision. Changes to `describedby`, a TD URL, the selected schema, or +a Subject Descriptor's `thingref`, selector or annotations require a new +revision only if they change the payload contract. The Producer MUST configure a valid complete type when the derivation is unavailable, produces an invalid symbol, or collides with a different event @@ -153,7 +137,7 @@ affordance that the event concerns. | `#` or `#/properties/processData` | Select the unique TD Reference in the Processing Descriptor, then the whole Thing or affordance. | | `pump7#/properties/processData` | Select the Processing Descriptor's named TD Reference `pump7`, then its affordance. | | `https://example.com/td/pump7/versions/3#/properties/processData` | Identify the Thing's affordance through a TD document URL; description selection follows the rules below. | -| `https://example.com/descriptorgroups/subjects/descriptors/pump7-process/versions/1` | Identify a Subject Descriptor Version whose `wotsubject` selects the TD and pointer. The URL has no literal `#`. | +| `https://example.com/descriptorgroups/subjects/descriptors/pump7-process/versions/1` | Identify a Subject Descriptor Version whose `thingref` selects the TD and whose OPTIONAL `affordanceselector` selects one affordance. Omission selects the whole Thing. The URL has no literal `#`. | After event-format decoding, the Consumer MUST classify the subject as follows: @@ -192,12 +176,10 @@ as specified by RFC 6901. It MUST report a correlation failure if the encoding or pointer is invalid or the pointer does not select the intended Thing or affordance. -For a Subject Descriptor, the profile's `wotsubject.pointer` uses the JSON -Pointer **string** representation: `""` selects the whole Thing, and a non-empty -pointer starts with `/`. Consumers MUST NOT apply URI-fragment or percent -decoding to that stored pointer. For example, `/properties/pressure~1bar` -selects `pressure/bar`, while `/properties/pressure%2Fbar` selects the literal -name `pressure%2Fbar`. The latter MUST NOT be interpreted as `pressure/bar`. +For a Subject Descriptor, use [Subject Descriptor +selection](#subject-descriptor-selection). The stored pointer is a JSON +Pointer string, not a URI fragment: `/properties/pressure~1bar` selects +`pressure/bar`, while `/properties/pressure%2Fbar` selects `pressure%2Fbar`. The subject identifies the Thing or affordance, not an occurrence. Different events can have the same subject and different CloudEvents `id` values. A @@ -215,31 +197,34 @@ annotations do not need their own versioned description. ### dataschema and datacontenttype -Core [`dataschema`](../spec.md#dataschema) identifies the schema that the -CloudEvent's actual `data` adheres to. -[`datacontenttype`](../spec.md#datacontenttype) identifies that data's media -type. Neither identifies the TD document's format. - -The Consumer follows the Descriptor Reference extension's [schema -precedence](descriptors.md#schema-selection): `dataschema`, then the selected -Processing Descriptor's schema. A Subject Descriptor does not supply that second -candidate merely because it contains schema References or `schemaref`. Without a -Processing Descriptor, the second source is absent. The Producer SHOULD omit -`dataschema` when a selected Processing Descriptor already supplies the schema. - -A TD describes interactions and can contain several DataSchemas. The -Producer MUST NOT use the whole TD as `dataschema` merely because the TD -contains a schema for the selected affordance. A TD's retrieval URL is a -valid `dataschema` only if the identified representation is itself the -schema applicable to `data`. - -The publication profile or protocol binding defines how the selected -affordance's DataSchema maps to the wire payload. An object containing several -property values, an event payload and a protocol envelope can need different -schemas. When `dataschema` is present, the Producer MUST ensure that it -identifies the schema of the representation actually sent, including any -encoding or envelope selected by the binding. The same requirement applies to a -schema supplied by a Descriptor. +Core [`dataschema`](../spec.md#dataschema) and +[`datacontenttype`](../spec.md#datacontenttype) describe the schema and media +type of `data`, not the TD format. + +The publication profile or protocol binding determines whether an external +payload schema is REQUIRED. The Consumer MUST use `dataschema` when +present; otherwise, select a Reference from the Processing Descriptor's +`references.schema` bucket under the [Schema Descriptor +profile][Schema Descriptor Profile]. +Without a Processing Descriptor, `dataschema` is the only candidate. A +Subject Descriptor supplies a schema only if it is separately selected as +the Processing Descriptor. + +The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, +invalid selector, unavailable schema or unsupported format MUST NOT cause +fallback to another schema. If `dataschema` is present, the Consumer MUST +still validate applicable Descriptor selectors, but does not select a +Descriptor schema or compare schema documents. Producers and Descriptor +publishers SHOULD supply one schema source or identify the same schema in +both. Producers SHOULD omit `dataschema` when the Processing Descriptor +supplies the schema. + +A TD can contain several DataSchemas. A Producer MUST NOT use a TD URL as +`dataschema` unless the URL identifies the schema for `data` itself. +The profile or binding maps an affordance's DataSchema to the wire payload. +Aggregated properties, event data and protocol envelopes can need different +schemas. A schema supplied through `dataschema` or a Descriptor MUST describe +the actual payload, including its encoding and envelope. An xRegistry Schema Resource's document-view URL can identify that external schema. It is not the WoT Resource's metadata-view URL. A profile MAY require @@ -247,11 +232,11 @@ an exact schema Version independently of the selected TD Version. ## Description Selection -This profile uses the [Descriptor Reference selection -rules](descriptors.md#one-selected-processing-description), including when -`describedby` is absent. Apply event-format decoding before testing presence; -JSON `null` means unset, including for `subject`. An unset subject fails this -profile's REQUIRED-subject constraint. Selection proceeds as follows: +This profile uses the [Descriptor Reference retrieval +rules](descriptors.md#descriptor-retrieval). Apply event-format decoding before +testing presence; JSON `null` means unset, including for `subject`. An unset +subject fails this profile's REQUIRED-subject constraint. Selection proceeds +as follows: 1. If `describedby` is present, retrieve and validate its Descriptor. It is authoritative for processing inputs; a failure MUST NOT cause fallback to @@ -272,12 +257,11 @@ profile's REQUIRED-subject constraint. Selection proceeds as follows: failure. For a Descriptor-relative or direct-TD subject using a Processing Descriptor, -select its TD Reference as follows: +select a Reference only from `references.thingdescription`, as follows: - For an empty subject prefix, the Processing Descriptor MUST have exactly one TD Reference. -- For a Reference-name prefix, that entry MUST exist and MUST be a TD - Reference. +- For a Reference-name prefix, the named entry MUST exist in that bucket. - For a direct URL prefix, exactly one TD Reference MUST have a `url` equal to that prefix. Consumers MUST compare the strings exactly, without URI normalization. Missing or duplicate matches are correlation @@ -289,21 +273,18 @@ Descriptor bundle. It MUST NOT construct another URL from the Descriptor URL or Reference. Redirect destinations, TD `id` and equal `entityid` values MUST NOT be used to repair a subject-to-Reference mismatch. -A TM Reference cannot replace an instance TD. The selected representation MUST -be an ordinary resolved TD. The [WoT Descriptor profile][WoT Descriptor Profile] -defines the TD/TM admission and provenance rules, including profile-specific -`planurl` and plan/view pairing. Consumers using that profile MUST apply its -admission and provenance rules. Failure to obtain or validate a REQUIRED profile -input MUST cause a reported correlation failure. Unavailable OPTIONAL provenance -does not prevent correlation with an otherwise usable TD. The generic Descriptor -model does not define those provenance attributes. - -The Producer MUST supply all REQUIRED inputs through the selected route, the -event and the agreed publication profile. A direct TD or a Subject Descriptor -alone does not supply an external payload schema or native publisher metadata. A -Producer needing shared processing inputs can use a complete Processing -Descriptor with `describedby`. A Consumer MUST NOT merge them from source or -subject descriptions. +The selected representation MUST be an ordinary resolved TD, not a TM. +Consumers using the [WoT Descriptor profile][WoT Descriptor Profile] MUST +apply its admission and provenance rules, including `planurl` and plan/view +pairing. The generic Descriptor model has no provenance attributes. Missing +or invalid REQUIRED inputs cause a correlation failure; unavailable OPTIONAL +provenance does not prevent use of an otherwise valid TD. + +The Producer MUST supply all REQUIRED inputs through the selected route, +event and profile. A direct TD or Subject Descriptor supplies neither an +external payload schema nor native publisher metadata. Producers can use +`describedby` for shared processing inputs; Consumers MUST NOT merge source +or subject fields. If selection, retrieval or correlation fails, the Consumer MUST report the failure and leave the event uncorrelated. It MAY retain or forward the event @@ -311,14 +292,10 @@ without TD-based interpretation, but MUST NOT switch routes or substitute another TD. This does not authenticate the originating entity or authorize an action described by the TD. -The Publisher MUST make the selected TD available before configuring Producers -with its URL or a Descriptor that references it. The Publisher SHOULD publish an -explicit TD Version. A change to the resolved logical view requires a new TD -Version; the Publisher MUST NOT change that view at a previously published -Version URL. Descriptor publication and Version stability follow the Descriptor -Registry rules. This also applies to a Subject Descriptor's selected pointer, -annotations and TD Reference: publishing a changed subject description requires -a new Descriptor Version. +The Publisher MUST make the selected TD available before configuring +Producers to use its URL or a Descriptor that references it. The Publisher +SHOULD use a TD Version URL. The [WoT Descriptor profile][WoT Descriptor Profile] +defines publication and stability of TDs and Subject Descriptors. Changing only `describedby` does not change identity or sequence scope. A Producer MUST NOT reuse an `id` or restart a source-wide sequence merely because @@ -332,14 +309,11 @@ changing default. The Producer and Consumer MUST use an agreed registry or publication binding that identifies the Version addressed by this URL. Consumers MUST verify that the retrieved Descriptor is that Version. -For the xRegistry HTTP binding, a configured Registry base and Descriptor model -provide the Version-addressing structure: -`/////versions/`. The Consumer validates the -request URL under that complete binding and checks the returned Descriptor -identity and `versionid` against the addressed entity. It MUST NOT infer Version -identity merely from an arbitrary `/versions/` substring or the presence of -`versionid` in a response: default Resource responses also expose Version -metadata. +For xRegistry HTTP retrieval, the Consumer MUST validate the request URL +against the configured Registry base and the [Descriptor Registry's Version +addressing][Descriptor Registry], then check the returned identity against +the addressed Version. A `/versions/` substring or `versionid` alone is not +sufficient: a default Resource response also exposes Version metadata. An external publication binding MAY map an opaque absolute URL to a fixed Descriptor Version. That mapping MUST identify the Version and define how the @@ -348,30 +322,42 @@ identity, the Consumer MUST report a correlation failure. Redirects do not authorize substitution of a default or different Version. Requests use the subject URL unchanged; they do not append or remove a version segment. -The Consumer MUST validate the Subject Descriptor and its `wotsubject` according -to the [WoT Descriptor profile][WoT Descriptor Profile]. That object requires an -exact local `reference` naming a TD Reference and a `pointer` in RFC 6901 string -form. The object and both members MUST be present and non-null; an empty pointer -string is valid. CE's event-attribute null decoding does not apply to members of -retrieved Descriptor metadata. Typed subject annotations follow the defining -profile's value and null rules. - -The selected Reference MUST identify an ordinary resolved TD. The stored pointer -MUST select the intended whole Thing or concrete affordance. Consumers MUST -report missing or malformed subject metadata, a wrong Reference class, an -invalid pointer, an unavailable TD or a pointer that does not select the -intended member. Other References do not become retrieval prerequisites solely -because they occur in the same Descriptor. The Consumer MUST NOT follow -recursive Subject Descriptor chains. +The Consumer MUST validate the Subject Descriptor under the +[WoT Descriptor profile][WoT Descriptor Profile]. Its REQUIRED top-level +`thingref` MUST be a non-null String naming an exact local entry in +`references.thingdescription`. The entry MUST identify an ordinary resolved TD. + +Omit `affordanceselector` to select the whole Thing. If present, it MUST be +a non-null object with a non-empty RFC 6901 string `pointer`. The pointer +MUST select one existing affordance at `/properties/`, +`/actions/` or `/events/`, with a non-empty name and RFC 6901 +token escaping. Consumers MUST NOT URI-fragment-decode or percent-decode +the pointer. Root, affordance-map, nested and non-affordance pointers are +invalid. A missing or invalid pointer does not count as selector omission. + +Typed annotations for a selected affordance are siblings of `pointer` +inside `affordanceselector`. Profile-defined inline metadata about the whole +Thing belongs in the relevant Descriptor `data` bucket. Their types, +omission and null behavior follow the defining profile. +CE's event-attribute null decoding does not apply to retrieved Descriptor +members: `affordanceselector: null` is invalid, not whole-Thing selection. +The former `wotsubject` member is not an alias; a Subject Descriptor +containing it MUST fail admission, including when the new fields are present. + +Consumers MUST report missing or malformed subject metadata, a `thingref` +outside the TD bucket, an unavailable TD or a selector that does not identify +the intended affordance as correlation failures. Other References are not +retrieval prerequisites solely because they occur in the same Descriptor. +The Consumer MUST NOT follow recursive Subject Descriptor chains. If `describedby` is present, the selected Subject Descriptor TD URL MUST match the `url` of exactly one TD Reference in the Processing Descriptor. This comparison is byte-for-byte, without URI normalization, redirect substitution or inference from TD or entity IDs. A missing or duplicate match is a correlation failure. The Consumer uses the matching TD representation with the Subject -Descriptor's pointer and annotations; it does not merge Descriptor fields or -substitute the Processing Descriptor's own subject pointer for a missing or -invalid one. +Descriptor's whole-Thing selection or affordance selector and annotations. +It does not merge Descriptor fields or substitute a selector from the +Processing Descriptor to repair missing or invalid subject metadata. If `describedby` is absent, the Subject Descriptor still supplies only subject semantics. Its `schemaref`, schema References, publisher or writer metadata MUST @@ -379,12 +365,11 @@ NOT supply processing inputs. The event and agreed profile MUST supply those inputs; an external payload schema uses `dataschema`. The Consumer MUST NOT query source metadata to supplement this route. -The same Version URL MAY be explicitly used for both `subject` and -`describedby`. Consumers MAY reuse an authorized cached or retrieved -representation for the same URL, representation and authorization context, but -MUST validate each role independently, including the exactly-one TD URL match. -The explicit processing role MAY then supply the schema and shared metadata; the -subject role alone cannot do so. +Producers MAY use the same Version URL for `subject` and `describedby`. +Consumers MAY reuse the response or cache entry for the same URL, +representation and authorization context, but MUST validate both roles, +including the single TD URL match. Only the explicit processing role MAY +supply the schema and shared metadata. ## Relationship to Other Extensions @@ -397,8 +382,8 @@ MUST follow that extension's conditional WoT mapping. ### Single Affordance This CloudEvent identifies a pump and its `processData` property. Its Descriptor -selects version `3` of the resolved TD and supplies the payload schema. Another -TD in the same Descriptor describes a gateway. +selects version `3.0.0` of the resolved TD and supplies the payload schema. +Another TD in the same Descriptor describes a gateway. ```json { @@ -425,21 +410,23 @@ profile-specific shared metadata are omitted from this excerpt. "versionid": "1", "schemaref": "payload", "references": { - "pump7": { - "class": "https://xregistry.io/classes/thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" - }, - "gateway1": { - "class": "https://xregistry.io/classes/thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1" + "thingdescription": { + "pump7": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + }, + "gateway1": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1.0.0" + } }, - "payload": { - "class": "schema", - "url": "https://schemas.example/pump-process-data/versions/3" + "schema": { + "payload": { + "url": "https://schemas.example/pump-process-data/versions/3" + } }, - "geometry": { - "class": "https://xregistry.io/classes/usdasset", - "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" + "usdasset": { + "geometry": { + "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" + } } } } @@ -463,7 +450,7 @@ the pump; it is not retrieved. "id": "sample-4712", "source": "urn:example:actor:telemetry-service", "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3#/properties/processData", + "subject": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0#/properties/processData", "dataschema": "https://schemas.example/pump-process-data/versions/3", "datacontenttype": "application/json", "data": { @@ -486,7 +473,7 @@ The preceding event can instead select the same telemetry Descriptor: "id": "sample-4714", "source": "urn:example:actor:telemetry-service", "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3#/properties/processData", + "subject": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0#/properties/processData", "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1", "datacontenttype": "application/json", "data": { @@ -497,9 +484,9 @@ The preceding event can instead select the same telemetry Descriptor: ``` The direct subject matches exactly the `pump7` Reference. The Descriptor now -supplies the schema. Changing just the subject's TD Version to `4` would fail -correlation because this Descriptor names Version `3`. Adding another TD -Reference with that same Version `3` URL would also make the direct match +supplies the schema. Changing just the subject's TD Version to `4.0.0` would +fail correlation because this Descriptor names Version `3.0.0`. Adding another TD +Reference with that same Version `3.0.0` URL would also make the direct match ambiguous; a named subject would then be REQUIRED. ### Source-selected Descriptor @@ -552,24 +539,25 @@ examples, the configured xRegistry HTTP base is `https://registry.example`, with ``` The Subject Descriptor at the event's `subject` URL contains the following -metadata. Core bookkeeping is omitted. This example's deployment profile defines -`acme_purpose` as an OPTIONAL non-empty String annotation on `wotsubject`; a -present null is invalid under that example profile. It describes the purpose of -the subject view, not processing policy. +metadata. Core bookkeeping is omitted. This example's deployment profile +defines `acme_purpose` as an OPTIONAL non-empty String annotation inside +`affordanceselector`; a present null is invalid under that example profile. +It describes the purpose of the affordance view, not processing policy. ```json { "descriptorid": "pump7-process", "versionid": "1", - "wotsubject": { - "reference": "pump7", + "thingref": "pump7", + "affordanceselector": { "pointer": "/properties/processData", "acme_purpose": "maintenance" }, "references": { - "pump7": { - "class": "https://xregistry.io/classes/thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" + "thingdescription": { + "pump7": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + } } } } @@ -582,6 +570,9 @@ For this example, the selected TD at that Reference's URL is: "@context": "https://www.w3.org/2022/wot/td/v1.1", "id": "urn:example:asset:pump7", "title": "Pump 7", + "version": { + "instance": "3.0.0" + }, "securityDefinitions": { "nosec_sc": { "scheme": "nosec" @@ -609,17 +600,16 @@ For this example, the selected TD at that Reference's URL is: } ``` -The TD URL matches exactly one TD Reference in the Processing Descriptor. The -Consumer evaluates `/properties/processData` as a stored JSON Pointer, uses -`acme_purpose` only as defined subject annotation, and selects the payload -schema from the Processing Descriptor's `schemaref`. It does not read the TD -form merely to correlate the event. The TD's example security declaration does -not authorize access to either Descriptor. +The Consumer matches the TD URL to one Processing Descriptor Reference, +evaluates `/properties/processData`, and uses `acme_purpose` only as a +subject annotation. The Processing Descriptor's `schemaref` selects the +payload schema. Correlation does not read the TD form; the TD's security +declaration does not authorize access to either Descriptor. -Changing the Subject Descriptor's TD URL to Version `4` without a matching +Changing the Subject Descriptor's TD URL to Version `4.0.0` without a matching Processing Descriptor update fails correlation. Adding a second matching TD URL -to the Processing Descriptor also fails. Changing the pointer to null fails even -when the Processing Descriptor contains a usable pointer; there is no +to the Processing Descriptor also fails. A null or empty selector pointer fails +even when the Processing Descriptor contains a usable selector; there is no cross-Descriptor repair. The following variant retains the Subject Descriptor but selects no Processing @@ -646,10 +636,39 @@ event's `dataschema`. If a REQUIRED schema were missing, the Consumer would report that condition rather than select it from the Subject Descriptor or query the source. +#### Whole Thing through a Subject Descriptor + +The following Subject Descriptor selects the whole Thing by omitting +`affordanceselector`. The Core `description` describes the whole Thing. +The Descriptor does not use an empty or null pointer. + +```json +{ + "descriptorid": "pump7-whole", + "versionid": "1", + "thingref": "pump7", + "description": "Pump 7 operating state", + "references": { + "thingdescription": { + "pump7": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + } + } + } +} +``` + +Under the configured example Registry, its subject URL is +`https://registry.example/descriptorgroups/subjects/descriptors/pump7-whole/versions/1`. +An aggregate-state event can select this URL with the aggregate type and +Processing Descriptor used in the Whole Thing example below. The existing +direct-TD whole-Thing subject remains the TD URL followed by `#`; it does +not use the stored affordance selector. + ### Whole Thing This CloudEvent carries aggregated data for the same pump. Its Descriptor -selects version `3` of the resolved TD and the aggregate payload schema. The +selects version `3.0.0` of the resolved TD and the aggregate payload schema. The publication profile defines a payload containing the `processData` and `running` property values. The subject selects the whole TD. @@ -680,13 +699,15 @@ The referenced Descriptor Version contains the following metadata. "versionid": "1", "schemaref": "payload", "references": { - "pump7": { - "class": "https://xregistry.io/classes/thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3" + "thingdescription": { + "pump7": { + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + } }, - "payload": { - "class": "schema", - "url": "https://schemas.example/pump-state/versions/3" + "schema": { + "payload": { + "url": "https://schemas.example/pump-state/versions/3" + } } } } @@ -713,4 +734,6 @@ referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 -[WoT Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/12024152a0b10588e98ed33879fd7a5269f1290b/workingdrafts/models/wot/spec.md#66-wot-descriptor-profile +[Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md +[Schema Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md#9-schema-descriptor-profile +[WoT Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/a5d679ce4e8d3b3f4db263c305f2c6bf55ed5242/workingdrafts/models/wot/spec.md#66-wot-descriptor-profile From ae46ccec12c13c8f7c86ce5dc74ef622aa76d4b6 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 19 Nov 2026 10:53:02 +0100 Subject: [PATCH 32/60] Group Descriptor selectors under their profile data Signed-off-by: Marc --- cloudevents/extensions/descriptors.md | 9 +- cloudevents/extensions/opcua.md | 27 ++- cloudevents/extensions/wot.md | 232 +++++++++++--------------- 3 files changed, 112 insertions(+), 156 deletions(-) diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptors.md index ab754e9b2..ef729e6d0 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptors.md @@ -121,7 +121,6 @@ the `thingdescription` Reference type; the Schema Descriptor profile defines { "descriptorid": "pump7-maintenance", "versionid": "1", - "schemaref": "payload", "references": { "thingdescription": { "pump7": { @@ -133,13 +132,13 @@ the `thingdescription` Reference type; the Schema Descriptor profile defines "url": "https://schemas.example/maintenance-decision/versions/1" } } - } + }, + "data": { "schema": { "schemaref": "payload" } } } ``` -The Consumer does not need the actor's description to use this Descriptor. -The [WoT](wot.md#description-selection) and [OPC -UA](opcua.md#opc-ua-descriptor-profile) profiles define their own mappings. +No actor lookup is needed. See the [WoT](wot.md#description-selection) and +[OPC UA](opcua.md#opc-ua-descriptor-profile) mappings. ## Migration from Event Context diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 10b8300b0..d47211d68 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -89,11 +89,10 @@ or [Avro Schema](https://avro.apache.org/docs/1.11.1/specification/). `dataschema` identifies and versions that schema. A Processing Descriptor MAY supply the schema. The Consumer MUST use -`dataschema` when present; otherwise, select a Reference from the Processing -Descriptor's `references.schema` bucket under the [Schema Descriptor -profile][Schema Descriptor Profile]. Without a Processing Descriptor, -`dataschema` is the only external schema candidate. A Subject Descriptor -supplies a schema only if separately selected as the Processing Descriptor. +`dataschema` when present; otherwise, use the Processing Descriptor's schema +under the [Schema Descriptor profile][Schema Descriptor Profile]. +`data.schema.schemaref` names an entry in `references.schema`. Subject-only +lookup cannot supply a schema. The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, invalid selector, unavailable schema or unsupported format MUST NOT cause @@ -759,7 +758,6 @@ metadata is omitted from this excerpt. { "descriptorid": "pump7-telemetry", "versionid": "1", - "schemaref": "payload", "references": { "thingdescription": { "pump7": { @@ -781,6 +779,7 @@ metadata is omitted from this excerpt. } }, "data": { + "schema": { "schemaref": "payload" }, "opcuawriter": { "opcuapublisherid": "UInt16:12", "opcuadatasetwriterid": 17, @@ -793,8 +792,8 @@ metadata is omitted from this excerpt. The Consumer uses the selected Descriptor's PublisherId and writer identity with the event's `opcuamessagetype` and `opcuasequence`. The subject's `pump7` prefix -selects the TD among two candidates; `schemaref` selects the payload schema. The -dataset name and writer name deliberately differ. +selects one of two TDs; `data.schema.schemaref` selects the payload schema. +The dataset name and writer name differ. With an agreed source-Descriptor binding, a Producer can instead use the stream's Descriptor Version URL as `source` and omit `describedby`. This changes @@ -824,12 +823,10 @@ ce-opcuasequence: 18 {"Speed":1500,"Pressure":4.5} ``` -The Subject Descriptor's `thingref` selects the same TD URL as exactly one TD -Reference in the Processing Descriptor. Its `affordanceselector.pointer` selects -`/properties/processData`. The payload schema, `UInt16:12` PublisherId and -writer identity come only from the Processing Descriptor. Removing `describedby` -from this event would leave those processing inputs missing: the Subject -Descriptor does not replace them and the source is not queried. +`data.wot.subject` selects one matching TD URL and the `/properties/processData` +affordance. The Processing Descriptor supplies the payload schema, `UInt16:12` +PublisherId and writer identity. Without `describedby` these inputs are missing: +neither the subject nor a source lookup supplies them. #### Direct TD subject with the NetworkMessage envelope @@ -906,4 +903,4 @@ metadata. [UA VersionTime]: https://reference.opcfoundation.org/specs/OPC-10000-4/v1.05.07/7.43 [UA ConfigurationVersion]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.6 [URI]: https://www.rfc-editor.org/rfc/rfc3986 -[Schema Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md#9-schema-descriptor-profile +[Schema Descriptor Profile]: https://github.com/xregistry/spec/pull/796/files#diff-392fa7cefe828f037942a4b1cc7901449d3578fbb5704d00f851f252e5f2e44a diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 063b69efd..926a4fc00 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -6,19 +6,16 @@ CloudEvents Core attributes and the OPTIONAL identifies a Thing or affordance through a Processing Descriptor, a TD URL, or a Subject Descriptor Version. The `type` names the event contract. -Producers and Consumers agree on the profile through a publication profile -or configuration. A direct TD subject can stand alone. If `describedby` is -also present, its Processing Descriptor MUST contain exactly one TD -Reference whose `url` exactly matches the subject's TD URL without the -fragment. See [Description Selection](#description-selection). The mapping +Producers and Consumers agree on this mapping through a publication profile +or configuration. A direct TD subject can stand alone; see [Description +Selection](#description-selection) for use with `describedby`. This mapping adds no attributes, transport binding or provisioning rules, and requires no particular Registry implementation. The [WoT Descriptor profile][WoT Descriptor Profile] defines the Reference types `thingdescription` and `thingmodel`. A **TD Reference** is a named entry in `references.thingdescription`; a **TM Reference** is a named entry in -`references.thingmodel`. `thingref` and named subjects select local Reference -names, not types. +`references.thingmodel`. Selectors name local entries, not Reference types. ## Notational Conventions @@ -77,6 +74,17 @@ identify that mapping unambiguously, the publication configuration MUST select it explicitly. A Producer MUST NOT infer the mapping solely from matching names or select the first TM link. +An OPTIONAL `data.wot.event` object in the Processing Descriptor exposes +that mapping to Consumers. Its REQUIRED `modelref` MUST name an exact entry +in `references.thingmodel`. To use the binding, Consumers MUST match its +REQUIRED `type` to the decoded CloudEvents `type` exactly and retrieve the +resolved TM under the [WoT Descriptor profile][WoT Descriptor Profile]. +An OPTIONAL `affordanceselector` identifies one declaration using the same +pointer syntax as the subject selector; omission selects no individual +declaration. Consumers MUST report a mismatched type, invalid mapping or +unavailable model when using this binding; they MUST NOT guess another +model. Listing a TM or binding does not itself require retrieval. + For an eligible HTTPS TM identifier, derive the type as follows: 1. Require an ASCII DNS hostname without empty labels or a trailing root dot. @@ -113,9 +121,8 @@ For example, adding a `quality` member to ignore the new member. Changing a value or omitting or including an OPTIONAL member does not change -the revision. Changes to `describedby`, a TD URL, the selected schema, or -a Subject Descriptor's `thingref`, selector or annotations require a new -revision only if they change the payload contract. +the revision. Changes to `describedby`, a TD URL, the selected schema or subject metadata +require a new revision only if they change the payload contract. The Producer MUST configure a valid complete type when the derivation is unavailable, produces an invalid symbol, or collides with a different event @@ -137,7 +144,7 @@ affordance that the event concerns. | `#` or `#/properties/processData` | Select the unique TD Reference in the Processing Descriptor, then the whole Thing or affordance. | | `pump7#/properties/processData` | Select the Processing Descriptor's named TD Reference `pump7`, then its affordance. | | `https://example.com/td/pump7/versions/3#/properties/processData` | Identify the Thing's affordance through a TD document URL; description selection follows the rules below. | -| `https://example.com/descriptorgroups/subjects/descriptors/pump7-process/versions/1` | Identify a Subject Descriptor Version whose `thingref` selects the TD and whose OPTIONAL `affordanceselector` selects one affordance. Omission selects the whole Thing. The URL has no literal `#`. | +| `https://example.com/descriptorgroups/subjects/descriptors/pump7-process/versions/1` | Identify a Subject Descriptor Version. Its `data.wot.subject` selects the TD and optionally one affordance. | After event-format decoding, the Consumer MUST classify the subject as follows: @@ -203,12 +210,10 @@ type of `data`, not the TD format. The publication profile or protocol binding determines whether an external payload schema is REQUIRED. The Consumer MUST use `dataschema` when -present; otherwise, select a Reference from the Processing Descriptor's -`references.schema` bucket under the [Schema Descriptor -profile][Schema Descriptor Profile]. -Without a Processing Descriptor, `dataschema` is the only candidate. A -Subject Descriptor supplies a schema only if it is separately selected as -the Processing Descriptor. +present; otherwise, use the Processing Descriptor's schema under the [Schema +Descriptor profile][Schema Descriptor Profile]. `data.schema.schemaref` +selects a named entry in `references.schema`. Without a Processing Descriptor, +`dataschema` is the only candidate. The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, invalid selector, unavailable schema or unsupported format MUST NOT cause @@ -304,51 +309,31 @@ prove that retrieved bytes are unchanged. ### Subject Descriptor selection -The subject URL MUST identify a Descriptor **Version**, not a Resource's -changing default. The Producer and Consumer MUST use an agreed registry or -publication binding that identifies the Version addressed by this URL. Consumers -MUST verify that the retrieved Descriptor is that Version. - -For xRegistry HTTP retrieval, the Consumer MUST validate the request URL -against the configured Registry base and the [Descriptor Registry's Version -addressing][Descriptor Registry], then check the returned identity against -the addressed Version. A `/versions/` substring or `versionid` alone is not -sufficient: a default Resource response also exposes Version metadata. - -An external publication binding MAY map an opaque absolute URL to a fixed -Descriptor Version. That mapping MUST identify the Version and define how the -Consumer verifies it. If no supported binding can establish the Version -identity, the Consumer MUST report a correlation failure. Redirects do not -authorize substitution of a default or different Version. Requests use the -subject URL unchanged; they do not append or remove a version segment. - -The Consumer MUST validate the Subject Descriptor under the -[WoT Descriptor profile][WoT Descriptor Profile]. Its REQUIRED top-level -`thingref` MUST be a non-null String naming an exact local entry in -`references.thingdescription`. The entry MUST identify an ordinary resolved TD. - -Omit `affordanceselector` to select the whole Thing. If present, it MUST be -a non-null object with a non-empty RFC 6901 string `pointer`. The pointer -MUST select one existing affordance at `/properties/`, -`/actions/` or `/events/`, with a non-empty name and RFC 6901 -token escaping. Consumers MUST NOT URI-fragment-decode or percent-decode -the pointer. Root, affordance-map, nested and non-affordance pointers are -invalid. A missing or invalid pointer does not count as selector omission. - -Typed annotations for a selected affordance are siblings of `pointer` -inside `affordanceselector`. Profile-defined inline metadata about the whole -Thing belongs in the relevant Descriptor `data` bucket. Their types, -omission and null behavior follow the defining profile. -CE's event-attribute null decoding does not apply to retrieved Descriptor -members: `affordanceselector: null` is invalid, not whole-Thing selection. -The former `wotsubject` member is not an alias; a Subject Descriptor -containing it MUST fail admission, including when the new fields are present. - -Consumers MUST report missing or malformed subject metadata, a `thingref` -outside the TD bucket, an unavailable TD or a selector that does not identify -the intended affordance as correlation failures. Other References are not -retrieval prerequisites solely because they occur in the same Descriptor. -The Consumer MUST NOT follow recursive Subject Descriptor chains. +The subject URL MUST identify a fixed Descriptor **Version** under an agreed +Registry or publication binding. The Consumer MUST use the URL unchanged and +verify that the response is the addressed Version. For xRegistry HTTP, check +the configured Registry base, [Version addressing][Descriptor Registry] and +returned identity. A `/versions/` substring or `versionid` alone is not +sufficient. An opaque URL is valid only if the binding identifies the Version +and defines how to verify it. The Consumer MUST report a correlation failure +if verification fails; redirects do not authorize a different Version. + +The Consumer MUST validate `data.wot.subject` under the [WoT Descriptor +profile][WoT Descriptor Profile]. Its REQUIRED `thingref` names one entry +in `references.thingdescription`. Retrieve that resolved TD. + +Omit `affordanceselector` to select the whole Thing. A present selector +MUST be a plain RFC 6901 string selecting one existing affordance: +`/properties/`, `/actions/` or `/events/`. Consumers MUST +NOT URI-fragment-decode or percent-decode it. Null, empty, object, root and +deeper selectors are invalid, not omission. Top-level selectors are not +aliases. Annotations belong beside the selector; their profile defines +their scope, type and omission rules. + +Consumers MUST report invalid subject metadata, unavailable TDs and +unresolved selectors as correlation failures. Listing other References does +not require their retrieval. Consumers MUST NOT follow recursive Subject +Descriptor chains. If `describedby` is present, the selected Subject Descriptor TD URL MUST match the `url` of exactly one TD Reference in the Processing Descriptor. This @@ -359,17 +344,12 @@ Descriptor's whole-Thing selection or affordance selector and annotations. It does not merge Descriptor fields or substitute a selector from the Processing Descriptor to repair missing or invalid subject metadata. -If `describedby` is absent, the Subject Descriptor still supplies only subject -semantics. Its `schemaref`, schema References, publisher or writer metadata MUST -NOT supply processing inputs. The event and agreed profile MUST supply those -inputs; an external payload schema uses `dataschema`. The Consumer MUST NOT -query source metadata to supplement this route. - -Producers MAY use the same Version URL for `subject` and `describedby`. -Consumers MAY reuse the response or cache entry for the same URL, -representation and authorization context, but MUST validate both roles, -including the single TD URL match. Only the explicit processing role MAY -supply the schema and shared metadata. +`data.wot.subject` and `data.wot.event` MAY appear independently. A subject +lookup MUST NOT supply event binding, schema or writer metadata, or trigger +a source lookup. Only the selected Processing Descriptor supplies those +Descriptor inputs. If both attributes name the same Version, Consumers MAY +reuse retrieval within the same representation and authorization context, +but MUST validate both roles, including the single TD URL match. ## Relationship to Other Extensions @@ -408,7 +388,6 @@ profile-specific shared metadata are omitted from this excerpt. { "descriptorid": "pump7-telemetry", "versionid": "1", - "schemaref": "payload", "references": { "thingdescription": { "pump7": { @@ -428,6 +407,9 @@ profile-specific shared metadata are omitted from this excerpt. "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" } } + }, + "data": { + "schema": { "schemaref": "payload" } } } ``` @@ -538,79 +520,57 @@ examples, the configured xRegistry HTTP base is `https://registry.example`, with } ``` -The Subject Descriptor at the event's `subject` URL contains the following -metadata. Core bookkeeping is omitted. This example's deployment profile -defines `acme_purpose` as an OPTIONAL non-empty String annotation inside -`affordanceselector`; a present null is invalid under that example profile. -It describes the purpose of the affordance view, not processing policy. +The Subject Descriptor below omits Core bookkeeping. This deployment +defines `acme_purpose` as an OPTIONAL non-empty String about the selected +affordance, not processing policy. Null is invalid. ```json { "descriptorid": "pump7-process", "versionid": "1", - "thingref": "pump7", - "affordanceselector": { - "pointer": "/properties/processData", - "acme_purpose": "maintenance" - }, "references": { "thingdescription": { "pump7": { "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" } - } - } -} -``` - -For this example, the selected TD at that Reference's URL is: - -```json -{ - "@context": "https://www.w3.org/2022/wot/td/v1.1", - "id": "urn:example:asset:pump7", - "title": "Pump 7", - "version": { - "instance": "3.0.0" - }, - "securityDefinitions": { - "nosec_sc": { - "scheme": "nosec" + }, + "thingmodel": { + "pumpmodel": { + "url": "https://registry.example/thingmodelgroups/factory/thingmodels/pump/versions/1.0.0" + } + }, + "schema": { + "payload": { + "url": "https://schemas.example/pump-process-data/versions/3" + } } }, - "security": ["nosec_sc"], - "properties": { - "processData": { - "type": "object", - "readOnly": true, - "properties": { - "Speed": { "type": "number" }, - "Pressure": { "type": "number" } + "data": { + "wot": { + "subject": { + "thingref": "pump7", + "affordanceselector": "/properties/processData", + "acme_purpose": "maintenance" }, - "required": ["Speed", "Pressure"], - "forms": [ - { - "href": "https://devices.example/pump7/process-data", - "op": "readproperty", - "contentType": "application/json" - } - ] - } + "event": { + "type": "com.example.models.tm.pump.properties.processData.v1", + "modelref": "pumpmodel", + "affordanceselector": "/properties/processData" + } + }, + "schema": { "schemaref": "payload" } } } ``` -The Consumer matches the TD URL to one Processing Descriptor Reference, -evaluates `/properties/processData`, and uses `acme_purpose` only as a -subject annotation. The Processing Descriptor's `schemaref` selects the -payload schema. Correlation does not read the TD form; the TD's security -declaration does not authorize access to either Descriptor. +The TD's `processData` property supplies the subject. Correlation does not +invoke its form; TD security declarations do not authorize either lookup. +A second matching TD URL in the Processing Descriptor fails correlation. -Changing the Subject Descriptor's TD URL to Version `4.0.0` without a matching -Processing Descriptor update fails correlation. Adding a second matching TD URL -to the Processing Descriptor also fails. A null or empty selector pointer fails -even when the Processing Descriptor contains a usable selector; there is no -cross-Descriptor repair. +If `describedby` instead names the same Version as `subject`, the matching +`type` selects `pumpmodel` and its `processData` declaration. The TM pointer +need not match the TD pointer. Only this processing use of `pump7-process` +selects its schema and event binding. The following variant retains the Subject Descriptor but selects no Processing Descriptor. Its external schema is carried by the event: @@ -646,7 +606,6 @@ The Descriptor does not use an empty or null pointer. { "descriptorid": "pump7-whole", "versionid": "1", - "thingref": "pump7", "description": "Pump 7 operating state", "references": { "thingdescription": { @@ -654,7 +613,8 @@ The Descriptor does not use an empty or null pointer. "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" } } - } + }, + "data": { "wot": { "subject": { "thingref": "pump7" } } } } ``` @@ -697,7 +657,6 @@ The referenced Descriptor Version contains the following metadata. { "descriptorid": "pump7-state", "versionid": "1", - "schemaref": "payload", "references": { "thingdescription": { "pump7": { @@ -709,12 +668,13 @@ The referenced Descriptor Version contains the following metadata. "url": "https://schemas.example/pump-state/versions/3" } } - } + }, + "data": { "schema": { "schemaref": "payload" } } } ``` The empty subject prefix selects the unique TD Reference. The TD document itself -is not the payload. `schemaref` selects the schema of the aggregate JSON object, +is not the payload. `data.schema.schemaref` selects the aggregate object schema, not the TD or either property's DataSchema alone. A direct whole-Thing subject would end in `#` after its TD document URL. @@ -735,5 +695,5 @@ referenced documents or make their dependencies available. [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 [Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md -[Schema Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md#9-schema-descriptor-profile -[WoT Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/a5d679ce4e8d3b3f4db263c305f2c6bf55ed5242/workingdrafts/models/wot/spec.md#66-wot-descriptor-profile +[Schema Descriptor Profile]: https://github.com/xregistry/spec/pull/796/files#diff-392fa7cefe828f037942a4b1cc7901449d3578fbb5704d00f851f252e5f2e44a +[WoT Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/pull/8/files#diff-275076606a2e5d246231a8182b3238d3ae6823028f628b2500cb0dc2baa63018 From 32e9d720448ce798f09f00565dd2b27505ac900e Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 19 Nov 2026 12:46:48 +0100 Subject: [PATCH 33/60] Allow Descriptor-driven WoT subject selection Signed-off-by: Marc --- cloudevents/extensions/descriptors.md | 18 +---- cloudevents/extensions/opcua.md | 15 ++-- cloudevents/extensions/wot.md | 108 +++++++++++--------------- 3 files changed, 57 insertions(+), 84 deletions(-) diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptors.md index ef729e6d0..3b5877209 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptors.md @@ -43,8 +43,7 @@ binary content mode, it is the `ce-describedby` header, encoded and decoded according to the [HTTP binding](../bindings/http-protocol-binding.md). Other bindings use their normal extension-attribute mapping. -Consumers MUST decode attributes before checking presence, including for -migration. In the [JSON +Consumers MUST decode attributes before checking presence. In the [JSON format](../formats/json-format.md#22-type-system-mapping), `"describedby": null` means unset, so the profile can use its route for an omitted `describedby`. This is not a failed explicit reference. @@ -94,8 +93,7 @@ uninterpreted event. These outcomes add no event attributes or HTTP error codes. ### Actor and processing description An application profile reports an actor's maintenance decision about Pump 7. It -defines `pump7` as the subject identifier within that actor's context; this -generic example does not assert the WoT or OPC UA profile. +defines `pump7` as the subject identifier within that actor's context. ```json { @@ -137,17 +135,7 @@ the `thingdescription` Reference type; the Schema Descriptor profile defines } ``` -No actor lookup is needed. See the [WoT](wot.md#description-selection) and -[OPC UA](opcua.md#opc-ua-descriptor-profile) mappings. - -## Migration from Event Context - -This binding replaces the draft `contexturl` extension and Role-keyed -Context representation. Consumers MUST preserve the original semantics of -stored events through an old reader or explicit conversion, and MUST reject -events with both `contexturl` and `describedby` unless a migration agreement -defines that combination. Do not rewrite historical sources just to adopt -Registry URLs. `contracturl`, `refset` and `contextref` are not aliases. +No actor lookup is needed. ## Security Considerations diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index d47211d68..eb16c58bd 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -109,8 +109,8 @@ NetworkMessage envelope if retained. For metadata, data, and event messages, a Producer MAY map `subject` to `DataSetWriterId` or `DataSetWriterName` from the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164). -A Producer using the WoT profile MUST instead follow its Descriptor-relative, -direct-TD or Subject Descriptor Version mapping. +A Producer using the WoT profile MUST instead follow its +[subject selection rules](wot.md#subject). For a native OPC UA event message (`MessageType` equals `ua-event`), a Producer using the OPC UA-specific `subject` mapping MUST append "/" and the @@ -140,8 +140,8 @@ The Producer MUST scope `source` to the writer's ordering scope and format padding the unsigned decimal value to ten digits. The Producer MUST NOT use the counter if a reset, rollover or shared source prevents that ordering. -With WoT, the subject identifies a Thing or affordance rather than the -writer. `opcuasequence` carries the native counter. If `sequence` is present, +With WoT, subject selection does not identify the writer. +`opcuasequence` carries the native counter. If `sequence` is present, it MUST satisfy the [Sequence extension](./sequence.md) independently and MUST NOT be inferred from `opcuasequence`. @@ -452,10 +452,9 @@ envelope or the existing source query. A direct TD, Subject Descriptor or its subject annotations MUST NOT supply missing OPC UA metadata or a payload schema. Consumers MUST NOT retrieve a source Descriptor as an implicit supplement. -Apply the [WoT correlation rules](wot.md#subject-descriptor-selection) to -match the subject's TD URL to exactly one Processing Descriptor Reference. -If `subject` and `describedby` explicitly select the same URL, only the -separately validated processing role MAY supply native metadata. +Apply [WoT description selection](wot.md#description-selection). Match TD +URLs only when `subject` independently selects a TD or Subject Descriptor. +Only the selected Processing Descriptor MAY supply native metadata. The Descriptor Publisher MUST NOT change these values in a Descriptor Version after any Producer is configured with its URL. A change requires a new diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 926a4fc00..e40fa8612 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -2,9 +2,9 @@ This profile maps [Web of Things][TD] (WoT) Thing Descriptions (TDs) to CloudEvents Core attributes and the OPTIONAL -[Descriptor Reference extension](descriptors.md). The REQUIRED `subject` -identifies a Thing or affordance through a Processing Descriptor, a TD URL, -or a Subject Descriptor Version. The `type` names the event contract. +[Descriptor Reference extension](descriptors.md). Either the event's +`subject` or its Processing Descriptor selects the Thing or affordance. +The `type` names the event contract. Producers and Consumers agree on this mapping through a publication profile or configuration. A direct TD subject can stand alone; see [Description @@ -32,9 +32,8 @@ attribute marked REQUIRED here is not REQUIRED in every CloudEvent. ### source The Core [`source`](../spec.md#source) identifies the context in which the event -occurred and follows Core's URI-reference rules. It does not have to identify -the Thing selected by `subject`; an actor can emit an event concerning a -different device. +occurred and follows Core's URI-reference rules. An actor can emit an event +concerning a different device. For example, `https://factory.example.com/line1/pump7` and `mqtt://site/line/cell/device/sensor` are valid sources. @@ -133,11 +132,12 @@ silently rewriting identifiers or member names. ### subject -The [`subject`](../spec.md#subject) is REQUIRED. It MUST use one of the forms -below. The agreed profile determines their meaning before retrieval; Consumers -MUST NOT choose a form by inspecting a response body or guessing from a URL -path. Each form ultimately selects the ordinary resolved TD and the Thing or -affordance that the event concerns. +The publication profile MUST choose Descriptor-driven or subject-driven +selection before the Consumer interprets [`subject`](../spec.md#subject). +In Descriptor-driven selection, `subject` is OPTIONAL. It retains its +Core meaning, but Consumers MUST NOT use it for retrieval or correlation. +In subject-driven selection, `subject` is REQUIRED and MUST use a form below. +Consumers MUST NOT infer the mode or form from a response body or URL path. | Subject form | Meaning | | --- | --- | @@ -183,24 +183,15 @@ as specified by RFC 6901. It MUST report a correlation failure if the encoding or pointer is invalid or the pointer does not select the intended Thing or affordance. -For a Subject Descriptor, use [Subject Descriptor -selection](#subject-descriptor-selection). The stored pointer is a JSON -Pointer string, not a URI fragment: `/properties/pressure~1bar` selects -`pressure/bar`, while `/properties/pressure%2Fbar` selects `pressure%2Fbar`. - -The subject identifies the Thing or affordance, not an occurrence. Different -events can have the same subject and different CloudEvents `id` values. A -binding-specific writer identifier or native occurrence identifier is not -appended to this pointer. +The subject identifies what the event concerns, not an occurrence. Do not +append a writer or native occurrence identifier to a subject pointer. The concrete TD path and corresponding TM declaration path can differ. This profile does not infer a declaration-lineage mapping between them. -Changing a direct subject's TD Version URL or a Subject Descriptor Version URL -changes the subject string used for filtering and correlation, not the -source-plus-id event identity. A Descriptor-relative subject with an -independently versioned `describedby` can avoid that coupling when subject -annotations do not need their own versioned description. +A changed URL in `subject` affects filtering and correlation, not event +identity. A Descriptor-relative or descriptive subject can stay stable when +`describedby` changes Version. ### dataschema and datacontenttype @@ -237,25 +228,28 @@ an exact schema Version independently of the selected TD Version. ## Description Selection -This profile uses the [Descriptor Reference retrieval -rules](descriptors.md#descriptor-retrieval). Apply event-format decoding before -testing presence; JSON `null` means unset, including for `subject`. An unset -subject fails this profile's REQUIRED-subject constraint. Selection proceeds -as follows: +Apply event-format decoding before checking presence; JSON `null` means +unset. Retrieve and validate an explicit `describedby` under the [Descriptor +Reference rules](descriptors.md#descriptor-retrieval). It is authoritative +for processing inputs; failure MUST NOT cause fallback. + +In Descriptor-driven selection, `describedby` and the selected Processing +Descriptor's [`data.wot.subject`](#subject-descriptor-selection) are REQUIRED. +Use that selector alone. Missing or invalid input is a correlation failure, +not a reason to look up `subject` or `source`. + +In subject-driven selection, use the decoded `subject` form: -1. If `describedby` is present, retrieve and validate its Descriptor. It is - authoritative for processing inputs; a failure MUST NOT cause fallback to - source, direct TD or Subject Descriptor processing. -2. If the subject is a fragment-free HTTP(S) URL, retrieve its Subject +1. For a fragment-free HTTP(S) URL, retrieve its Subject Descriptor Version and apply [Subject Descriptor selection](#subject-descriptor-selection). `describedby`, when present, remains the Processing Descriptor. When absent, this route selects no Processing Descriptor and MUST NOT trigger source retrieval. -3. Otherwise, for a direct-TD subject without `describedby`, retrieve its TD +2. For a direct-TD subject without `describedby`, retrieve its TD document. Use the prefix unchanged, including its query; the fragment is evaluated locally and is not sent in HTTP. Do not retrieve a source Descriptor or construct a synthetic Descriptor from the TD. -4. Otherwise, use the Processing Descriptor selected through `describedby`, +3. Otherwise, use the Processing Descriptor selected through `describedby`, or the agreed source-Descriptor binding if `describedby` is absent. In the latter case, retrieve the exact `source` URL, which MUST be an absolute URL without a fragment. If no such binding was agreed, report a correlation @@ -278,11 +272,9 @@ Descriptor bundle. It MUST NOT construct another URL from the Descriptor URL or Reference. Redirect destinations, TD `id` and equal `entityid` values MUST NOT be used to repair a subject-to-Reference mismatch. -The selected representation MUST be an ordinary resolved TD, not a TM. -Consumers using the [WoT Descriptor profile][WoT Descriptor Profile] MUST -apply its admission and provenance rules, including `planurl` and plan/view -pairing. The generic Descriptor model has no provenance attributes. Missing -or invalid REQUIRED inputs cause a correlation failure; unavailable OPTIONAL +The representation MUST be an ordinary resolved TD, not a TM. Apply the +[WoT Descriptor profile's][WoT Descriptor Profile] admission and provenance +rules, including `planurl` and plan/view pairing. Unavailable OPTIONAL provenance does not prevent use of an otherwise valid TD. The Producer MUST supply all REQUIRED inputs through the selected route, @@ -309,8 +301,8 @@ prove that retrieved bytes are unchanged. ### Subject Descriptor selection -The subject URL MUST identify a fixed Descriptor **Version** under an agreed -Registry or publication binding. The Consumer MUST use the URL unchanged and +When `subject` selects a Descriptor, its URL MUST identify a fixed **Version** +under an agreed binding. The Consumer MUST use the URL unchanged and verify that the response is the addressed Version. For xRegistry HTTP, check the configured Registry base, [Version addressing][Descriptor Registry] and returned identity. A `/versions/` substring or `versionid` alone is not @@ -318,9 +310,9 @@ sufficient. An opaque URL is valid only if the binding identifies the Version and defines how to verify it. The Consumer MUST report a correlation failure if verification fails; redirects do not authorize a different Version. -The Consumer MUST validate `data.wot.subject` under the [WoT Descriptor -profile][WoT Descriptor Profile]. Its REQUIRED `thingref` names one entry -in `references.thingdescription`. Retrieve that resolved TD. +In either mode, the Consumer MUST validate the selected `data.wot.subject` +under the [WoT Descriptor profile][WoT Descriptor Profile]. Its REQUIRED +`thingref` names one entry in `references.thingdescription`. Retrieve that TD. Omit `affordanceselector` to select the whole Thing. A present selector MUST be a plain RFC 6901 string selecting one existing affordance: @@ -335,8 +327,8 @@ unresolved selectors as correlation failures. Listing other References does not require their retrieval. Consumers MUST NOT follow recursive Subject Descriptor chains. -If `describedby` is present, the selected Subject Descriptor TD URL MUST match -the `url` of exactly one TD Reference in the Processing Descriptor. This +When `subject` selects a Descriptor and `describedby` is present, its TD URL +MUST match the `url` of exactly one TD Reference in the Processing Descriptor. This comparison is byte-for-byte, without URI normalization, redirect substitution or inference from TD or entity IDs. A missing or duplicate match is a correlation failure. The Consumer uses the matching TD representation with the Subject @@ -567,13 +559,10 @@ The TD's `processData` property supplies the subject. Correlation does not invoke its form; TD security declarations do not authorize either lookup. A second matching TD URL in the Processing Descriptor fails correlation. -If `describedby` instead names the same Version as `subject`, the matching -`type` selects `pumpmodel` and its `processData` declaration. The TM pointer -need not match the TD pointer. Only this processing use of `pump7-process` -selects its schema and event binding. - -The following variant retains the Subject Descriptor but selects no Processing -Descriptor. Its external schema is carried by the event: +The Descriptor-driven variant selects `pump7-process` through `describedby` +and omits `subject`. The same Descriptor supplies the concrete TD selector, +the schema, and the `type` binding to `pumpmodel`. The TM pointer need not +match the TD pointer. ```json { @@ -581,8 +570,7 @@ Descriptor. Its external schema is carried by the event: "id": "sample-4717", "source": "urn:example:actor:telemetry-service", "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "https://registry.example/descriptorgroups/subjects/descriptors/pump7-process/versions/1", - "dataschema": "https://schemas.example/pump-process-data/versions/3", + "describedby": "https://registry.example/descriptorgroups/subjects/descriptors/pump7-process/versions/1", "datacontenttype": "application/json", "data": { "Speed": 1500, @@ -591,10 +579,8 @@ Descriptor. Its external schema is carried by the event: } ``` -Adding a schema Reference to the Subject Descriptor would not replace this -event's `dataschema`. If a REQUIRED schema were missing, the Consumer would -report that condition rather than select it from the Subject Descriptor or query -the source. +In contrast, an event using this URL only as `subject` needs `dataschema` +if an external schema is REQUIRED. A subject-only lookup MUST NOT supply it. #### Whole Thing through a Subject Descriptor From db8dd3377a1403fd8ab85508a0a8d2e7b54842f3 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 19 Nov 2026 13:35:37 +0100 Subject: [PATCH 34/60] Use Descriptor throughout the reference extension Signed-off-by: Marc --- cloudevents/extensions/descriptors.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptors.md index 3b5877209..7ad40f94b 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptors.md @@ -2,8 +2,8 @@ The OPTIONAL `describedby` attribute identifies an [xRegistry Descriptor][Descriptor Registry] with shared inputs for interpreting an -event. A **Processing Descriptor** supplies the inputs REQUIRED by the -applicable profile. It need not describe the event's source or subject. +event. The profile defines which inputs the Descriptor supplies. It need +not describe the event's source or subject. xRegistry defines the Descriptor representation, retrieval of its metadata and bundles, and [publication and Version stability][Publication Stability]. @@ -55,8 +55,8 @@ The name expresses a descriptive relationship, consistent with the ## Descriptor Retrieval When `describedby` is present, the Consumer MUST use it to select the -Processing Descriptor. Retrieve the Descriptor at the supplied URL with -HTTP `GET`, using `Accept: application/json` for metadata or bundle +Descriptor. Retrieve it at the supplied URL with HTTP `GET`, using +`Accept: application/json` for metadata or bundle negotiation as defined by the [Descriptor Registry][Descriptor Registry]. The Consumer MUST check response status, media type and Descriptor validity before using it, including any applicable selectors. `describedby` MUST @@ -110,7 +110,7 @@ defines `pump7` as the subject identifier within that actor's context. } ``` -The Processing Descriptor below omits Core bookkeeping. Its schema +The Descriptor below omits Core bookkeeping. Its schema describes the decision payload, not the TD document. The WoT profile defines the `thingdescription` Reference type; the Schema Descriptor profile defines `schema`. The type keys group References; `pump7` and `payload` name entries. From 7c07c4cbffb37d233069a47c0c76fec6393b4db7 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 19 Nov 2026 13:50:40 +0100 Subject: [PATCH 35/60] Simplify the Descriptor Reference extension Signed-off-by: Marc --- cloudevents/extensions/descriptors.md | 58 +++++++++++++-------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptors.md index 7ad40f94b..439b1de80 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptors.md @@ -1,15 +1,14 @@ # Descriptor Reference The OPTIONAL `describedby` attribute identifies an [xRegistry -Descriptor][Descriptor Registry] with shared inputs for interpreting an -event. The profile defines which inputs the Descriptor supplies. It need -not describe the event's source or subject. +Descriptor][Descriptor Registry] describing an event. Profiles define what +information a Descriptor provides. A descriptor can optionally describe the +event's source or subject. -xRegistry defines the Descriptor representation, retrieval of its metadata -and bundles, and [publication and Version stability][Publication Stability]. -Producers need not host or query a Registry. Producers and Consumers agree -on the profile through a specification or configuration, not through -untrusted event or Descriptor metadata. +xRegistry defines the Descriptor representation, retrieval of its metadata, +bundling, and [publication and Version stability][Publication Stability]. +Producers need not host or query such Registry. Producers and Consumers agree +on the profile through a specification or configuration. ## Notational Conventions @@ -45,36 +44,34 @@ bindings use their normal extension-attribute mapping. Consumers MUST decode attributes before checking presence. In the [JSON format](../formats/json-format.md#22-type-system-mapping), `"describedby": -null` means unset, so the profile can use its route for an -omitted `describedby`. This is not a failed explicit reference. +null` means unset. In this case a profile can define the route for an +omitted `describedby`. The name expresses a descriptive relationship, consistent with the -[`describedby` Web link relation][Link Relations]; it does not define an HTTP -`Link` header or a list of links. +[`describedby` Web link relation][Link Relations]. ## Descriptor Retrieval When `describedby` is present, the Consumer MUST use it to select the Descriptor. Retrieve it at the supplied URL with HTTP `GET`, using -`Accept: application/json` for metadata or bundle +`Accept: application/json` for metadata or if supported by bundle negotiation as defined by the [Descriptor Registry][Descriptor Registry]. + The Consumer MUST check response status, media type and Descriptor validity before using it, including any applicable selectors. `describedby` MUST -identify a Descriptor that supplies the processing inputs the profile requires -from it. Those inputs need not duplicate inputs already in the event. The -Consumer MUST NOT supplement them from another description. +reference a Descriptor that supplies the information the profile requires +from it. The Descriptor SHOULD NOT duplicate information already in the event. A Producer SHOULD omit `describedby` if the event and agreed profile -already supply all REQUIRED inputs. An absent `describedby` supplies no -Descriptor through this extension and does not authorize lookup through -another attribute. The applicable profile defines how it interprets other -event attributes and whether it requires a Descriptor Version. +already supply all REQUIRED information. The applicable profile MAY define +how to interpret other event attributes and whether a Descriptor Version +is REQUIRED. ### Failure outcomes | Condition | Result | | --- | --- | -| REQUIRED inputs obtained and selected | Processing context available; this does not itself validate the payload or authorize an operation. | +| REQUIRED inputs obtained and selected | Processing context available. It does not validate the payload or authorize an operation. | | Missing, ambiguous, unavailable or unsupported REQUIRED input | Processing context unavailable. | | Invalid shape, selector or profile value | Invalid metadata. | | Applicable validation completed | Payload valid or invalid, according to that validator. | @@ -90,16 +87,16 @@ uninterpreted event. These outcomes add no event attributes or HTTP error codes. ## Examples -### Actor and processing description +### Maintenance decision -An application profile reports an actor's maintenance decision about Pump 7. It -defines `pump7` as the subject identifier within that actor's context. +A maintenance service reports a decision about Pump 7. The event's +`describedby` URL identifies the Descriptor for interpreting that decision. ```json { "specversion": "1.0", "id": "decision-47", - "source": "https://registry.example/descriptorgroups/actors/descriptors/planner7", + "source": "urn:example:maintenance-service:planner7", "subject": "pump7", "type": "com.example.maintenance.decision.v1", "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-maintenance/versions/1", @@ -110,10 +107,11 @@ defines `pump7` as the subject identifier within that actor's context. } ``` -The Descriptor below omits Core bookkeeping. Its schema -describes the decision payload, not the TD document. The WoT profile defines -the `thingdescription` Reference type; the Schema Descriptor profile defines -`schema`. The type keys group References; `pump7` and `payload` name entries. +The Descriptor below omits xRegistry Core properties. Its schema +describes the decision payload. The WoT profile defines +the `thingdescription` reference type pointing to the pump. +The Schema Descriptor profile defines the `schema` reference type. +The type keys group References. `pump7` and `payload` name entries. ```json { @@ -135,8 +133,6 @@ the `thingdescription` Reference type; the Schema Descriptor profile defines } ``` -No actor lookup is needed. - ## Security Considerations Consumers and bundle endpoints MUST apply authorization, URL, redirect and From 8850c321df3c48cdf7a47ca79d67391e8c57ce86 Mon Sep 17 00:00:00 2001 From: Marc Date: Thu, 19 Nov 2026 14:57:43 +0100 Subject: [PATCH 36/60] Clarify Descriptor retrieval and event profile rules Signed-off-by: Marc --- cloudevents/extensions/descriptors.md | 24 ++++++++++++------------ cloudevents/extensions/opcua.md | 13 +++++++------ cloudevents/extensions/wot.md | 16 +++++++++------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptors.md index 439b1de80..c84a29076 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptors.md @@ -52,15 +52,16 @@ The name expresses a descriptive relationship, consistent with the ## Descriptor Retrieval -When `describedby` is present, the Consumer MUST use it to select the -Descriptor. Retrieve it at the supplied URL with HTTP `GET`, using -`Accept: application/json` for metadata or if supported by bundle -negotiation as defined by the [Descriptor Registry][Descriptor Registry]. +When `describedby` is present, the Consumer MUST retrieve the Descriptor at +the supplied URL with HTTP `GET`. Request metadata with +`Accept: application/json`. To request a bundle, follow the +[Descriptor Registry's][Descriptor Registry] negotiation rules. The Consumer MUST check response status, media type and Descriptor validity before using it, including any applicable selectors. `describedby` MUST reference a Descriptor that supplies the information the profile requires -from it. The Descriptor SHOULD NOT duplicate information already in the event. +from it. The Consumer MUST NOT fill gaps in that information from another +description. The Descriptor SHOULD NOT duplicate information in the event. A Producer SHOULD omit `describedby` if the event and agreed profile already supply all REQUIRED information. The applicable profile MAY define @@ -107,11 +108,10 @@ A maintenance service reports a decision about Pump 7. The event's } ``` -The Descriptor below omits xRegistry Core properties. Its schema -describes the decision payload. The WoT profile defines -the `thingdescription` reference type pointing to the pump. -The Schema Descriptor profile defines the `schema` reference type. -The type keys group References. `pump7` and `payload` name entries. +The Descriptor example omits xRegistry Core properties. +`references.thingdescription.pump7` identifies the pump's Thing Description. +`data.schema.schemaref` selects `references.schema.payload`, the schema for +the decision payload. ```json { @@ -151,6 +151,6 @@ not authenticated principals, execution grants or current readiness. Device admission and operation outcomes remain governed by their own protocols and trusted authorities. -[Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md -[Publication Stability]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md#46-versions-and-publication-stability +[Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/cc7969433b0c884b47f628acab091328d4936468/workingdrafts/models/descriptor/spec.md +[Publication Stability]: https://github.com/marcschier/xregistry-drafts/blob/cc7969433b0c884b47f628acab091328d4936468/workingdrafts/models/descriptor/spec.md#46-versions-and-publication-stability [Link Relations]: https://www.iana.org/assignments/link-relations/ diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index eb16c58bd..52ef62615 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -8,8 +8,8 @@ Core and existing extension attributes and defines OPC UA attributes. The [OPC UA Descriptor profile](#opc-ua-descriptor-profile) uses the [Descriptor Reference extension](descriptors.md) and xRegistry model to share stream metadata. Native identity comes from the NetworkMessage -envelope, Processing Descriptor or `source` query, not from either WoT -subject route (direct TD or Subject Descriptor). +envelope, the [Processing Descriptor](wot.md#web-of-things), or a `source` +query. A lookup through `subject` alone does not supply native identity. ## Notational Conventions @@ -59,7 +59,8 @@ When a CloudEvent uses both this extension and the messages: - The Producer MUST use the WoT [`type`](wot.md#type) and - [`subject`](wot.md#subject) mappings and convey native `MessageType` under + [`subject`](wot.md#subject) mappings. If `data` omits the DataSetMessage + `MessageType`, the Producer MUST convey it in [`opcuamessagetype`](#opcuamessagetype). - The Producer MUST supply the PublisherId and writer identity under the [Publisher and Writer Metadata](#publisher-and-writer-metadata) rules. @@ -210,8 +211,7 @@ than omit the status, wrap the value, or report it as _Good_. - In combination with the WoT profile, the value is REQUIRED for data and event messages when `data` omits the DataSetMessage `MessageType` field, including when other DataSetMessage header fields are retained. - - MUST NOT be present when `data` retains a full NetworkMessage envelope - that includes the DataSetMessage `MessageType`. + - MUST NOT be present when `data` includes the DataSetMessage `MessageType`. - MUST map to the Data Set Message Header `MessageType`. - The value MUST be the native OPC UA message type, such as `ua-keyframe`, `ua-deltaframe` or `ua-event`. @@ -810,6 +810,7 @@ complete `pump7-telemetry` Processing Descriptor shown above. POST /events HTTP/1.1 Host: consumer.example Content-Type: application/json +Content-Length: 29 ce-specversion: 1.0 ce-id: ua-message-25462 ce-source: urn:example:actor:telemetry-service @@ -902,4 +903,4 @@ metadata. [UA VersionTime]: https://reference.opcfoundation.org/specs/OPC-10000-4/v1.05.07/7.43 [UA ConfigurationVersion]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.6 [URI]: https://www.rfc-editor.org/rfc/rfc3986 -[Schema Descriptor Profile]: https://github.com/xregistry/spec/pull/796/files#diff-392fa7cefe828f037942a4b1cc7901449d3578fbb5704d00f851f252e5f2e44a +[Schema Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/cc7969433b0c884b47f628acab091328d4936468/workingdrafts/models/descriptor/spec.md#9-schema-descriptor-profile diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index e40fa8612..aeea3586c 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -2,9 +2,10 @@ This profile maps [Web of Things][TD] (WoT) Thing Descriptions (TDs) to CloudEvents Core attributes and the OPTIONAL -[Descriptor Reference extension](descriptors.md). Either the event's -`subject` or its Processing Descriptor selects the Thing or affordance. -The `type` names the event contract. +[Descriptor Reference extension](descriptors.md). The **Processing Descriptor** +is the Descriptor selected to supply processing inputs. Either it or the +event's `subject` selects the Thing or affordance. The `type` names the event +contract. Producers and Consumers agree on this mapping through a publication profile or configuration. A direct TD subject can stand alone; see [Description @@ -146,7 +147,8 @@ Consumers MUST NOT infer the mode or form from a response body or URL path. | `https://example.com/td/pump7/versions/3#/properties/processData` | Identify the Thing's affordance through a TD document URL; description selection follows the rules below. | | `https://example.com/descriptorgroups/subjects/descriptors/pump7-process/versions/1` | Identify a Subject Descriptor Version. Its `data.wot.subject` selects the TD and optionally one affordance. | -After event-format decoding, the Consumer MUST classify the subject as follows: +In subject-driven selection, the Consumer MUST classify the decoded `subject` +as follows: 1. If there is no literal `#`, the value MUST be an absolute HTTP(S) URL. It selects a Subject Descriptor Version under the rules below. @@ -680,6 +682,6 @@ referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 -[Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/e6f5b6af95e6abb8dfcd0311251e4244f54374aa/workingdrafts/models/descriptor/spec.md -[Schema Descriptor Profile]: https://github.com/xregistry/spec/pull/796/files#diff-392fa7cefe828f037942a4b1cc7901449d3578fbb5704d00f851f252e5f2e44a -[WoT Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/pull/8/files#diff-275076606a2e5d246231a8182b3238d3ae6823028f628b2500cb0dc2baa63018 +[Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/cc7969433b0c884b47f628acab091328d4936468/workingdrafts/models/descriptor/spec.md +[Schema Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/cc7969433b0c884b47f628acab091328d4936468/workingdrafts/models/descriptor/spec.md#9-schema-descriptor-profile +[WoT Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/ce88f1ae9dce5429e0709886bf942507b0856f8d/workingdrafts/models/wot/spec.md#66-wot-descriptor-profile From 50f93bfc264d4bbcb10ac9c63d218816f805e5a5 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 20 Nov 2026 08:36:14 +0100 Subject: [PATCH 37/60] Define portable Descriptor documents and profiles Signed-off-by: Marc --- cloudevents/extensions/README.md | 1 + cloudevents/extensions/descriptor-profiles.md | 37 +++ cloudevents/extensions/descriptor.schema.json | 87 +++++++ cloudevents/extensions/descriptors.md | 176 ++++++++++++--- cloudevents/extensions/opcua.md | 96 ++++---- cloudevents/extensions/openusd.md | 47 ++++ cloudevents/extensions/wot.md | 212 ++++++++---------- 7 files changed, 445 insertions(+), 211 deletions(-) create mode 100644 cloudevents/extensions/descriptor-profiles.md create mode 100644 cloudevents/extensions/descriptor.schema.json create mode 100644 cloudevents/extensions/openusd.md diff --git a/cloudevents/extensions/README.md b/cloudevents/extensions/README.md index b22e5b2a5..484bb6328 100644 --- a/cloudevents/extensions/README.md +++ b/cloudevents/extensions/README.md @@ -49,6 +49,7 @@ for more information. - [Distributed Tracing](distributed-tracing.md) - [Expiry Time](expirytime.md) - [OPC UA](opcua.md) +- [OpenUSD](openusd.md) (Descriptor profile) - [Partitioning](partitioning.md) - [Recorded Time](recordedtime.md) - [Sampling](sampledrate.md) diff --git a/cloudevents/extensions/descriptor-profiles.md b/cloudevents/extensions/descriptor-profiles.md new file mode 100644 index 000000000..4596a5d4d --- /dev/null +++ b/cloudevents/extensions/descriptor-profiles.md @@ -0,0 +1,37 @@ +# Schema and Endpoint Descriptor Profiles + +These profiles define entries in a [Descriptor](descriptors.md). A +publication profile determines whether an operation uses either class and +whether it needs one entry or several. Neither class adds a CloudEvents +attribute. + +The keywords "MUST" and "REQUIRED" have the meanings in +[RFC 2119](https://tools.ietf.org/html/rfc2119). + +## Schema + +A `schema` entry MUST link to a payload schema document at `url`, not its +Registry metadata. Use the linked document or the entry's bundled +`document`. A schema registry is not REQUIRED. + +To select one schema, use the `schema` entry named by the publication +profile. If the profile supplies no name, one `schema` entry selects that +schema, no entries means absence, and multiple entries are ambiguous. +A specified name that is missing or has the wrong class is invalid, not +absence. An invalid or ambiguous selection, unsupported format, or +unavailable selected document MUST NOT cause fallback to another schema. +The event binding defines precedence between this entry and `dataschema`. + +## Endpoint + +An `endpoint` entry MUST link to a representation of endpoint metadata +at `url`. For an xRegistry [Endpoint Group][Endpoint Group], use the +Group's metadata URL. The entry does not authorize invoking the endpoint. + +To select one endpoint, use the `endpoint` entry named by the publication +profile or the unique entry of that class if no name is supplied. +An absent entry, wrong class or ambiguous selection MUST be reported +when the operation needs that endpoint. The Consumer MUST NOT replace a +failed selection with an unrelated endpoint. + +[Endpoint Group]: https://github.com/xregistry/spec/blob/main/endpoint/spec.md diff --git a/cloudevents/extensions/descriptor.schema.json b/cloudevents/extensions/descriptor.schema.json new file mode 100644 index 000000000..c5d48e4f5 --- /dev/null +++ b/cloudevents/extensions/descriptor.schema.json @@ -0,0 +1,87 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "CloudEvents Descriptor", + "anyOf": [ + { "$ref": "#/$defs/metadata" }, + { "$ref": "#/$defs/bundle" } + ], + "$defs": { + "descriptor": { + "type": "object", + "required": ["descriptorid", "versionid", "entries"], + "properties": { + "descriptorid": { "type": "string", "minLength": 1 }, + "versionid": { "type": "string", "minLength": 1 }, + "entityid": { "$ref": "#/$defs/absoluteUri" }, + "bundleurl": { "$ref": "#/$defs/httpUrl" }, + "entries": { + "type": "object", + "propertyNames": { "pattern": "^[a-z0-9][a-z0-9:_.-]{0,62}(?![\\s\\S])" } + } + } + }, + "absoluteUri": { + "type": "string", + "format": "uri", + "pattern": "^[A-Za-z][A-Za-z0-9+.-]*:[^#\\s]+(?![\\s\\S])" + }, + "httpUrl": { + "$ref": "#/$defs/absoluteUri", + "pattern": "^[Hh][Tt][Tt][Pp][Ss]?://[^/?#\\s]+" + }, + "entry": { + "type": "object", + "required": ["class"], + "properties": { + "class": { + "type": "string", + "maxLength": 63, + "pattern": "^(?:[a-z][a-z0-9]*|[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+)(?![\\s\\S])" + }, + "url": { "$ref": "#/$defs/httpUrl" } + } + }, + "document": { + "type": "object", + "required": ["contenttype"], + "properties": { + "contenttype": { "type": "string", "minLength": 1 }, + "baseurl": { "$ref": "#/$defs/httpUrl" }, + "content": {}, + "contentbase64": { + "type": "string", + "contentEncoding": "base64", + "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?(?![\\s\\S])" + } + }, + "oneOf": [{ "required": ["content"] }, { "required": ["contentbase64"] }] + }, + "metadata": { + "$ref": "#/$defs/descriptor", + "properties": { + "entries": { + "additionalProperties": { + "$ref": "#/$defs/entry", + "properties": { "document": false } + } + } + } + }, + "bundle": { + "$ref": "#/$defs/descriptor", + "properties": { + "entries": { + "additionalProperties": { + "$ref": "#/$defs/entry", + "if": { "required": ["url"] }, + "then": { + "required": ["document"], + "properties": { "document": { "$ref": "#/$defs/document" } } + }, + "else": { "properties": { "document": false } } + } + } + } + } + } +} diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptors.md index c84a29076..f94c047a5 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptors.md @@ -1,14 +1,11 @@ # Descriptor Reference -The OPTIONAL `describedby` attribute identifies an [xRegistry -Descriptor][Descriptor Registry] describing an event. Profiles define what -information a Descriptor provides. A descriptor can optionally describe the -event's source or subject. - -xRegistry defines the Descriptor representation, retrieval of its metadata, -bundling, and [publication and Version stability][Publication Stability]. -Producers need not host or query such Registry. Producers and Consumers agree -on the profile through a specification or configuration. +The OPTIONAL `describedby` attribute identifies a Descriptor that supplies +information for interpreting an event. This extension defines the document +and how to retrieve it. Descriptor profiles define which entries supply the +information and how to use them. A static HTTP server or an xRegistry +Registry can serve the same document. Producers and Consumers agree on the +profile through a specification or configuration. ## Notational Conventions @@ -29,8 +26,8 @@ profile that explicitly uses its description-selection rules. this event. - Constraints: - OPTIONAL. - - If present, MUST identify a Descriptor Resource or Descriptor Version - and MUST NOT contain a fragment. + - If present, MUST be an absolute HTTP(S) URL identifying a Descriptor and + MUST NOT contain a fragment. - Consumers MUST use the URL unchanged for requests and cache lookup. Cache selection MUST account for representation and authorization context. - Consumers MUST NOT derive other URLs, including by adding `$details`, @@ -44,7 +41,7 @@ bindings use their normal extension-attribute mapping. Consumers MUST decode attributes before checking presence. In the [JSON format](../formats/json-format.md#22-type-system-mapping), `"describedby": -null` means unset. In this case a profile can define the route for an +null` means unset. In this case a profile can define the route for an omitted `describedby`. The name expresses a descriptive relationship, consistent with the @@ -53,9 +50,21 @@ The name expresses a descriptive relationship, consistent with the ## Descriptor Retrieval When `describedby` is present, the Consumer MUST retrieve the Descriptor at -the supplied URL with HTTP `GET`. Request metadata with -`Accept: application/json`. To request a bundle, follow the -[Descriptor Registry's][Descriptor Registry] negotiation rules. +the supplied URL with HTTP `GET`. A Consumer can request metadata with +`Accept: application/json` or request a bundle with +`Accept: application/vnd.xregistry.descriptor-bundle+json`. + +A server supporting negotiation MUST return the preferred available +representation, with its `Content-Type` and `Vary: Accept`. If both are +acceptable and neither is preferred, the server MUST return metadata. +A Consumer that also accepts metadata can send +`Accept: application/vnd.xregistry.descriptor-bundle+json, application/json;q=0.5`. +A server supporting negotiation MUST return `406 Not Acceptable` when +neither representation is acceptable. A static server can publish a +prebuilt bundle at `describedby` or at the advertised `bundleurl`. +When following `bundleurl`, the Consumer MUST use the advertised URL, not +construct it from `describedby`. The returned bundle MUST have the same +`descriptorid` and `versionid` as the metadata that advertised it. The Consumer MUST check response status, media type and Descriptor validity before using it, including any applicable selectors. `describedby` MUST @@ -65,8 +74,69 @@ description. The Descriptor SHOULD NOT duplicate information in the event. A Producer SHOULD omit `describedby` if the event and agreed profile already supply all REQUIRED information. The applicable profile MAY define -how to interpret other event attributes and whether a Descriptor Version -is REQUIRED. +how to interpret other event attributes and whether a URL that always +identifies the same Descriptor version is REQUIRED. + +### Descriptor document + +The [Descriptor JSON Schema](descriptor.schema.json) defines the response +shape. Validate against `metadata` or `bundle` in the schema's `$defs`, +according to the representation received. Profile and URL validation still +apply. xRegistry Core properties can accompany the document but Consumers +MUST NOT require them for this extension. + +| Member | Presence | Meaning | +| --- | --- | --- | +| `descriptorid` | REQUIRED | Nonempty identifier of the Descriptor in its publication scope. | +| `versionid` | REQUIRED | Nonempty version identifier in that Descriptor's scope. | +| `entityid` | OPTIONAL | Absolute, fragment-free URI identifying the primary described entity. It does not trigger retrieval. | +| `bundleurl` | OPTIONAL | Absolute, fragment-free HTTP(S) URL for a direct GET of the same version's bundle. Omit it when the server does not support a bundle for this Descriptor. When present in the bundle, it points to the bundle itself. | +| `entries` | REQUIRED | Map of named entries. An empty map is valid. | + +Entry names are one to 63 lowercase ASCII letters, digits, colons, hyphens, +underscores or dots, starting with a letter or digit. Each entry has a +REQUIRED `class`. The `class` identifies the linked document type, if any, +and defines the inline fields. Standard classes use short lowercase +alphanumeric tokens starting with a letter. Independent classes use +reverse DNS names under the defining party's control. Each class key is at +most 63 characters. An entry with a linked document MUST have an absolute, +fragment-free HTTP(S) `url`. An inline-only entry MUST omit `url`. A null +value is invalid. The profile defines whether a class links to a document. + +The same class MAY appear under different entry names. Profiles define how +to select entries, including where a name comes from when needed. When a +profile needs one entry and its rules leave several candidates, the Consumer +MUST report ambiguity, not choose by map order. This extension defines no +Descriptor-wide selector. + +Publishers MUST keep the entries, their inline fields, and their referenced +representations stable for the intended use and replay of a published +version. Publish a new version when those inputs change. The identifiers +alone do not establish that a URL selects a fixed version. + +### Bundled document + +A bundle has the same Descriptor members as metadata. For each entry with +a `url`, it adds a `document` object to that entry. It MUST NOT add a +`document` to an inline-only entry. Metadata responses omit all `document` +members. A bundle contains the directly linked documents only; its server +MUST NOT automatically follow links from profile fields or from the documents. + +Each `document` has a REQUIRED `contenttype` and exactly one of `content` +(a JSON value) and `contentbase64` (base64-encoded bytes). Non-JSON +representations use `contentbase64`. When the retrieved document has no +media type, use `application/octet-stream`. The server MUST decode HTTP content +codings before embedding bytes. If an allowed redirect changed the retrieval +URL, `document.baseurl` MUST give the final URL. The entry's `url` stays +unchanged. Consumers resolve any format-specific relative links against +`baseurl` if present, or the entry `url` otherwise. + +The server MUST verify authorization and obtain the complete document for +every linked entry before returning a successful bundle. If it cannot do so, +it MUST report failure rather than return a partial bundle. The Consumer +MAY retry the unchanged `describedby` URL for metadata and retrieve only +the entries it needs. That is a different representation of the same +Descriptor, not a fallback to another description. ### Failure outcomes @@ -108,28 +178,65 @@ A maintenance service reports a decision about Pump 7. The event's } ``` -The Descriptor example omits xRegistry Core properties. -`references.thingdescription.pump7` identifies the pump's Thing Description. -`data.schema.schemaref` selects `references.schema.payload`, the schema for -the decision payload. +The `pump7` entry identifies the pump's Thing Description. The `payload` +entry supplies the schema for the decision. ```json { "descriptorid": "pump7-maintenance", "versionid": "1", - "references": { - "thingdescription": { - "pump7": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - } + "entries": { + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" }, - "schema": { - "payload": { - "url": "https://schemas.example/maintenance-decision/versions/1" + "payload": { + "class": "schema", + "url": "https://schemas.example/maintenance-decision/versions/1" + } + } +} +``` + +### Bundled schema + +The client requests a bundle without constructing a new URL. The +`bundleurl` in the response identifies the same bundle for direct retrieval. + +```http +GET /descriptors/inspection-schema/versions/1 HTTP/1.1 +Host: registry.example +Accept: application/vnd.xregistry.descriptor-bundle+json +``` + +```http +HTTP/1.1 200 OK +Content-Type: application/vnd.xregistry.descriptor-bundle+json +Vary: Accept +Cache-Control: no-store +Connection: close +``` + +```json +{ + "descriptorid": "inspection-schema", + "versionid": "1", + "bundleurl": "https://registry.example/bundles/inspection-schema/1", + "entries": { + "payload": { + "class": "schema", + "url": "https://schemas.example/maintenance-decision/versions/1", + "document": { + "contenttype": "application/schema+json", + "content": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { "inspectionNeeded": { "type": "boolean" } }, + "required": ["inspectionNeeded"] + } } } - }, - "data": { "schema": { "schemaref": "payload" } } + } } ``` @@ -146,11 +253,14 @@ NOT share representations across authorization contexts unless the applicable access policy permits it. A bundle does not bypass trust checks. Versions do not authenticate content or prove unchanged bytes. +Bundle freshness MUST NOT outlast the Descriptor or any included document. +If the server cannot establish a combined policy, it MUST send +`Cache-Control: no-store`. An `ETag` for a bundle validates the whole +representation, not just its Descriptor metadata. + Descriptive entity IDs, TD security declarations and references to actions are not authenticated principals, execution grants or current readiness. Device admission and operation outcomes remain governed by their own protocols and trusted authorities. -[Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/cc7969433b0c884b47f628acab091328d4936468/workingdrafts/models/descriptor/spec.md -[Publication Stability]: https://github.com/marcschier/xregistry-drafts/blob/cc7969433b0c884b47f628acab091328d4936468/workingdrafts/models/descriptor/spec.md#46-versions-and-publication-stability [Link Relations]: https://www.iana.org/assignments/link-relations/ diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 52ef62615..0c30d6ef1 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -92,8 +92,7 @@ or [Avro Schema](https://avro.apache.org/docs/1.11.1/specification/). A Processing Descriptor MAY supply the schema. The Consumer MUST use `dataschema` when present; otherwise, use the Processing Descriptor's schema under the [Schema Descriptor profile][Schema Descriptor Profile]. -`data.schema.schemaref` names an entry in `references.schema`. Subject-only -lookup cannot supply a schema. +Subject-only lookup cannot supply a schema. The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, invalid selector, unavailable schema or unsupported format MUST NOT cause @@ -237,8 +236,8 @@ than omit the status, wrap the value, or report it as _Good_. The following values identify the OPC UA Publisher and DataSetWriter. They are not CloudEvents extension attributes. A Producer MUST supply each REQUIRED value -as a query parameter in `source` or an extension attribute of the applicable -Processing Descriptor Version unless the full Part 14 NetworkMessage envelope +as a query parameter in `source` or a field of the selected `opcuawriter` +entry unless the full Part 14 NetworkMessage envelope supplies it. The names are the same in the query and Descriptor representations. | Name | Value | @@ -377,16 +376,15 @@ topic or a CloudEvents `source`; either can carry several streams. Publishers MUST derive shared values from the native writer and metadata configuration for the emitted message. For an agreed [Descriptor binding](descriptors.md#descriptor-retrieval), they SHOULD store stream-constant -values in the Descriptor's `data.opcuawriter` object instead of repeating them -in events. Those values MUST stay constant across events using that Version. -When the object supplies such values, the selected URL MUST identify the -Version, not a Resource whose default can change before replay. +values in an `opcuawriter` entry instead of repeating them in events. +When the entry supplies those values, the Descriptor URL MUST identify a +fixed Version, not a default that can change before replay. With WoT, only Descriptor-relative subjects without `describedby` can select a Processing Descriptor through `source`. A Subject Descriptor or its annotations do not establish the writer association. -| Member of `data.opcuawriter` | JSON representation | Meaning and conditions | +| Member of an `opcuawriter` entry | JSON representation | Meaning and conditions | | --- | --- | --- | | `opcuapublisherid` | String | The stream's typed native PublisherId, under the rules in [Publisher and Writer Metadata](#publisher-and-writer-metadata). | | `opcuadatasetwriterid` | Integer, `1` to `65535` | The stream's native DataSetWriterId, when used. | @@ -407,8 +405,7 @@ ConfigurationVersion] meaning. Descriptor versioning does not change when Part The Descriptor's selected schema Reference identifies an external payload schema. Native metadata-version values MUST NOT be supplied in the event -or `data.opcuawriter` when a schema is selected through `dataschema` or the -Descriptor. +or the `opcuawriter` entry when `dataschema` or the Descriptor supplies a schema. `opcuadatasetname` is OPTIONAL and valid only in Descriptor metadata. It MUST equal `DataSetMetaDataType.Name` from the applicable @@ -484,32 +481,27 @@ query parameters to that URL. Appending a query changes the event's source identity and can change the retrieved resource. Consumers MUST NOT strip a query to make source-based retrieval work. -### xRegistry Model Mapping +### Descriptor entry -The Descriptor Registry's `data` map holds the OPTIONAL `opcuawriter` -object. Each member above is OPTIONAL in the object; the binding determines -which values the event needs. An absent or empty object supplies none. A -top-level Descriptor attribute with the same name as a member does not supply -that value. +An `opcuawriter` entry carries inline metadata and MUST omit `url`. Use +the entry of that class named by the publication profile, or the unique +entry if none is named. With no name and no entry, the Descriptor supplies +no writer metadata. A missing or wrong-class named entry or an ambiguous +selection MUST be reported. Consumers MUST NOT merge writer entries. -The Consumer MUST report invalid metadata if `opcuawriter` is not an object -or if a supplied member violates this profile's type, range or native mapping -constraints. This includes a null object or a null value for a listed member. -Core write/null rules apply to Descriptor updates; CloudEvents event-attribute -null decoding does not apply to a retrieved Descriptor. +Each native member is OPTIONAL in the entry; the binding determines which +values the event needs. A top-level field does not supply that value. Report +invalid metadata for supplied values that violate this profile, including +null values. CloudEvents attribute decoding does not apply to entry fields. JSON integers in this profile preserve the full native ranges. An alternate serialization or generated schema MUST preserve those same values, or report that it cannot represent them. In particular, an Avro `int` cannot represent the upper half of UInt32; an appropriate wider encoding is needed rather than -narrowing or wrapping the value. This profile does not change the generic -xRegistry schema generator. +narrowing or wrapping the value. -Descriptor identity, References, schema selection and publication stability -follow the Descriptor Registry. Publishers MUST retain stable referenced -representations, selectors and shared metadata for the intended processing and -replay period. A new Descriptor Version conveys changed inputs; it does not make -the native writer identity equal to a Descriptor identifier. +A Descriptor Version preserves the shared inputs, not the native writer's +identity. That identity does not depend on the Descriptor identifier. ## Examples @@ -757,29 +749,25 @@ metadata is omitted from this excerpt. { "descriptorid": "pump7-telemetry", "versionid": "1", - "references": { - "thingdescription": { - "pump7": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - }, - "gateway1": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1.0.0" - } + "entries": { + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" }, - "schema": { - "payload": { - "url": "https://schemas.example/pump-process-data/versions/3" - } + "gateway1": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1.0.0" }, - "usdasset": { - "geometry": { - "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" - } - } - }, - "data": { - "schema": { "schemaref": "payload" }, - "opcuawriter": { + "payload": { + "class": "schema", + "url": "https://schemas.example/pump-process-data/versions/3" + }, + "geometry": { + "class": "usdasset", + "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" + }, + "writer": { + "class": "opcuawriter", "opcuapublisherid": "UInt16:12", "opcuadatasetwriterid": 17, "opcuadatasetwritername": "pump7-process", @@ -791,7 +779,7 @@ metadata is omitted from this excerpt. The Consumer uses the selected Descriptor's PublisherId and writer identity with the event's `opcuamessagetype` and `opcuasequence`. The subject's `pump7` prefix -selects one of two TDs; `data.schema.schemaref` selects the payload schema. +selects one of two TDs; the `payload` entry supplies the schema. The dataset name and writer name differ. With an agreed source-Descriptor binding, a Producer can instead use the @@ -823,8 +811,8 @@ ce-opcuasequence: 18 {"Speed":1500,"Pressure":4.5} ``` -`data.wot.subject` selects one matching TD URL and the `/properties/processData` -affordance. The Processing Descriptor supplies the payload schema, `UInt16:12` +The TD entry selects `/properties/processData` at the matching TD URL. +The Processing Descriptor supplies the payload schema, `UInt16:12` PublisherId and writer identity. Without `describedby` these inputs are missing: neither the subject nor a source lookup supplies them. @@ -903,4 +891,4 @@ metadata. [UA VersionTime]: https://reference.opcfoundation.org/specs/OPC-10000-4/v1.05.07/7.43 [UA ConfigurationVersion]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.6 [URI]: https://www.rfc-editor.org/rfc/rfc3986 -[Schema Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/cc7969433b0c884b47f628acab091328d4936468/workingdrafts/models/descriptor/spec.md#9-schema-descriptor-profile +[Schema Descriptor Profile]: descriptor-profiles.md#schema diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md new file mode 100644 index 000000000..0896c61e0 --- /dev/null +++ b/cloudevents/extensions/openusd.md @@ -0,0 +1,47 @@ +# OpenUSD + +This profile defines how an event's [Descriptor](descriptors.md) identifies +an [OpenUSD](https://openusd.org/) asset. It adds no CloudEvents attributes +and does not change `source` or `subject`. + +The keywords "MUST" and "MAY" have the meanings in +[RFC 2119](https://tools.ietf.org/html/rfc2119). + +## Asset selection + +An entry with class `usdasset` MUST link to an OpenUSD asset at `url`. +When an xRegistry server hosts the asset, the Publisher MUST use the +document-view URL, not the Registry metadata URL. Use the asset directly +or from the entry's bundled `document`. + +A profile MAY select several asset entries. If it needs one, use the +exact entry name specified by the profile, or the unique `usdasset` entry +if it specifies none. The Consumer MUST report a missing, invalid, +ambiguous or unavailable asset when needed. It MUST NOT infer a selection +from the CloudEvents `subject` string, an asset filename or map order. + +This profile does not select a prim or define a mapping between a prim +and a WoT affordance. A profile that needs either operation defines it +explicitly. Asset dependencies follow OpenUSD resolution rules and are +not automatically included in a Descriptor bundle. + +For example, the `geometry` entry identifies Pump 7's asset version: + +```json +{ + "descriptorid": "pump7-geometry", + "versionid": "1", + "entries": { + "geometry": { + "class": "usdasset", + "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" + } + } +} +``` + +## Security considerations + +Follow the [Descriptor retrieval policy](descriptors.md#security-considerations) +for the asset and apply authorization and resource limits to its dependencies. +Access to a Descriptor does not grant access to either. diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index aeea3586c..e0db5efb0 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -13,10 +13,10 @@ Selection](#description-selection) for use with `describedby`. This mapping adds no attributes, transport binding or provisioning rules, and requires no particular Registry implementation. -The [WoT Descriptor profile][WoT Descriptor Profile] defines the Reference -types `thingdescription` and `thingmodel`. A **TD Reference** is a named -entry in `references.thingdescription`; a **TM Reference** is a named entry in -`references.thingmodel`. Selectors name local entries, not Reference types. +A **TD entry** has class `thingdescription`; a **TM entry** has class +`thingmodel`. Both MUST link to an ordinary resolved document at `url`, +not Registry metadata or a projection plan. A Registry publisher uses the +document-view URL. Entry names are local to the Descriptor. ## Notational Conventions @@ -74,16 +74,15 @@ identify that mapping unambiguously, the publication configuration MUST select it explicitly. A Producer MUST NOT infer the mapping solely from matching names or select the first TM link. -An OPTIONAL `data.wot.event` object in the Processing Descriptor exposes -that mapping to Consumers. Its REQUIRED `modelref` MUST name an exact entry -in `references.thingmodel`. To use the binding, Consumers MUST match its -REQUIRED `type` to the decoded CloudEvents `type` exactly and retrieve the -resolved TM under the [WoT Descriptor profile][WoT Descriptor Profile]. -An OPTIONAL `affordanceselector` identifies one declaration using the same -pointer syntax as the subject selector; omission selects no individual -declaration. Consumers MUST report a mismatched type, invalid mapping or -unavailable model when using this binding; they MUST NOT guess another -model. Listing a TM or binding does not itself require retrieval. +A TM entry in the Processing Descriptor MAY carry `type` to expose an +event binding. To use it, match the entry's `type` to the decoded event +`type` exactly. If the publication profile names a TM entry, only that +entry can match; otherwise, exactly one match is REQUIRED. An OPTIONAL +`affordanceselector` identifies a declaration in that TM using the [pointer +rules](#subject-descriptor-selection); omission selects no individual +declaration. Consumers MUST report missing, ambiguous or invalid bindings +and unavailable TMs when using the binding. Listing a TM does not itself +require retrieval. For an eligible HTTPS TM identifier, derive the type as follows: @@ -145,7 +144,7 @@ Consumers MUST NOT infer the mode or form from a response body or URL path. | `#` or `#/properties/processData` | Select the unique TD Reference in the Processing Descriptor, then the whole Thing or affordance. | | `pump7#/properties/processData` | Select the Processing Descriptor's named TD Reference `pump7`, then its affordance. | | `https://example.com/td/pump7/versions/3#/properties/processData` | Identify the Thing's affordance through a TD document URL; description selection follows the rules below. | -| `https://example.com/descriptorgroups/subjects/descriptors/pump7-process/versions/1` | Identify a Subject Descriptor Version. Its `data.wot.subject` selects the TD and optionally one affordance. | +| `https://example.com/descriptorgroups/subjects/descriptors/pump7-process/versions/1` | Identify a Subject Descriptor Version. Its selected TD entry identifies the Thing and optionally one affordance. | In subject-driven selection, the Consumer MUST classify the decoded `subject` as follows: @@ -164,8 +163,8 @@ The absence of a fragment and an empty fragment are different forms. meet that form's requirements. A percent-encoded `%23` is part of the URL, not the delimiter. Consumers MUST classify before percent-decoding a fragment. -Reference names follow the Descriptor Registry's map-key rules and cannot -contain `/`; `http:pump7#` can use a Reference name, but is not an HTTP URL. A +Entry names follow the [Descriptor rules](descriptors.md#descriptor-document) +and cannot contain `/`; `http:pump7#` can name an entry but is not an HTTP URL. A name without a literal `#` is invalid. Invalid input or an unexpected representation MUST NOT be retried through another form or resolved against `source`. @@ -203,9 +202,8 @@ type of `data`, not the TD format. The publication profile or protocol binding determines whether an external payload schema is REQUIRED. The Consumer MUST use `dataschema` when -present; otherwise, use the Processing Descriptor's schema under the [Schema -Descriptor profile][Schema Descriptor Profile]. `data.schema.schemaref` -selects a named entry in `references.schema`. Without a Processing Descriptor, +present; otherwise, select the Processing Descriptor's [schema +entry][Schema Descriptor Profile]. Without a Processing Descriptor, `dataschema` is the only candidate. The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, @@ -235,10 +233,9 @@ unset. Retrieve and validate an explicit `describedby` under the [Descriptor Reference rules](descriptors.md#descriptor-retrieval). It is authoritative for processing inputs; failure MUST NOT cause fallback. -In Descriptor-driven selection, `describedby` and the selected Processing -Descriptor's [`data.wot.subject`](#subject-descriptor-selection) are REQUIRED. -Use that selector alone. Missing or invalid input is a correlation failure, -not a reason to look up `subject` or `source`. +In Descriptor-driven selection, `describedby` is REQUIRED. Use the Processing +Descriptor's [selected TD entry](#subject-descriptor-selection). Missing or +invalid input fails correlation without looking up `subject` or `source`. In subject-driven selection, use the decoded `subject` form: @@ -258,26 +255,23 @@ In subject-driven selection, use the decoded `subject` form: failure. For a Descriptor-relative or direct-TD subject using a Processing Descriptor, -select a Reference only from `references.thingdescription`, as follows: +select only entries of class `thingdescription`: - For an empty subject prefix, the Processing Descriptor MUST have exactly one TD Reference. -- For a Reference-name prefix, the named entry MUST exist in that bucket. +- For a Reference-name prefix, the named entry MUST have that class. - For a direct URL prefix, exactly one TD Reference MUST have a `url` equal to that prefix. Consumers MUST compare the strings exactly, without URI normalization. Missing or duplicate matches are correlation failures. A named subject can disambiguate duplicate URLs. -The selected `url` identifies the ordinary TD document, not its Registry -metadata. The Consumer uses that representation directly or from an accepted -Descriptor bundle. It MUST NOT construct another URL from the Descriptor URL or -Reference. Redirect destinations, TD `id` and equal `entityid` values MUST NOT -be used to repair a subject-to-Reference mismatch. - -The representation MUST be an ordinary resolved TD, not a TM. Apply the -[WoT Descriptor profile's][WoT Descriptor Profile] admission and provenance -rules, including `planurl` and plan/view pairing. Unavailable OPTIONAL -provenance does not prevent use of an otherwise valid TD. +Use the selected TD directly or from its bundled `document`. Redirect +destinations, TD `id`, and `entityid` MUST NOT repair a subject URL mismatch. +A TD or TM entry MAY include `planurl`, an absolute, fragment-free HTTP(S) +URL for the projection plan that produced the view at `url`. Its format is +profile-defined. Consumers using the plan MUST verify that it produced the +linked view. Unavailable OPTIONAL provenance does not invalidate a resolved +view. The Producer MUST supply all REQUIRED inputs through the selected route, event and profile. A direct TD or Subject Descriptor supplies neither an @@ -293,8 +287,7 @@ action described by the TD. The Publisher MUST make the selected TD available before configuring Producers to use its URL or a Descriptor that references it. The Publisher -SHOULD use a TD Version URL. The [WoT Descriptor profile][WoT Descriptor Profile] -defines publication and stability of TDs and Subject Descriptors. +SHOULD use a TD Version URL. Changing only `describedby` does not change identity or sequence scope. A Producer MUST NOT reuse an `id` or restart a source-wide sequence merely because @@ -304,17 +297,16 @@ prove that retrieved bytes are unchanged. ### Subject Descriptor selection When `subject` selects a Descriptor, its URL MUST identify a fixed **Version** -under an agreed binding. The Consumer MUST use the URL unchanged and -verify that the response is the addressed Version. For xRegistry HTTP, check -the configured Registry base, [Version addressing][Descriptor Registry] and -returned identity. A `/versions/` substring or `versionid` alone is not -sufficient. An opaque URL is valid only if the binding identifies the Version -and defines how to verify it. The Consumer MUST report a correlation failure -if verification fails; redirects do not authorize a different Version. - -In either mode, the Consumer MUST validate the selected `data.wot.subject` -under the [WoT Descriptor profile][WoT Descriptor Profile]. Its REQUIRED -`thingref` names one entry in `references.thingdescription`. Retrieve that TD. +under an agreed binding. The Consumer MUST verify that the response is the +addressed Version under that binding. A `/versions/` substring or `versionid` +alone is insufficient. Report a correlation failure if verification fails. +Use the URL unchanged. Redirects do not authorize a different Version. + +When a Descriptor supplies the subject, select the TD entry named by the +publication profile, or the unique TD entry if it names none. Report +missing or ambiguous entries. Retrieve that TD and apply the entry's +`affordanceselector`. A subject carrying its own fragment uses that fragment +instead. Omit `affordanceselector` to select the whole Thing. A present selector MUST be a plain RFC 6901 string selecting one existing affordance: @@ -338,12 +330,10 @@ Descriptor's whole-Thing selection or affordance selector and annotations. It does not merge Descriptor fields or substitute a selector from the Processing Descriptor to repair missing or invalid subject metadata. -`data.wot.subject` and `data.wot.event` MAY appear independently. A subject -lookup MUST NOT supply event binding, schema or writer metadata, or trigger -a source lookup. Only the selected Processing Descriptor supplies those -Descriptor inputs. If both attributes name the same Version, Consumers MAY -reuse retrieval within the same representation and authorization context, -but MUST validate both roles, including the single TD URL match. +A subject-only lookup MUST NOT supply event binding, schema or writer +metadata, or trigger source retrieval. If `subject` and `describedby` name +the same Version, Consumers MAY reuse the response within its representation +and authorization context, but MUST validate both roles independently. ## Relationship to Other Extensions @@ -382,28 +372,23 @@ profile-specific shared metadata are omitted from this excerpt. { "descriptorid": "pump7-telemetry", "versionid": "1", - "references": { - "thingdescription": { - "pump7": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - }, - "gateway1": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1.0.0" - } + "entries": { + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" }, - "schema": { - "payload": { - "url": "https://schemas.example/pump-process-data/versions/3" - } + "gateway1": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1.0.0" }, - "usdasset": { - "geometry": { - "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" - } + "payload": { + "class": "schema", + "url": "https://schemas.example/pump-process-data/versions/3" + }, + "geometry": { + "class": "usdasset", + "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" } - }, - "data": { - "schema": { "schemaref": "payload" } } } ``` @@ -522,37 +507,23 @@ affordance, not processing policy. Null is invalid. { "descriptorid": "pump7-process", "versionid": "1", - "references": { - "thingdescription": { - "pump7": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - } + "entries": { + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0", + "affordanceselector": "/properties/processData", + "acme_purpose": "maintenance" }, - "thingmodel": { - "pumpmodel": { - "url": "https://registry.example/thingmodelgroups/factory/thingmodels/pump/versions/1.0.0" - } + "pumpmodel": { + "class": "thingmodel", + "url": "https://registry.example/thingmodelgroups/factory/thingmodels/pump/versions/1.0.0", + "type": "com.example.models.tm.pump.properties.processData.v1", + "affordanceselector": "/properties/processData" }, - "schema": { - "payload": { - "url": "https://schemas.example/pump-process-data/versions/3" - } + "payload": { + "class": "schema", + "url": "https://schemas.example/pump-process-data/versions/3" } - }, - "data": { - "wot": { - "subject": { - "thingref": "pump7", - "affordanceselector": "/properties/processData", - "acme_purpose": "maintenance" - }, - "event": { - "type": "com.example.models.tm.pump.properties.processData.v1", - "modelref": "pumpmodel", - "affordanceselector": "/properties/processData" - } - }, - "schema": { "schemaref": "payload" } } } ``` @@ -595,14 +566,12 @@ The Descriptor does not use an empty or null pointer. "descriptorid": "pump7-whole", "versionid": "1", "description": "Pump 7 operating state", - "references": { - "thingdescription": { - "pump7": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - } + "entries": { + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" } - }, - "data": { "wot": { "subject": { "thingref": "pump7" } } } + } } ``` @@ -645,24 +614,21 @@ The referenced Descriptor Version contains the following metadata. { "descriptorid": "pump7-state", "versionid": "1", - "references": { - "thingdescription": { - "pump7": { - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - } + "entries": { + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" }, - "schema": { - "payload": { - "url": "https://schemas.example/pump-state/versions/3" - } + "payload": { + "class": "schema", + "url": "https://schemas.example/pump-state/versions/3" } - }, - "data": { "schema": { "schemaref": "payload" } } + } } ``` The empty subject prefix selects the unique TD Reference. The TD document itself -is not the payload. `data.schema.schemaref` selects the aggregate object schema, +is not the payload. The `payload` entry supplies the aggregate object schema, not the TD or either property's DataSchema alone. A direct whole-Thing subject would end in `#` after its TD document URL. @@ -682,6 +648,4 @@ referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 -[Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/cc7969433b0c884b47f628acab091328d4936468/workingdrafts/models/descriptor/spec.md -[Schema Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/cc7969433b0c884b47f628acab091328d4936468/workingdrafts/models/descriptor/spec.md#9-schema-descriptor-profile -[WoT Descriptor Profile]: https://github.com/marcschier/xregistry-drafts/blob/ce88f1ae9dce5429e0709886bf942507b0856f8d/workingdrafts/models/wot/spec.md#66-wot-descriptor-profile +[Schema Descriptor Profile]: descriptor-profiles.md#schema From ae6fb09f356bac3fc9e1ac035f46dd2ce818e8dd Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 20 Nov 2026 09:03:02 +0100 Subject: [PATCH 38/60] Refine Descriptor bundling and OpenUSD prim selection Signed-off-by: Marc --- cloudevents/extensions/README.md | 2 +- cloudevents/extensions/descriptor-profiles.md | 37 ---- cloudevents/extensions/descriptors.md | 159 ++++++++++++------ cloudevents/extensions/opcua.md | 2 +- cloudevents/extensions/openusd.md | 91 +++++++--- cloudevents/extensions/wot.md | 2 +- 6 files changed, 181 insertions(+), 112 deletions(-) delete mode 100644 cloudevents/extensions/descriptor-profiles.md diff --git a/cloudevents/extensions/README.md b/cloudevents/extensions/README.md index 484bb6328..9bc7fe612 100644 --- a/cloudevents/extensions/README.md +++ b/cloudevents/extensions/README.md @@ -49,7 +49,7 @@ for more information. - [Distributed Tracing](distributed-tracing.md) - [Expiry Time](expirytime.md) - [OPC UA](opcua.md) -- [OpenUSD](openusd.md) (Descriptor profile) +- [OpenUSD](openusd.md) - [Partitioning](partitioning.md) - [Recorded Time](recordedtime.md) - [Sampling](sampledrate.md) diff --git a/cloudevents/extensions/descriptor-profiles.md b/cloudevents/extensions/descriptor-profiles.md deleted file mode 100644 index 4596a5d4d..000000000 --- a/cloudevents/extensions/descriptor-profiles.md +++ /dev/null @@ -1,37 +0,0 @@ -# Schema and Endpoint Descriptor Profiles - -These profiles define entries in a [Descriptor](descriptors.md). A -publication profile determines whether an operation uses either class and -whether it needs one entry or several. Neither class adds a CloudEvents -attribute. - -The keywords "MUST" and "REQUIRED" have the meanings in -[RFC 2119](https://tools.ietf.org/html/rfc2119). - -## Schema - -A `schema` entry MUST link to a payload schema document at `url`, not its -Registry metadata. Use the linked document or the entry's bundled -`document`. A schema registry is not REQUIRED. - -To select one schema, use the `schema` entry named by the publication -profile. If the profile supplies no name, one `schema` entry selects that -schema, no entries means absence, and multiple entries are ambiguous. -A specified name that is missing or has the wrong class is invalid, not -absence. An invalid or ambiguous selection, unsupported format, or -unavailable selected document MUST NOT cause fallback to another schema. -The event binding defines precedence between this entry and `dataschema`. - -## Endpoint - -An `endpoint` entry MUST link to a representation of endpoint metadata -at `url`. For an xRegistry [Endpoint Group][Endpoint Group], use the -Group's metadata URL. The entry does not authorize invoking the endpoint. - -To select one endpoint, use the `endpoint` entry named by the publication -profile or the unique entry of that class if no name is supplied. -An absent entry, wrong class or ambiguous selection MUST be reported -when the operation needs that endpoint. The Consumer MUST NOT replace a -failed selection with an unrelated endpoint. - -[Endpoint Group]: https://github.com/xregistry/spec/blob/main/endpoint/spec.md diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptors.md index f94c047a5..2b9ea59bf 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptors.md @@ -30,8 +30,6 @@ profile that explicitly uses its description-selection rules. MUST NOT contain a fragment. - Consumers MUST use the URL unchanged for requests and cache lookup. Cache selection MUST account for representation and authorization context. - - Consumers MUST NOT derive other URLs, including by adding `$details`, - a view path or query parameter, or removing `/versions/`. - An empty string or otherwise invalid set value is invalid, not absent. In the JSON event format, `describedby` is a top-level string member. In HTTP @@ -50,21 +48,11 @@ The name expresses a descriptive relationship, consistent with the ## Descriptor Retrieval When `describedby` is present, the Consumer MUST retrieve the Descriptor at -the supplied URL with HTTP `GET`. A Consumer can request metadata with -`Accept: application/json` or request a bundle with -`Accept: application/vnd.xregistry.descriptor-bundle+json`. - -A server supporting negotiation MUST return the preferred available -representation, with its `Content-Type` and `Vary: Accept`. If both are -acceptable and neither is preferred, the server MUST return metadata. -A Consumer that also accepts metadata can send -`Accept: application/vnd.xregistry.descriptor-bundle+json, application/json;q=0.5`. -A server supporting negotiation MUST return `406 Not Acceptable` when -neither representation is acceptable. A static server can publish a -prebuilt bundle at `describedby` or at the advertised `bundleurl`. -When following `bundleurl`, the Consumer MUST use the advertised URL, not -construct it from `describedby`. The returned bundle MUST have the same -`descriptorid` and `versionid` as the metadata that advertised it. +the supplied URL with HTTP `GET`. To retrieve an advertised bundle, use +HTTP `GET` on `bundleurl` as supplied. The bundle MUST have the same +`descriptorid` and `versionid` as the Descriptor that advertised it. +Negotiating a bundle at the original URL is defined in the +[xRegistry Descriptor working draft][Descriptor Registry]. The Consumer MUST check response status, media type and Descriptor validity before using it, including any applicable selectors. `describedby` MUST @@ -103,11 +91,19 @@ most 63 characters. An entry with a linked document MUST have an absolute, fragment-free HTTP(S) `url`. An inline-only entry MUST omit `url`. A null value is invalid. The profile defines whether a class links to a document. +The following `class` strings are assigned: + +- `endpoint`: [Endpoint Descriptor profile](#endpoint) +- `opcuawriter`: [OPC UA Descriptor profile](opcua.md#descriptor-entry) +- `schema`: [Schema Descriptor profile](#schema) +- `thingdescription`: [Web of Things profile](wot.md) +- `thingmodel`: [Web of Things profile](wot.md) +- `usdasset`: [OpenUSD profile](openusd.md#asset-selection) + The same class MAY appear under different entry names. Profiles define how to select entries, including where a name comes from when needed. When a profile needs one entry and its rules leave several candidates, the Consumer -MUST report ambiguity, not choose by map order. This extension defines no -Descriptor-wide selector. +MUST report ambiguity, not choose by map order. Publishers MUST keep the entries, their inline fields, and their referenced representations stable for the intended use and replay of a published @@ -125,18 +121,17 @@ MUST NOT automatically follow links from profile fields or from the documents. Each `document` has a REQUIRED `contenttype` and exactly one of `content` (a JSON value) and `contentbase64` (base64-encoded bytes). Non-JSON representations use `contentbase64`. When the retrieved document has no -media type, use `application/octet-stream`. The server MUST decode HTTP content -codings before embedding bytes. If an allowed redirect changed the retrieval -URL, `document.baseurl` MUST give the final URL. The entry's `url` stays -unchanged. Consumers resolve any format-specific relative links against +media type, use `application/octet-stream`. The server MUST decode HTTP +content codings before embedding bytes. If an allowed redirect changed the +retrieval URL, `document.baseurl` MUST give the final URL. The entry's `url` +stays unchanged. Consumers resolve any format-specific relative links against `baseurl` if present, or the entry `url` otherwise. The server MUST verify authorization and obtain the complete document for every linked entry before returning a successful bundle. If it cannot do so, -it MUST report failure rather than return a partial bundle. The Consumer -MAY retry the unchanged `describedby` URL for metadata and retrieve only -the entries it needs. That is a different representation of the same -Descriptor, not a fallback to another description. +it MUST report failure rather than return a partial bundle. If a request to +`bundleurl` fails, the Consumer MAY use the original Descriptor to retrieve +only the entries it needs. This does not select another Descriptor. ### Failure outcomes @@ -156,6 +151,38 @@ validation without REQUIRED inputs. Unless the profile dictates the outcome, local policy determines whether to defer, reject, retain or forward an uninterpreted event. These outcomes add no event attributes or HTTP error codes. +## Descriptor profiles + +A publication profile determines whether an operation uses either of the +following classes and whether it needs one entry or several. Neither +class adds a CloudEvents attribute. + +### Schema + +A `schema` entry MUST link to a payload schema document at `url`, not its +Registry metadata. Use the linked document or the entry's bundled +`document`. A schema registry is not REQUIRED. + +To select one schema, use the `schema` entry named by the publication +profile. If the profile supplies no name, one `schema` entry selects that +schema, no entries means absence, and multiple entries are ambiguous. +A specified name that is missing or has the wrong class is invalid, not +absence. An invalid or ambiguous selection, unsupported format, or +unavailable selected document MUST NOT cause fallback to another schema. +The event binding defines precedence between this entry and `dataschema`. + +### Endpoint + +An `endpoint` entry MUST link to a representation of endpoint metadata +at `url`. For an xRegistry [Endpoint Group][Endpoint Group], use the +Group's metadata URL. The entry does not authorize invoking the endpoint. + +To select one endpoint, use the `endpoint` entry named by the publication +profile or the unique entry of that class if no name is supplied. +An absent entry, wrong class or ambiguous selection MUST be reported +when the operation needs that endpoint. The Consumer MUST NOT replace a +failed selection with an unrelated endpoint. + ## Examples ### Maintenance decision @@ -178,8 +205,8 @@ A maintenance service reports a decision about Pump 7. The event's } ``` -The `pump7` entry identifies the pump's Thing Description. The `payload` -entry supplies the schema for the decision. +The `pump7` entry identifies the pump's Thing Description. The `inspection` +entry links to metadata for the inspection service endpoint. ```json { @@ -190,49 +217,73 @@ entry supplies the schema for the decision. "class": "thingdescription", "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" }, - "payload": { - "class": "schema", - "url": "https://schemas.example/maintenance-decision/versions/1" + "inspection": { + "class": "endpoint", + "url": "https://registry.example/endpoints/inspection" } } } ``` -### Bundled schema +### Bundled endpoint -The client requests a bundle without constructing a new URL. The -`bundleurl` in the response identifies the same bundle for direct retrieval. +The client retrieves the Descriptor metadata: ```http -GET /descriptors/inspection-schema/versions/1 HTTP/1.1 -Host: registry.example -Accept: application/vnd.xregistry.descriptor-bundle+json +GET /descriptors/inspection-endpoint/versions/1 HTTP/1.1 +Host: static.example +``` + +The response advertises a bundle: + +```json +{ + "descriptorid": "inspection-endpoint", + "versionid": "1", + "bundleurl": "https://static.example/bundles/inspection-endpoint/1", + "entries": { + "inspection": { + "class": "endpoint", + "url": "https://registry.example/endpoints/inspection" + } + } +} ``` +The client retrieves the bundle directly from `bundleurl`: + ```http -HTTP/1.1 200 OK -Content-Type: application/vnd.xregistry.descriptor-bundle+json -Vary: Accept -Cache-Control: no-store -Connection: close +GET /bundles/inspection-endpoint/1 HTTP/1.1 +Host: static.example ``` +The bundle includes the endpoint metadata in the `inspection` entry: + ```json { - "descriptorid": "inspection-schema", + "descriptorid": "inspection-endpoint", "versionid": "1", - "bundleurl": "https://registry.example/bundles/inspection-schema/1", + "bundleurl": "https://static.example/bundles/inspection-endpoint/1", "entries": { - "payload": { - "class": "schema", - "url": "https://schemas.example/maintenance-decision/versions/1", + "inspection": { + "class": "endpoint", + "url": "https://registry.example/endpoints/inspection", "document": { - "contenttype": "application/schema+json", + "contenttype": "application/json", "content": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { "inspectionNeeded": { "type": "boolean" } }, - "required": ["inspectionNeeded"] + "endpointid": "inspection", + "self": "https://registry.example/endpoints/inspection", + "xid": "/endpoints/inspection", + "epoch": 1, + "createdat": "2026-10-29T12:00:00Z", + "modifiedat": "2026-10-29T12:00:00Z", + "usage": ["producer"], + "protocol": "HTTP", + "protocoloptions": { + "endpoints": [ + { "uri": "https://maintenance.example/inspection-requests" } + ] + } } } } @@ -264,3 +315,5 @@ admission and operation outcomes remain governed by their own protocols and trusted authorities. [Link Relations]: https://www.iana.org/assignments/link-relations/ +[Descriptor Registry]: https://github.com/xregistry/spec/pull/796 +[Endpoint Group]: https://github.com/xregistry/spec/blob/main/endpoint/spec.md diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 0c30d6ef1..4da74eb88 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -891,4 +891,4 @@ metadata. [UA VersionTime]: https://reference.opcfoundation.org/specs/OPC-10000-4/v1.05.07/7.43 [UA ConfigurationVersion]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.6 [URI]: https://www.rfc-editor.org/rfc/rfc3986 -[Schema Descriptor Profile]: descriptor-profiles.md#schema +[Schema Descriptor Profile]: descriptors.md#schema diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md index 0896c61e0..4de7e501a 100644 --- a/cloudevents/extensions/openusd.md +++ b/cloudevents/extensions/openusd.md @@ -1,31 +1,81 @@ # OpenUSD -This profile defines how an event's [Descriptor](descriptors.md) identifies -an [OpenUSD](https://openusd.org/) asset. It adds no CloudEvents attributes -and does not change `source` or `subject`. +This extension associates a CloudEvent with an [OpenUSD](https://openusd.org/) +asset or a prim within it. It uses the +[Descriptor Reference extension](descriptors.md) and adds no CloudEvents +attributes or headers. Core attributes, including `source` and `subject`, +retain their meanings. -The keywords "MUST" and "MAY" have the meanings in -[RFC 2119](https://tools.ietf.org/html/rfc2119). +## Notational Conventions + +The key words "MUST", "MUST NOT", "REQUIRED", "MAY", and "OPTIONAL" are +to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119). +These requirements apply only to events using this extension. + +## Attributes + +### describedby + +Use the existing [`describedby`](descriptors.md#describedby) attribute to +identify the Descriptor that supplies OpenUSD context. In HTTP binary +content mode it is carried in the `ce-describedby` header. If `describedby` +is absent, this extension supplies no OpenUSD context. ## Asset selection An entry with class `usdasset` MUST link to an OpenUSD asset at `url`. When an xRegistry server hosts the asset, the Publisher MUST use the -document-view URL, not the Registry metadata URL. Use the asset directly -or from the entry's bundled `document`. +document-view URL, not the Registry metadata URL. The Consumer can use the +linked asset or the entry's bundled `document`. + +A publication profile MAY select several asset entries. If it needs one, +the Consumer MUST use the exact entry name specified by the profile or the +unique `usdasset` entry if the profile supplies no name. The Consumer MUST +report a missing, invalid, ambiguous, or unavailable asset when needed. It +MUST NOT infer a selection from `subject`, a filename, or entry order. + +### primpath -A profile MAY select several asset entries. If it needs one, use the -exact entry name specified by the profile, or the unique `usdasset` entry -if it specifies none. The Consumer MUST report a missing, invalid, -ambiguous or unavailable asset when needed. It MUST NOT infer a selection -from the CloudEvents `subject` string, an asset filename or map order. +- Type: String +- Description: The [absolute OpenUSD prim path][Prim Path] within the stage + composed from the asset selected by `url`. +- Constraints: + - OPTIONAL. Omission selects the asset without selecting an individual + prim. + - If present, MUST identify an existing prim in that stage. Null, empty, + root (`/`), relative, and property paths are invalid, as are paths + containing variant selections. + - The Consumer MUST treat the value as an OpenUSD path, not a URL + fragment or a CloudEvents subject selector. If it cannot resolve the + path, it MUST report the failure and MUST NOT substitute another prim. -This profile does not select a prim or define a mapping between a prim -and a WoT affordance. A profile that needs either operation defines it -explicitly. Asset dependencies follow OpenUSD resolution rules and are -not automatically included in a Descriptor bundle. +This extension does not define a mapping between an OpenUSD prim and a WoT +affordance. Asset dependencies follow OpenUSD resolution rules and are not +automatically included in a Descriptor bundle. -For example, the `geometry` entry identifies Pump 7's asset version: +## Examples + +The following event reports Pump 7 telemetry in HTTP binary mode. Its +`ce-describedby` header identifies the Descriptor that selects the asset and +the pressure gauge prim. The `ce-subject` value is not used for that selection. + +```http +POST /events HTTP/1.1 +Host: consumer.example +Content-Type: application/json +Content-Length: 16 +ce-specversion: 1.0 +ce-id: pump7-pressure-47 +ce-source: urn:example:asset:pump7 +ce-type: com.example.pump.pressure +ce-subject: pump7-pressure +ce-describedby: https://registry.example/descriptorgroups/streams/descriptors/pump7-geometry/versions/1 + +{"pressure":4.5} +``` + +The Descriptor's `geometry` entry selects `/Pump7/PressureGauge` in the +linked asset version: ```json { @@ -34,14 +84,17 @@ For example, the `geometry` entry identifies Pump 7's asset version: "entries": { "geometry": { "class": "usdasset", - "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" + "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2", + "primpath": "/Pump7/PressureGauge" } } } ``` -## Security considerations +## Security Considerations Follow the [Descriptor retrieval policy](descriptors.md#security-considerations) for the asset and apply authorization and resource limits to its dependencies. Access to a Descriptor does not grant access to either. + +[Prim Path]: https://openusd.org/release/api/class_sdf_path.html diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index e0db5efb0..626a4dc36 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -648,4 +648,4 @@ referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 -[Schema Descriptor Profile]: descriptor-profiles.md#schema +[Schema Descriptor Profile]: descriptors.md#schema From aa616471f87423a501d557d3abaf29f3e2c626d1 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 20 Nov 2026 11:03:59 +0100 Subject: [PATCH 39/60] Define OpenUSD field-to-prim mappings Signed-off-by: Marc --- cloudevents/extensions/openusd.md | 61 ++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md index 4de7e501a..e09e7bff9 100644 --- a/cloudevents/extensions/openusd.md +++ b/cloudevents/extensions/openusd.md @@ -38,7 +38,8 @@ MUST NOT infer a selection from `subject`, a filename, or entry order. - Type: String - Description: The [absolute OpenUSD prim path][Prim Path] within the stage - composed from the asset selected by `url`. + composed from the asset selected by `url`. It associates the event as a + whole with that prim and anchors any field mappings. - Constraints: - OPTIONAL. Omission selects the asset without selecting an individual prim. @@ -49,6 +50,35 @@ MUST NOT infer a selection from `subject`, a filename, or entry order. fragment or a CloudEvents subject selector. If it cannot resolve the path, it MUST report the failure and MUST NOT substitute another prim. +### Field mappings + +A `usdasset` entry can associate individual JSON payload fields with +descendants of the anchor prim. If `fieldmode` or `fieldmappings` is +present, `primpath` is REQUIRED. With neither member, the Consumer MUST NOT +infer field associations. Field associations do not change the event-level +association or specify writes to USD properties. + +The OPTIONAL `fieldmappings` array contains objects with two REQUIRED +string members: + +| Member | Meaning | +| --- | --- | +| `field` | A nonempty [RFC 6901 JSON Pointer][JSON Pointer] rooted at CloudEvents `data`, in string form, not a URI fragment. | +| `prim` | A relative OpenUSD prim path to an existing descendant of the anchor. Absolute paths, parent traversal (`..`), property paths, and paths containing variant selections are invalid. | + +Duplicate `field` pointers are invalid. Array order does not affect +selection. A field absent from an event, such as an omitted delta frame +field, produces no association for that event and does not clear a prior +value. The Consumer MUST report an invalid mapping or an unresolved explicit +prim target rather than infer a replacement. + +The OPTIONAL string `fieldmode` accepts only `"byname"`. In this mode, +the Consumer matches each top-level member of a JSON object in `data` to a +direct child of the anchor with the exact same name. An explicit mapping for +that field takes precedence. Without `"byname"`, only explicit mappings apply. +A field without a matching child or an explicit mapping stays unmapped; it +does not fall back to the anchor. + This extension does not define a mapping between an OpenUSD prim and a WoT affordance. Asset dependencies follow OpenUSD resolution rules and are not automatically included in a Descriptor bundle. @@ -57,25 +87,26 @@ automatically included in a Descriptor bundle. The following event reports Pump 7 telemetry in HTTP binary mode. Its `ce-describedby` header identifies the Descriptor that selects the asset and -the pressure gauge prim. The `ce-subject` value is not used for that selection. +its pump prim. The `ce-subject` value is not used for that selection. ```http POST /events HTTP/1.1 Host: consumer.example Content-Type: application/json -Content-Length: 16 +Content-Length: 43 ce-specversion: 1.0 -ce-id: pump7-pressure-47 +ce-id: pump7-telemetry-47 ce-source: urn:example:asset:pump7 -ce-type: com.example.pump.pressure -ce-subject: pump7-pressure +ce-type: com.example.pump.telemetry +ce-subject: pump7 ce-describedby: https://registry.example/descriptorgroups/streams/descriptors/pump7-geometry/versions/1 -{"pressure":4.5} +{"pressure":4.5,"speed":1200,"status":"ok"} ``` -The Descriptor's `geometry` entry selects `/Pump7/PressureGauge` in the -linked asset version: +The Descriptor's `geometry` entry selects `/Pump7` in the linked asset +version. The stage contains `/Pump7/Sensors/PressureGauge`, `/Pump7/pressure`, +and `/Pump7/speed`, but no `/Pump7/status`: ```json { @@ -85,12 +116,21 @@ linked asset version: "geometry": { "class": "usdasset", "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2", - "primpath": "/Pump7/PressureGauge" + "primpath": "/Pump7", + "fieldmode": "byname", + "fieldmappings": [ + { "field": "/pressure", "prim": "Sensors/PressureGauge" } + ] } } } ``` +The explicit mapping associates `pressure` with `/Pump7/Sensors/PressureGauge` +instead of `/Pump7/pressure`. By-name matching associates `speed` with +`/Pump7/speed`. The `status` field stays unmapped. Without either field-mapping +member, the event would still describe `/Pump7` as a whole. + ## Security Considerations Follow the [Descriptor retrieval policy](descriptors.md#security-considerations) @@ -98,3 +138,4 @@ for the asset and apply authorization and resource limits to its dependencies. Access to a Descriptor does not grant access to either. [Prim Path]: https://openusd.org/release/api/class_sdf_path.html +[JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 From f6c5f1d548c9e01089363e7802a699d1522821c2 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 20 Nov 2026 11:32:50 +0100 Subject: [PATCH 40/60] Add Descriptor entry profile schemas Signed-off-by: Marc --- cloudevents/extensions/README.md | 2 +- .../{descriptors.md => descriptor.md} | 7 ++-- cloudevents/extensions/descriptor.schema.json | 16 +++++++++ cloudevents/extensions/opcua.md | 10 +++--- cloudevents/extensions/opcua.schema.json | 25 +++++++++++++ cloudevents/extensions/openusd.md | 8 +++-- cloudevents/extensions/openusd.schema.json | 36 +++++++++++++++++++ cloudevents/extensions/wot.md | 10 +++--- cloudevents/extensions/wot.schema.json | 35 ++++++++++++++++++ 9 files changed, 135 insertions(+), 14 deletions(-) rename cloudevents/extensions/{descriptors.md => descriptor.md} (97%) create mode 100644 cloudevents/extensions/opcua.schema.json create mode 100644 cloudevents/extensions/openusd.schema.json create mode 100644 cloudevents/extensions/wot.schema.json diff --git a/cloudevents/extensions/README.md b/cloudevents/extensions/README.md index 9bc7fe612..bb8fb9676 100644 --- a/cloudevents/extensions/README.md +++ b/cloudevents/extensions/README.md @@ -45,7 +45,7 @@ for more information. - [Data Classification](data-classification.md) - [Dataref (Claim Check Pattern)](dataref.md) - [Deprecation](deprecation.md) -- [Descriptor Reference](descriptors.md) +- [Descriptor Reference](descriptor.md) - [Distributed Tracing](distributed-tracing.md) - [Expiry Time](expirytime.md) - [OPC UA](opcua.md) diff --git a/cloudevents/extensions/descriptors.md b/cloudevents/extensions/descriptor.md similarity index 97% rename from cloudevents/extensions/descriptors.md rename to cloudevents/extensions/descriptor.md index 2b9ea59bf..cdea5a5e1 100644 --- a/cloudevents/extensions/descriptors.md +++ b/cloudevents/extensions/descriptor.md @@ -154,14 +154,15 @@ uninterpreted event. These outcomes add no event attributes or HTTP error codes. ## Descriptor profiles A publication profile determines whether an operation uses either of the -following classes and whether it needs one entry or several. Neither -class adds a CloudEvents attribute. +following classes and whether it needs one entry or several. ### Schema A `schema` entry MUST link to a payload schema document at `url`, not its Registry metadata. Use the linked document or the entry's bundled `document`. A schema registry is not REQUIRED. +The [Descriptor JSON Schema](descriptor.schema.json) defines `schemaEntry` +in `$defs` for validating this entry. To select one schema, use the `schema` entry named by the publication profile. If the profile supplies no name, one `schema` entry selects that @@ -176,6 +177,8 @@ The event binding defines precedence between this entry and `dataschema`. An `endpoint` entry MUST link to a representation of endpoint metadata at `url`. For an xRegistry [Endpoint Group][Endpoint Group], use the Group's metadata URL. The entry does not authorize invoking the endpoint. +The [Descriptor JSON Schema](descriptor.schema.json) defines `endpointEntry` +in `$defs` for validating this entry. To select one endpoint, use the `endpoint` entry named by the publication profile or the unique entry of that class if no name is supplied. diff --git a/cloudevents/extensions/descriptor.schema.json b/cloudevents/extensions/descriptor.schema.json index c5d48e4f5..b71a1f2fc 100644 --- a/cloudevents/extensions/descriptor.schema.json +++ b/cloudevents/extensions/descriptor.schema.json @@ -9,6 +9,7 @@ "descriptor": { "type": "object", "required": ["descriptorid", "versionid", "entries"], + "additionalProperties": true, "properties": { "descriptorid": { "type": "string", "minLength": 1 }, "versionid": { "type": "string", "minLength": 1 }, @@ -32,6 +33,7 @@ "entry": { "type": "object", "required": ["class"], + "additionalProperties": true, "properties": { "class": { "type": "string", @@ -41,6 +43,20 @@ "url": { "$ref": "#/$defs/httpUrl" } } }, + "schemaEntry": { + "$ref": "#/$defs/entry", + "required": ["url"], + "properties": { + "class": { "const": "schema" } + } + }, + "endpointEntry": { + "$ref": "#/$defs/entry", + "required": ["url"], + "properties": { + "class": { "const": "endpoint" } + } + }, "document": { "type": "object", "required": ["contenttype"], diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 4da74eb88..af6aca622 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -6,7 +6,7 @@ DataSetMessages to CloudEvents for routing over supported protocols. It maps Core and existing extension attributes and defines OPC UA attributes. The [OPC UA Descriptor profile](#opc-ua-descriptor-profile) uses the -[Descriptor Reference extension](descriptors.md) and xRegistry model to +[Descriptor Reference extension](descriptor.md) and xRegistry model to share stream metadata. Native identity comes from the NetworkMessage envelope, the [Processing Descriptor](wot.md#web-of-things), or a `source` query. A lookup through `subject` alone does not supply native identity. @@ -375,7 +375,7 @@ topic or a CloudEvents `source`; either can carry several streams. Publishers MUST derive shared values from the native writer and metadata configuration for the emitted message. For an agreed [Descriptor -binding](descriptors.md#descriptor-retrieval), they SHOULD store stream-constant +binding](descriptor.md#descriptor-retrieval), they SHOULD store stream-constant values in an `opcuawriter` entry instead of repeating them in events. When the entry supplies those values, the Descriptor URL MUST identify a fixed Version, not a default that can change before replay. @@ -440,7 +440,7 @@ payload when the envelope, source query and explicit event attributes supply every native requirement. It MUST NOT report that result as successful WoT correlation. This is native-only interpretation, not a fallback to another Descriptor. The [Descriptor Reference failure -rules](descriptors.md#failure-outcomes) still apply. +rules](descriptor.md#failure-outcomes) still apply. Without `describedby`, the WoT profile can select a direct TD subject or a Subject Descriptor Version without selecting a Processing Descriptor. Native @@ -493,6 +493,8 @@ Each native member is OPTIONAL in the entry; the binding determines which values the event needs. A top-level field does not supply that value. Report invalid metadata for supplied values that violate this profile, including null values. CloudEvents attribute decoding does not apply to entry fields. +The [OPC UA entry schema](opcua.schema.json) checks entry shape; Consumers +still verify the PublisherId encoding and range and check the event context. JSON integers in this profile preserve the full native ranges. An alternate serialization or generated schema MUST preserve those same values, or report @@ -891,4 +893,4 @@ metadata. [UA VersionTime]: https://reference.opcfoundation.org/specs/OPC-10000-4/v1.05.07/7.43 [UA ConfigurationVersion]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.6 [URI]: https://www.rfc-editor.org/rfc/rfc3986 -[Schema Descriptor Profile]: descriptors.md#schema +[Schema Descriptor Profile]: descriptor.md#schema diff --git a/cloudevents/extensions/opcua.schema.json b/cloudevents/extensions/opcua.schema.json new file mode 100644 index 000000000..cd3c1f4b6 --- /dev/null +++ b/cloudevents/extensions/opcua.schema.json @@ -0,0 +1,25 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "CloudEvents OPC UA Descriptor entry", + "$ref": "descriptor.schema.json#/$defs/entry", + "properties": { + "class": { "const": "opcuawriter" }, + "url": false, + "document": false, + "opcuapublisherid": { + "type": "string", + "anyOf": [ + { "pattern": "^(?:Byte|UInt16|UInt32|UInt64):[1-9][0-9]*(?![\\s\\S])" }, + { "pattern": "^String:(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,4})(?![\\s\\S])" } + ] + }, + "opcuadatasetwriterid": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "opcuadatasetwritername": { "type": "string", "minLength": 1 }, + "opcuadatasetname": { "type": "string", "minLength": 1 }, + "opcuametadatamajorversion": { "$ref": "#/$defs/versionTime" }, + "opcuametadataminorversion": { "$ref": "#/$defs/versionTime" } + }, + "$defs": { + "versionTime": { "type": "integer", "minimum": 0, "maximum": 4294967295 } + } +} diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md index e09e7bff9..ac4865e3a 100644 --- a/cloudevents/extensions/openusd.md +++ b/cloudevents/extensions/openusd.md @@ -2,7 +2,7 @@ This extension associates a CloudEvent with an [OpenUSD](https://openusd.org/) asset or a prim within it. It uses the -[Descriptor Reference extension](descriptors.md) and adds no CloudEvents +[Descriptor Reference extension](descriptor.md) and adds no CloudEvents attributes or headers. Core attributes, including `source` and `subject`, retain their meanings. @@ -16,7 +16,7 @@ These requirements apply only to events using this extension. ### describedby -Use the existing [`describedby`](descriptors.md#describedby) attribute to +Use the existing [`describedby`](descriptor.md#describedby) attribute to identify the Descriptor that supplies OpenUSD context. In HTTP binary content mode it is carried in the `ce-describedby` header. If `describedby` is absent, this extension supplies no OpenUSD context. @@ -27,6 +27,8 @@ An entry with class `usdasset` MUST link to an OpenUSD asset at `url`. When an xRegistry server hosts the asset, the Publisher MUST use the document-view URL, not the Registry metadata URL. The Consumer can use the linked asset or the entry's bundled `document`. +The [OpenUSD entry schema](openusd.schema.json) checks entry shape; +Consumers still validate OpenUSD paths, targets, and field uniqueness. A publication profile MAY select several asset entries. If it needs one, the Consumer MUST use the exact entry name specified by the profile or the @@ -133,7 +135,7 @@ member, the event would still describe `/Pump7` as a whole. ## Security Considerations -Follow the [Descriptor retrieval policy](descriptors.md#security-considerations) +Follow the [Descriptor retrieval policy](descriptor.md#security-considerations) for the asset and apply authorization and resource limits to its dependencies. Access to a Descriptor does not grant access to either. diff --git a/cloudevents/extensions/openusd.schema.json b/cloudevents/extensions/openusd.schema.json new file mode 100644 index 000000000..f8e636b8d --- /dev/null +++ b/cloudevents/extensions/openusd.schema.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "CloudEvents OpenUSD Descriptor entry", + "$ref": "descriptor.schema.json#/$defs/entry", + "required": ["url"], + "properties": { + "class": { "const": "usdasset" }, + "primpath": { + "type": "string", + "pattern": "^/[^/.{}:\\s]+(?:/[^/.{}:\\s]+)*(?![\\s\\S])" + }, + "fieldmode": { "const": "byname" }, + "fieldmappings": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "object", + "required": ["field", "prim"], + "properties": { + "field": { + "type": "string", + "pattern": "^/(?:[^~]|~[01])*(?![\\s\\S])" + }, + "prim": { + "type": "string", + "pattern": "^[^/.{}:\\s]+(?:/[^/.{}:\\s]+)*(?![\\s\\S])" + } + } + } + } + }, + "dependentRequired": { + "fieldmode": ["primpath"], + "fieldmappings": ["primpath"] + } +} diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 626a4dc36..3209e6590 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -2,7 +2,7 @@ This profile maps [Web of Things][TD] (WoT) Thing Descriptions (TDs) to CloudEvents Core attributes and the OPTIONAL -[Descriptor Reference extension](descriptors.md). The **Processing Descriptor** +[Descriptor Reference extension](descriptor.md). The **Processing Descriptor** is the Descriptor selected to supply processing inputs. Either it or the event's `subject` selects the Thing or affordance. The `type` names the event contract. @@ -17,6 +17,8 @@ A **TD entry** has class `thingdescription`; a **TM entry** has class `thingmodel`. Both MUST link to an ordinary resolved document at `url`, not Registry metadata or a projection plan. A Registry publisher uses the document-view URL. Entry names are local to the Descriptor. +The [WoT entry schema](wot.schema.json) checks entry shape; Consumers +still verify the linked documents and selector targets. ## Notational Conventions @@ -163,7 +165,7 @@ The absence of a fragment and an empty fragment are different forms. meet that form's requirements. A percent-encoded `%23` is part of the URL, not the delimiter. Consumers MUST classify before percent-decoding a fragment. -Entry names follow the [Descriptor rules](descriptors.md#descriptor-document) +Entry names follow the [Descriptor rules](descriptor.md#descriptor-document) and cannot contain `/`; `http:pump7#` can name an entry but is not an HTTP URL. A name without a literal `#` is invalid. Invalid input or an unexpected representation MUST NOT be retried through another form or resolved against @@ -230,7 +232,7 @@ an exact schema Version independently of the selected TD Version. Apply event-format decoding before checking presence; JSON `null` means unset. Retrieve and validate an explicit `describedby` under the [Descriptor -Reference rules](descriptors.md#descriptor-retrieval). It is authoritative +Reference rules](descriptor.md#descriptor-retrieval). It is authoritative for processing inputs; failure MUST NOT cause fallback. In Descriptor-driven selection, `describedby` is REQUIRED. Use the Processing @@ -648,4 +650,4 @@ referenced documents or make their dependencies available. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 -[Schema Descriptor Profile]: descriptors.md#schema +[Schema Descriptor Profile]: descriptor.md#schema diff --git a/cloudevents/extensions/wot.schema.json b/cloudevents/extensions/wot.schema.json new file mode 100644 index 000000000..7081bba4b --- /dev/null +++ b/cloudevents/extensions/wot.schema.json @@ -0,0 +1,35 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "CloudEvents WoT Descriptor entry", + "oneOf": [ + { "$ref": "#/$defs/thingdescription" }, + { "$ref": "#/$defs/thingmodel" } + ], + "$defs": { + "wotEntry": { + "$ref": "descriptor.schema.json#/$defs/entry", + "required": ["url"], + "properties": { + "planurl": { "$ref": "descriptor.schema.json#/$defs/httpUrl" }, + "affordanceselector": { + "type": "string", + "pattern": "^/(?:properties|actions|events)/(?:[^~/]|~[01])+(?![\\s\\S])" + } + } + }, + "thingdescription": { + "$ref": "#/$defs/wotEntry", + "properties": { "class": { "const": "thingdescription" } } + }, + "thingmodel": { + "$ref": "#/$defs/wotEntry", + "properties": { + "class": { "const": "thingmodel" }, + "type": { + "type": "string", + "pattern": "^(?:[A-Za-z_][A-Za-z0-9_]*\\.)*v[1-9][0-9]*(?![\\s\\S])" + } + } + } + } +} From 89ffe91c10b258efcff070c4bcf679c25db746e4 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 20 Nov 2026 12:12:45 +0100 Subject: [PATCH 41/60] Address Descriptor and OPC UA review findings Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 20 +++++- cloudevents/extensions/descriptor.schema.json | 2 +- cloudevents/extensions/opcua.md | 62 ++++++++++--------- 3 files changed, 52 insertions(+), 32 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index cdea5a5e1..eae3fa27f 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -51,7 +51,9 @@ When `describedby` is present, the Consumer MUST retrieve the Descriptor at the supplied URL with HTTP `GET`. To retrieve an advertised bundle, use HTTP `GET` on `bundleurl` as supplied. The bundle MUST have the same `descriptorid` and `versionid` as the Descriptor that advertised it. -Negotiating a bundle at the original URL is defined in the +Successful responses serving Descriptor metadata or a bundle directly from +`bundleurl` MUST use `Content-Type: application/json`. Negotiating a bundle +at the original URL is defined in the [xRegistry Descriptor working draft][Descriptor Registry]. The Consumer MUST check response status, media type and Descriptor validity @@ -239,6 +241,12 @@ Host: static.example The response advertises a bundle: +```http +HTTP/1.1 200 OK +Content-Type: application/json +Connection: close +``` + ```json { "descriptorid": "inspection-endpoint", @@ -260,7 +268,13 @@ GET /bundles/inspection-endpoint/1 HTTP/1.1 Host: static.example ``` -The bundle includes the endpoint metadata in the `inspection` entry: +The response includes the endpoint metadata in the `inspection` entry: + +```http +HTTP/1.1 200 OK +Content-Type: application/json +Connection: close +``` ```json { @@ -318,5 +332,5 @@ admission and operation outcomes remain governed by their own protocols and trusted authorities. [Link Relations]: https://www.iana.org/assignments/link-relations/ -[Descriptor Registry]: https://github.com/xregistry/spec/pull/796 +[Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/d6e659fa15da069fe10eae53132ffeea36953f8c/workingdrafts/models/descriptor/spec.md#55-bundled-representations [Endpoint Group]: https://github.com/xregistry/spec/blob/main/endpoint/spec.md diff --git a/cloudevents/extensions/descriptor.schema.json b/cloudevents/extensions/descriptor.schema.json index b71a1f2fc..1324b0c20 100644 --- a/cloudevents/extensions/descriptor.schema.json +++ b/cloudevents/extensions/descriptor.schema.json @@ -28,7 +28,7 @@ }, "httpUrl": { "$ref": "#/$defs/absoluteUri", - "pattern": "^[Hh][Tt][Tt][Pp][Ss]?://[^/?#\\s]+" + "pattern": "^[Hh][Tt][Tt][Pp][Ss]?://(?:[^/?#@\\s]*@)?(?:\\[[^\\]\\s/?#]+\\]|[^\\[\\]:@/?#\\s]+)(?::[0-9]*)?(?=[/?]|(?![\\s\\S]))" }, "entry": { "type": "object", diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index af6aca622..37cef69dd 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -6,8 +6,8 @@ DataSetMessages to CloudEvents for routing over supported protocols. It maps Core and existing extension attributes and defines OPC UA attributes. The [OPC UA Descriptor profile](#opc-ua-descriptor-profile) uses the -[Descriptor Reference extension](descriptor.md) and xRegistry model to -share stream metadata. Native identity comes from the NetworkMessage +[Descriptor Reference extension](descriptor.md) to share stream metadata. +Native identity comes from the NetworkMessage envelope, the [Processing Descriptor](wot.md#web-of-things), or a `source` query. A lookup through `subject` alone does not supply native identity. @@ -33,10 +33,9 @@ field `MessageId`. An OPC UA Producer MAY identify the server using its [Application Description](https://reference.opcfoundation.org/Core/Part4/v104/docs/7.1) field `applicationUri` or a customer-configured identifier such as a unified namespace -path. For data and event messages, a Producer MUST include each publisher or -writer query parameter REQUIRED by the mapping unless the full OPC UA Part 14 -NetworkMessage envelope or the Processing Descriptor supplies its corresponding -value. +path. A Producer MAY include the query parameters defined in +[Publisher and Writer Metadata](#publisher-and-writer-metadata), subject to +that section's requirements for the combined WoT mapping. ### type @@ -193,12 +192,12 @@ payload representations can carry the full native range. [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) field `Status`. - Constraints - OPTIONAL - - REQUIRED if status is not _Good_ - - MAY be omitted if status is _Good_ + - REQUIRED if status is not _Good_ and `data` omits the native `Status` field + - MAY be omitted if status is _Good_ or `data` retains the native `Status` field -CloudEvents `Integer` is limited to the signed 32-bit range. If a native -status value cannot be represented, the Producer MUST report an error rather -than omit the status, wrap the value, or report it as _Good_. +CloudEvents `Integer` is limited to the signed 32-bit range. If the status +to be conveyed in `opcuastatus` cannot be represented, the Producer MUST +report an error rather than omit it, wrap the value, or report it as _Good_. ### opcuamessagetype @@ -270,14 +269,19 @@ configured name. For JSON message mapping, this is the [`DataSetWriterName` field][UA DataSetWriterName] when present in the DataSetMessage; otherwise the Producer obtains it from configuration. -The native PublisherId and at least one of DataSetWriterId and DataSetWriterName -are REQUIRED for all data and event messages, whether or not the WoT profile is -used. Each value MUST be supplied by the envelope or by the corresponding query -parameter or Descriptor field. A full envelope that omits an identifier does -not satisfy that identifier's presence requirement. If both writer values are -supplied, they MUST identify the same DataSetWriter. A writer name MUST uniquely -identify the DataSetWriter within the PublisherId scope. Consumers MUST compare -names exactly, without case folding or Unicode normalization. +For data and event messages that also use the WoT profile, the native +PublisherId and at least one of DataSetWriterId and DataSetWriterName are +REQUIRED. The envelope, corresponding `source` query parameters or selected +`opcuawriter` entry MUST supply those values. An envelope satisfies the +requirement only for the identifiers it carries. Without WoT, this extension +does not require those native identifiers in any of these locations. Producers +can use the OPC UA-specific `subject` mapping without supplying additional +identity metadata. + +If both writer values are supplied, they MUST identify the same DataSetWriter. +A writer name MUST uniquely identify the DataSetWriter within the PublisherId +scope. Consumers MUST compare names exactly, without case folding or Unicode +normalization. When an identity is supplied in more than one place, the representations MUST identify the same native Publisher or DataSetWriter. To compare a query or @@ -403,9 +407,9 @@ Metadata-version values retain their native [ConfigurationVersion][UA ConfigurationVersion] meaning. Descriptor versioning does not change when Part 14 requires a MajorVersion or MinorVersion update. -The Descriptor's selected schema Reference identifies an external payload -schema. Native metadata-version values MUST NOT be supplied in the event -or the `opcuawriter` entry when `dataschema` or the Descriptor supplies a schema. +When `dataschema` or the Descriptor supplies a schema, Producers MUST NOT +include metadata-version values in CloudEvents context attributes or the +`opcuawriter` entry. Native fields retained in `data` are unaffected. `opcuadatasetname` is OPTIONAL and valid only in Descriptor metadata. It MUST equal `DataSetMetaDataType.Name` from the applicable @@ -449,8 +453,8 @@ envelope or the existing source query. A direct TD, Subject Descriptor or its subject annotations MUST NOT supply missing OPC UA metadata or a payload schema. Consumers MUST NOT retrieve a source Descriptor as an implicit supplement. -Apply [WoT description selection](wot.md#description-selection). Match TD -URLs only when `subject` independently selects a TD or Subject Descriptor. +When the event uses WoT, apply +[WoT description selection](wot.md#description-selection). Only the selected Processing Descriptor MAY supply native metadata. The Descriptor Publisher MUST NOT change these values in a Descriptor Version @@ -507,9 +511,9 @@ identity. That identity does not depend on the Descriptor identifier. ## Examples -The examples preceding the WoT section use publisher `UInt16:12` and writer name -`energy-consumption-asset`. Their payloads omit the native headers, so their -`source` queries supply both identifiers. +The OPC UA-only examples use writer name `energy-consumption-asset` in +`subject`. Some also supply publisher `UInt16:12` and the writer name in the +`source` query. Those query parameters are OPTIONAL without WoT. ### Metadata message @@ -559,6 +563,8 @@ reference the correct metadata message. The `ua-deltaframe` messages will be used for hot and/or cold path processing and `ua-keyframe` messages can additional be used to update last-known-value tables. +This example uses a writer-specific `source` for sequence ordering without +carrying an explicit PublisherId or writer query parameter. ```text ------------------ PUBLISH ------------------- @@ -572,7 +578,7 @@ specversion: 1.0 type: ua-deltaframe time: 2024-03-28T21:56:42Z id: 1235-1235-1235 -source: https://factory.example.com/aggregationserver/opcua?opcuapublisherid=UInt16:12;opcuadatasetwritername=energy-consumption-asset +source: https://factory.example.com/aggregationserver/opcua/energy-consumption-asset datacontenttype: application/json; charset=utf-8 subject: energy-consumption-asset sequence: 0000000007 From 00433c95209b22e45c550f3ff6a9c96270eb82ad Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 20 Nov 2026 16:03:12 +0100 Subject: [PATCH 42/60] Clarify the Descriptor Reference extension Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 262 ++++++++++++++++----------- cloudevents/extensions/opcua.md | 2 +- cloudevents/extensions/wot.md | 8 +- 3 files changed, 163 insertions(+), 109 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index eae3fa27f..f07df80a4 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -1,11 +1,30 @@ # Descriptor Reference -The OPTIONAL `describedby` attribute identifies a Descriptor that supplies -information for interpreting an event. This extension defines the document -and how to retrieve it. Descriptor profiles define which entries supply the -information and how to use them. A static HTTP server or an xRegistry -Registry can serve the same document. Producers and Consumers agree on the -profile through a specification or configuration. +Events can stay small when they link to additional information instead of +carrying it in every message. The Descriptor Reference extension adds +`describedby`, a single URL for information beyond what the event carries. +An HTTP `GET` at that URL returns a JSON document called a Descriptor. + +For example, a maintenance event can set `describedby` to +`https://maintenance.example/pump7/versions/1`. The returned Descriptor links +to the inspection service's endpoint metadata: + +```json +{ + "descriptorid": "pump7", + "versionid": "1", + "entries": { + "inspection": { + "class": "endpoint", + "url": "https://maintenance.example/endpoints/inspection" + } + } +} +``` + +This specification defines how to retrieve the document, not how to host it. +A static HTTP server or an [xRegistry](https://xregistry.io) server can serve +the same document. ## Notational Conventions @@ -14,106 +33,100 @@ As with the main [CloudEvents specification](../spec.md), the key words "MUST", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119). -The scope of these key words is limited to events using this extension or a -profile that explicitly uses its description-selection rules. +However, the scope of these key words is limited to when this extension is +used. For example, an attribute being marked as "REQUIRED" does not mean +it needs to be in all CloudEvents, rather it needs to be included only when +this extension is being used. ## Attributes ### describedby - Type: `URI` -- Description: The absolute URL of the Descriptor selected for interpreting - this event. +- Description: The URL of the Descriptor for this event. - Constraints: - - OPTIONAL. - - If present, MUST be an absolute HTTP(S) URL identifying a Descriptor and - MUST NOT contain a fragment. - - Consumers MUST use the URL unchanged for requests and cache lookup. - Cache selection MUST account for representation and authorization context. - - An empty string or otherwise invalid set value is invalid, not absent. - -In the JSON event format, `describedby` is a top-level string member. In HTTP -binary content mode, it is the `ce-describedby` header, encoded and decoded -according to the [HTTP binding](../bindings/http-protocol-binding.md). Other -bindings use their normal extension-attribute mapping. - -Consumers MUST decode attributes before checking presence. In the [JSON -format](../formats/json-format.md#22-type-system-mapping), `"describedby": -null` means unset. In this case a profile can define the route for an -omitted `describedby`. - -The name expresses a descriptive relationship, consistent with the -[`describedby` Web link relation][Link Relations]. - -## Descriptor Retrieval - -When `describedby` is present, the Consumer MUST retrieve the Descriptor at -the supplied URL with HTTP `GET`. To retrieve an advertised bundle, use -HTTP `GET` on `bundleurl` as supplied. The bundle MUST have the same -`descriptorid` and `versionid` as the Descriptor that advertised it. -Successful responses serving Descriptor metadata or a bundle directly from -`bundleurl` MUST use `Content-Type: application/json`. Negotiating a bundle -at the original URL is defined in the -[xRegistry Descriptor working draft][Descriptor Registry]. - -The Consumer MUST check response status, media type and Descriptor validity -before using it, including any applicable selectors. `describedby` MUST -reference a Descriptor that supplies the information the profile requires -from it. The Consumer MUST NOT fill gaps in that information from another -description. The Descriptor SHOULD NOT duplicate information in the event. - -A Producer SHOULD omit `describedby` if the event and agreed profile -already supply all REQUIRED information. The applicable profile MAY define -how to interpret other event attributes and whether a URL that always -identifies the same Descriptor version is REQUIRED. - -### Descriptor document - -The [Descriptor JSON Schema](descriptor.schema.json) defines the response -shape. Validate against `metadata` or `bundle` in the schema's `$defs`, -according to the representation received. Profile and URL validation still -apply. xRegistry Core properties can accompany the document but Consumers -MUST NOT require them for this extension. - -| Member | Presence | Meaning | -| --- | --- | --- | -| `descriptorid` | REQUIRED | Nonempty identifier of the Descriptor in its publication scope. | -| `versionid` | REQUIRED | Nonempty version identifier in that Descriptor's scope. | -| `entityid` | OPTIONAL | Absolute, fragment-free URI identifying the primary described entity. It does not trigger retrieval. | -| `bundleurl` | OPTIONAL | Absolute, fragment-free HTTP(S) URL for a direct GET of the same version's bundle. Omit it when the server does not support a bundle for this Descriptor. When present in the bundle, it points to the bundle itself. | -| `entries` | REQUIRED | Map of named entries. An empty map is valid. | + - REQUIRED. + - MUST be a non-empty absolute HTTP(S) URL without a fragment. + - The URL MUST support retrieval of the Descriptor by HTTP `GET`. + A successful response serving the Descriptor metadata MUST use + `Content-Type: application/json`. -Entry names are one to 63 lowercase ASCII letters, digits, colons, hyphens, -underscores or dots, starting with a letter or digit. Each entry has a -REQUIRED `class`. The `class` identifies the linked document type, if any, -and defines the inline fields. Standard classes use short lowercase -alphanumeric tokens starting with a letter. Independent classes use -reverse DNS names under the defining party's control. Each class key is at -most 63 characters. An entry with a linked document MUST have an absolute, -fragment-free HTTP(S) `url`. An inline-only entry MUST omit `url`. A null -value is invalid. The profile defines whether a class links to a document. +Use the supplied URL, including its query if present. Other extensions can +reuse the Descriptor document format and define how to locate a Descriptor +without using `describedby`. -The following `class` strings are assigned: +## Descriptor document -- `endpoint`: [Endpoint Descriptor profile](#endpoint) -- `opcuawriter`: [OPC UA Descriptor profile](opcua.md#descriptor-entry) -- `schema`: [Schema Descriptor profile](#schema) -- `thingdescription`: [Web of Things profile](wot.md) -- `thingmodel`: [Web of Things profile](wot.md) -- `usdasset`: [OpenUSD profile](openusd.md#asset-selection) +A Descriptor document MUST be a JSON object with the following structure. +A question mark identifies an OPTIONAL member. The structure shows one named +entry; the `entries` object can hold any number of entries. + +```text +{ + "descriptorid": "", + "versionid": "", + "entityid": "", ? + "bundleurl": "", ? + "entries": { + "": { + "class": "", + "url": "", ? + ... + } + }, + ... +} +``` -The same class MAY appear under different entry names. Profiles define how -to select entries, including where a name comes from when needed. When a -profile needs one entry and its rules leave several candidates, the Consumer -MUST report ambiguity, not choose by map order. +The ellipses stand for additional fields. This specification does not define +their meaning or require registry-specific fields. The entry's class determines +whether it needs `url`. +### `descriptorid` + +REQUIRED. A non-empty string that identifies the Descriptor within its +publication scope. + +### `versionid` + +REQUIRED. A non-empty string that identifies the version within that Descriptor. Publishers MUST keep the entries, their inline fields, and their referenced -representations stable for the intended use and replay of a published -version. Publish a new version when those inputs change. The identifiers -alone do not establish that a URL selects a fixed version. +representations stable for the intended use and replay of a published version. +Publish a new version when those inputs change. The identifiers alone do not +establish that a URL selects a fixed version. + +### `entityid` + +OPTIONAL. An absolute, fragment-free URI that identifies the primary described +entity. It does not trigger retrieval. + +### `bundleurl` + +OPTIONAL. An absolute, fragment-free HTTP(S) URL for retrieving a +[bundle](#bundled-document) of this version. Omit it when the server does not +support a bundle for this Descriptor. In a bundle, this URL points to the bundle +itself. + +### `entries` + +REQUIRED. An object whose members are named entries. An empty object is valid. + +Entry names are one to 63 lowercase ASCII letters, digits, colons, hyphens, +underscores or dots, starting with a letter or digit. Each entry has a +REQUIRED `class` that identifies the kind of information the entry supplies. +An entry with a linked document MUST have an absolute, fragment-free HTTP(S) +`url`. An entry that supplies only inline fields MUST omit `url`. A null `url` +is invalid. The same class MAY appear under different entry names. ### Bundled document +A Consumer can retrieve an advertised bundle by sending HTTP `GET` to the +supplied `bundleurl`. A successful response at that URL MUST use +`Content-Type: application/json`. The bundle MUST have the same `descriptorid` +and `versionid` as the Descriptor that advertised it. The +[xRegistry Descriptor working draft][Descriptor Registry] defines how to +negotiate a bundle at the original Descriptor URL. + A bundle has the same Descriptor members as metadata. For each entry with a `url`, it adds a `document` object to that entry. It MUST NOT add a `document` to an inline-only entry. Metadata responses omit all `document` @@ -135,8 +148,47 @@ it MUST report failure rather than return a partial bundle. If a request to `bundleurl` fails, the Consumer MAY use the original Descriptor to retrieve only the entries it needs. This does not select another Descriptor. +### JSON Schema + +The [Descriptor JSON Schema](descriptor.schema.json) is available for +validation. Under `$defs`, use `metadata` for a Descriptor without embedded +documents and `bundle` for a bundle. Schema validation does not replace URL +or entry-specific checks. + +## Descriptor profiles + +A Descriptor profile is an agreement about how Producers and Consumers use +the information in a Descriptor. A specification or configuration can define +which entry classes to use, what their linked documents and inline fields +mean, and how to select entries when several have the same class. A profile +can also define how event attributes affect selection or require a URL that +always identifies the same Descriptor version. + +Standard classes use short lowercase alphanumeric tokens starting with a +letter. Other specifications can define their own classes using reverse DNS +names under the defining party's control. A `class` string is at most 63 +characters. A class definition specifies whether entries link to a document +and which additional fields they carry. + +The following `class` strings are assigned: + +- `endpoint`: [Endpoint Descriptor profile](#endpoint) +- `opcuawriter`: [OPC UA Descriptor profile](opcua.md#descriptor-entry) +- `schema`: [Schema Descriptor profile](#schema) +- `thingdescription`: [Web of Things profile](wot.md) +- `thingmodel`: [Web of Things profile](wot.md) +- `usdasset`: [OpenUSD profile](openusd.md#asset-selection) + +When a profile needs one entry and its rules leave several candidates, the +Consumer MUST report ambiguity rather than select by map order. + ### Failure outcomes +Descriptor-based interpretation requires a successful response with the +specified media type and a valid document that supplies the inputs the +profile needs. The following table distinguishes unavailable or invalid +inputs from a failed payload validation. + | Condition | Result | | --- | --- | | REQUIRED inputs obtained and selected | Processing context available. It does not validate the payload or authorize an operation. | @@ -153,11 +205,6 @@ validation without REQUIRED inputs. Unless the profile dictates the outcome, local policy determines whether to defer, reject, retain or forward an uninterpreted event. These outcomes add no event attributes or HTTP error codes. -## Descriptor profiles - -A publication profile determines whether an operation uses either of the -following classes and whether it needs one entry or several. - ### Schema A `schema` entry MUST link to a payload schema document at `url`, not its @@ -316,21 +363,26 @@ representations. An event-provided URL MUST NOT authorize arbitrary network access or credential forwarding. Implementations SHOULD bound response sizes, decompression, retrieval time, redirects and dependency processing. -Read access to a Descriptor does not grant access to its targets. Caches MUST -NOT share representations across authorization contexts unless the applicable -access policy permits it. A bundle does not bypass trust checks. Versions do not -authenticate content or prove unchanged bytes. - -Bundle freshness MUST NOT outlast the Descriptor or any included document. -If the server cannot establish a combined policy, it MUST send -`Cache-Control: no-store`. An `ETag` for a bundle validates the whole -representation, not just its Descriptor metadata. +Read access to a Descriptor does not grant access to its targets. +A bundle does not bypass trust checks. +Versions do not authenticate content or prove unchanged bytes. Descriptive entity IDs, TD security declarations and references to actions are not authenticated principals, execution grants or current readiness. Device admission and operation outcomes remain governed by their own protocols and trusted authorities. -[Link Relations]: https://www.iana.org/assignments/link-relations/ +### Caching + +Consumers can reuse responses under HTTP caching rules. When choosing a cached +response, account for the requested URL, the representation, and the +authorization context. A cache MUST NOT share a representation across +authorization contexts unless the applicable access policy permits it. + +Bundle freshness MUST NOT outlast the Descriptor or any included document. +If the server cannot establish a combined policy, it MUST send +`Cache-Control: no-store`. An `ETag` for a bundle validates the whole +representation, not just its Descriptor metadata. + [Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/d6e659fa15da069fe10eae53132ffeea36953f8c/workingdrafts/models/descriptor/spec.md#55-bundled-representations [Endpoint Group]: https://github.com/xregistry/spec/blob/main/endpoint/spec.md diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 37cef69dd..0d6cd5cdd 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -379,7 +379,7 @@ topic or a CloudEvents `source`; either can carry several streams. Publishers MUST derive shared values from the native writer and metadata configuration for the emitted message. For an agreed [Descriptor -binding](descriptor.md#descriptor-retrieval), they SHOULD store stream-constant +binding](descriptor.md#descriptor-profiles), they SHOULD store stream-constant values in an `opcuawriter` entry instead of repeating them in events. When the entry supplies those values, the Descriptor URL MUST identify a fixed Version, not a default that can change before replay. diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 3209e6590..b4230d402 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -231,9 +231,11 @@ an exact schema Version independently of the selected TD Version. ## Description Selection Apply event-format decoding before checking presence; JSON `null` means -unset. Retrieve and validate an explicit `describedby` under the [Descriptor -Reference rules](descriptor.md#descriptor-retrieval). It is authoritative -for processing inputs; failure MUST NOT cause fallback. +unset. Retrieve the Descriptor at an explicit +[`describedby`](descriptor.md#describedby) URL. It is authoritative for +processing inputs. Follow the [Descriptor Reference failure +rules](descriptor.md#failure-outcomes) without falling back to another +description. In Descriptor-driven selection, `describedby` is REQUIRED. Use the Processing Descriptor's [selected TD entry](#subject-descriptor-selection). Missing or From b7823537120e66db45dacec830394aab3ebb6350 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 20 Nov 2026 17:15:18 +0100 Subject: [PATCH 43/60] Tighten Descriptor Reference wording Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index f07df80a4..8be291e61 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -22,9 +22,8 @@ to the inspection service's endpoint metadata: } ``` -This specification defines how to retrieve the document, not how to host it. A static HTTP server or an [xRegistry](https://xregistry.io) server can serve -the same document. +the document. ## Notational Conventions @@ -79,8 +78,7 @@ entry; the `entries` object can hold any number of entries. ``` The ellipses stand for additional fields. This specification does not define -their meaning or require registry-specific fields. The entry's class determines -whether it needs `url`. +their meaning. The entry's class determines whether it needs `url`. ### `descriptorid` @@ -89,7 +87,7 @@ publication scope. ### `versionid` -REQUIRED. A non-empty string that identifies the version within that Descriptor. +REQUIRED. A non-empty string that identifies the version of the Descriptor. Publishers MUST keep the entries, their inline fields, and their referenced representations stable for the intended use and replay of a published version. Publish a new version when those inputs change. The identifiers alone do not @@ -123,9 +121,7 @@ is invalid. The same class MAY appear under different entry names. A Consumer can retrieve an advertised bundle by sending HTTP `GET` to the supplied `bundleurl`. A successful response at that URL MUST use `Content-Type: application/json`. The bundle MUST have the same `descriptorid` -and `versionid` as the Descriptor that advertised it. The -[xRegistry Descriptor working draft][Descriptor Registry] defines how to -negotiate a bundle at the original Descriptor URL. +and `versionid` as the Descriptor that advertised it. A bundle has the same Descriptor members as metadata. For each entry with a `url`, it adds a `document` object to that entry. It MUST NOT add a @@ -384,5 +380,4 @@ If the server cannot establish a combined policy, it MUST send `Cache-Control: no-store`. An `ETag` for a bundle validates the whole representation, not just its Descriptor metadata. -[Descriptor Registry]: https://github.com/marcschier/xregistry-drafts/blob/d6e659fa15da069fe10eae53132ffeea36953f8c/workingdrafts/models/descriptor/spec.md#55-bundled-representations [Endpoint Group]: https://github.com/xregistry/spec/blob/main/endpoint/spec.md From 7485bad2a4d72c64b9509707db6ace7d38e44373 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 20 Nov 2026 17:43:03 +0100 Subject: [PATCH 44/60] Clarify the WoT, OPC UA, and OpenUSD extensions Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 371 +++++++++++++++--------------- cloudevents/extensions/openusd.md | 117 ++++++---- cloudevents/extensions/wot.md | 336 ++++++++++++++------------- 3 files changed, 432 insertions(+), 392 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 0d6cd5cdd..a808af762 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -1,15 +1,52 @@ # OPC UA -This extension maps [OPC UA](https://reference.opcfoundation.org/Core/Part1/v105/docs/) +This extension lets a Consumer route +[OPC UA](https://reference.opcfoundation.org/Core/Part1/v105/docs/) [PubSub](https://reference.opcfoundation.org/Core/Part14/v105/docs/) -DataSetMessages to CloudEvents for routing over supported protocols. It maps -Core and existing extension attributes and defines OPC UA attributes. +messages using CloudEvents attributes. A DataSetWriter publishes a +DataSetMessage that carries measurements or an event. In this example, +the CloudEvents `type` identifies a keyframe and `subject` identifies its +writer. The Consumer has the OPC UA metadata for this stream. The HTTP +request uses CloudEvents binary mode: -The [OPC UA Descriptor profile](#opc-ua-descriptor-profile) uses the -[Descriptor Reference extension](descriptor.md) to share stream metadata. -Native identity comes from the NetworkMessage -envelope, the [Processing Descriptor](wot.md#web-of-things), or a `source` -query. A lookup through `subject` alone does not supply native identity. +```http +POST /events HTTP/1.1 +Host: consumer.example +Content-Type: application/json +Content-Length: 16 +ce-specversion: 1.0 +ce-id: pump7-sample-1 +ce-source: urn:example:pump7 +ce-type: ua-keyframe +ce-subject: pump7-process +ce-time: 2026-10-29T12:00:00Z + +{"Pressure":4.5} +``` + +When Consumers need metadata shared by a stream, the Producer can use +[`describedby`](descriptor.md#describedby) to point to a Descriptor. This +**Processing Descriptor** supplies shared inputs. For example, an inline +`opcuawriter` entry can carry publisher and writer identity: + +```json +{ + "descriptorid": "pump7-stream", + "versionid": "1", + "entries": { + "writer": { + "class": "opcuawriter", + "opcuapublisherid": "UInt16:12", + "opcuadatasetwriterid": 17 + } + } +} +``` + +Values such as the event ID and time stay with each event. The +[OPC UA Descriptor profile](#opc-ua-descriptor-profile) defines the shared +fields. The [combined WoT mapping](#wot-mapping) covers events that also +use the Web of Things (WoT) profile. ## Notational Conventions @@ -18,7 +55,9 @@ As with the main [CloudEvents specification](../spec.md), the key words "MUST", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119). -These requirements apply only to events using this extension. +However, the scope of these key words is limited to when this extension is +used. For example, an attribute marked as "REQUIRED" needs to be included +when the event uses this extension and meets the stated conditions. ## Mapping of REQUIRED Attributes @@ -43,36 +82,14 @@ An OPC UA Producer MAY map `type` to the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) field `MessageType`. For data and event messages without the WoT profile, the Producer MUST use that native value as `type` when the DataSetMessage -`MessageType` field is absent from `data`. A retained header does not -guarantee that field is present: the native content mask controls inclusion. +`MessageType` field is absent from `data`. For a retained header, the +native content mask determines whether it carries that field. A Producer using the WoT profile MUST instead follow its semantic event-type rules and the [opcuamessagetype](#opcuamessagetype) requirements for conveying the native message type. The [WoT mapping section](#wot-mapping) specifies the combined mapping. -### WoT mapping - -When a CloudEvent uses both this extension and the -[WoT profile](./wot.md), the following mappings apply to data and event -messages: - -- The Producer MUST use the WoT [`type`](wot.md#type) and - [`subject`](wot.md#subject) mappings. If `data` omits the DataSetMessage - `MessageType`, the Producer MUST convey it in - [`opcuamessagetype`](#opcuamessagetype). -- The Producer MUST supply the PublisherId and writer identity under the - [Publisher and Writer Metadata](#publisher-and-writer-metadata) rules. -- Nothing MUST be appended to `subject`. For an event message, the `EventId` - remains in the OPC UA event payload. -- `opcuasequence` MUST carry the native `SequenceNumber`. The CloudEvents - `sequence` attribute, when present, MUST satisfy the independent ordering - requirements of the Sequence extension and MUST NOT be inferred from - `opcuasequence`. - -These mappings override only conflicting rules. A profile MUST meet every -other applicable requirement to conform to this extension. - ## Mapping of OPTIONAL Attributes ### datacontenttype @@ -91,13 +108,12 @@ or [Avro Schema](https://avro.apache.org/docs/1.11.1/specification/). A Processing Descriptor MAY supply the schema. The Consumer MUST use `dataschema` when present; otherwise, use the Processing Descriptor's schema under the [Schema Descriptor profile][Schema Descriptor Profile]. -Subject-only lookup cannot supply a schema. The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, invalid selector, unavailable schema or unsupported format MUST NOT cause fallback to another schema. If `dataschema` is present, the Consumer MUST -still validate applicable Descriptor selectors, without selecting a -Descriptor schema or comparing schema documents. Producers and Descriptor +still validate applicable Descriptor selectors and use `dataschema` as the +sole schema input. Producers and Descriptor publishers SHOULD supply one schema source or identify the same schema in both. The Producer SHOULD omit `dataschema` when the Descriptor supplies the schema. The selected schema MUST describe `data`, including the @@ -133,31 +149,25 @@ WoT mapping or `type` for the non-WoT mapping, as specified above. Without WoT, `sequence`, if present, MUST map to the native DataSetMessage [`SequenceNumber`][UA SequenceNumber]. The Publisher increments it per -DataSetWriter; it does not order multiple writers sharing a `source`. +DataSetWriter. The Producer MUST scope `source` to the writer's ordering scope and format `sequence` so lexical comparison preserves event order, for example by padding the unsigned decimal value to ten digits. The Producer MUST NOT use the counter if a reset, rollover or shared source prevents that ordering. -With WoT, subject selection does not identify the writer. -`opcuasequence` carries the native counter. If `sequence` is present, -it MUST satisfy the [Sequence extension](./sequence.md) independently and -MUST NOT be inferred from `opcuasequence`. +For events using WoT, see the [combined mapping](#wot-mapping). ### traceparent -Attribute as defined by [distributed-tracing extension](./distributed-tracing.md) -to allow tracing from event publisher towards consumer. +See the [Distributed Tracing extension](./distributed-tracing.md#traceparent). ### tracestate -Attribute as defined by [distributed-tracing extension](./distributed-tracing.md) -MAY be used to allow tracing from event publisher towards consumer. +See the [Distributed Tracing extension](./distributed-tracing.md#tracestate). ### recordedtime -Attribute as defined by [recordedtime extension](./recordedtime.md) to -determine the latency between event publisher towards consumer. +See the [Recorded Time extension](./recordedtime.md#recordedtime). ## Attributes @@ -167,7 +177,7 @@ determine the latency between event publisher towards consumer. - Description: Links dataset message to the current version of the metadata. Contains value from `MajorVersion` of [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) field `MetaDataVersion`. - Constraints - - OPTIONAL but MUST NOT be present if `dataschema` is used + - OPTIONAL, subject to the [schema and metadata-version rules](#metadata-versions) ### opcuametadataminorversion @@ -177,7 +187,7 @@ Contains value from `MinorVersion` of [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) field `MetaDataVersion`. - Constraints - - OPTIONAL but MUST NOT be present if `dataschema` is used + - OPTIONAL, subject to the [schema and metadata-version rules](#metadata-versions) Both event attributes map unsigned [VersionTime][UA VersionTime] to CloudEvents `Integer` (`0` to `2147483647`, inclusive). Producers MUST @@ -233,11 +243,11 @@ report an error rather than omit it, wrap the value, or report it as _Good_. ## Publisher and Writer Metadata -The following values identify the OPC UA Publisher and DataSetWriter. They are -not CloudEvents extension attributes. A Producer MUST supply each REQUIRED value -as a query parameter in `source` or a field of the selected `opcuawriter` -entry unless the full Part 14 NetworkMessage envelope -supplies it. The names are the same in the query and Descriptor representations. +The following names identify the OPC UA Publisher and DataSetWriter +when supplied as `source` query parameters or in an `opcuawriter` entry. +The native envelope carries these values under their OPC UA field names. +The [combined WoT mapping](#wot-mapping) defines when the identities are +REQUIRED; in the OPC UA-only mapping these values are OPTIONAL. | Name | Value | | --- | --- | @@ -269,15 +279,6 @@ configured name. For JSON message mapping, this is the [`DataSetWriterName` field][UA DataSetWriterName] when present in the DataSetMessage; otherwise the Producer obtains it from configuration. -For data and event messages that also use the WoT profile, the native -PublisherId and at least one of DataSetWriterId and DataSetWriterName are -REQUIRED. The envelope, corresponding `source` query parameters or selected -`opcuawriter` entry MUST supply those values. An envelope satisfies the -requirement only for the identifiers it carries. Without WoT, this extension -does not require those native identifiers in any of these locations. Producers -can use the OPC UA-specific `subject` mapping without supplying additional -identity metadata. - If both writer values are supplied, they MUST identify the same DataSetWriter. A writer name MUST uniquely identify the DataSetWriter within the PublisherId scope. Consumers MUST compare names exactly, without case folding or Unicode @@ -334,11 +335,8 @@ neither the envelope nor the Descriptor supplies them. The writer name is mqtt://site/line/cell/device/sensor?opcuapublisherid=UInt16:12;opcuadatasetwritername=Pump%26Process;site=north ``` -Changing `source`, including its query parameters, changes the CloudEvents -event-identity and [Sequence extension](sequence.md) scope. When returning to -an earlier `source`, the Producer MUST preserve the uniqueness of `source` -plus `id`. When using the Sequence extension, its `sequence` values MUST -remain ordered relative to earlier events from that same source. +Changing `source`, including its query parameters, changes the scope +of [event identity](../spec.md#id) and the [Sequence extension](sequence.md). ## General Constraints @@ -353,13 +351,14 @@ referenced via `dataschema` attribute or selected through a Descriptor. - OPC UA PubSub JSON messages MUST contain exactly one DataSetMessage, including when a full NetworkMessage envelope is retained. -A retained envelope does not replace the REQUIRED CloudEvents attributes or -the per-event `opcuasequence` attribute when the WoT mapping applies. +A Producer MUST supply the REQUIRED CloudEvents attributes and, when the +WoT mapping applies, the per-event `opcuasequence` even with a retained +envelope. Native message type conveyance follows [type](#type) and [opcuamessagetype](#opcuamessagetype), according to whether the WoT profile is used and whether the DataSetMessage `MessageType` field is present. -The NetworkMessage's `ua-data` type is not the DataSetMessage type. Any -duplicated native values MUST agree after applying the specified mappings. +Read the native message type from the DataSetMessage header when present. +Any duplicated native values MUST agree after applying the specified mappings. The Consumer MUST report a conflict and MUST NOT interpret a message as conforming to this extension when they disagree. @@ -367,147 +366,152 @@ conforming to this extension when they disagree. This profile defines Descriptor fields for OPC UA Part 14 Publisher, DataSetWriter, DataSet and ConfigurationVersion metadata. A Processing -Descriptor is OPTIONAL: the event and native envelope can supply the -inputs. This OPC UA profile requires a Version URL only when the Processing -Descriptor supplies shared fields. +Descriptor is OPTIONAL. The native envelope and event can also carry inputs. -### Shared Stream Metadata in a Descriptor +### Descriptor entry A message stream here is a configured flow from one Publisher and -DataSetWriter with a defined payload contract. It is not necessarily a broker -topic or a CloudEvents `source`; either can carry several streams. +DataSetWriter with a defined payload contract. A broker topic or a +CloudEvents `source` can carry several such streams. Publishers MUST derive shared values from the native writer and metadata configuration for the emitted message. For an agreed [Descriptor binding](descriptor.md#descriptor-profiles), they SHOULD store stream-constant -values in an `opcuawriter` entry instead of repeating them in events. -When the entry supplies those values, the Descriptor URL MUST identify a -fixed Version, not a default that can change before replay. +values in an `opcuawriter` entry. An `opcuawriter` entry carries its values +inline and MUST omit `url`. When the entry supplies shared inputs, the +Descriptor URL MUST identify a fixed version so that replay selects the +same inputs. + +A publication profile is the agreed set of rules for interpreting the event. +Use the `opcuawriter` entry named by the publication profile, or the unique +entry of that class if the profile supplies no name. With no name and no +entry, writer metadata is absent from the Descriptor. A Consumer MUST +report a missing or wrong-class named entry or an ambiguous selection and +MUST take Descriptor writer metadata from the selected entry alone. + +### Shared Stream Metadata in a Descriptor -With WoT, only Descriptor-relative subjects without `describedby` can select -a Processing Descriptor through `source`. A Subject Descriptor or its -annotations do not establish the writer association. +Each member in the following table is OPTIONAL in the entry. The binding +determines which values the event needs. Supply these fields inside the +entry. Report invalid metadata for supplied values that violate this +profile, including null values. Interpret the fields as JSON members of +the entry under their declared types. | Member of an `opcuawriter` entry | JSON representation | Meaning and conditions | | --- | --- | --- | | `opcuapublisherid` | String | The stream's typed native PublisherId, under the rules in [Publisher and Writer Metadata](#publisher-and-writer-metadata). | | `opcuadatasetwriterid` | Integer, `1` to `65535` | The stream's native DataSetWriterId, when used. | | `opcuadatasetwritername` | Non-empty String | The stream's exact configured DataSetWriterName, when used. | -| `opcuadatasetname` | Non-empty String | The `Name` of the applicable DataSet metadata; descriptive, not a writer identifier. | +| `opcuadatasetname` | Non-empty String | The `Name` of the applicable DataSet metadata. | | `opcuametadatamajorversion` | Integer, `0` to `4294967295` | The native MajorVersion, when no payload schema is selected. | | `opcuametadataminorversion` | Integer, `0` to `4294967295` | The native MinorVersion, when no payload schema is selected. | Ranges are inclusive. Publisher and writer fields MUST follow [Publisher -and Writer Metadata](#publisher-and-writer-metadata). The Descriptor's -metadata-version fields MUST preserve the full `VersionTime` (`UInt32`) range, -independent of the CloudEvents `Integer` limit. Consumers MUST compare -duplicate values without narrowing. Out-of-range fields are invalid metadata. +and Writer Metadata](#publisher-and-writer-metadata). + +#### Metadata versions + +Represent each Descriptor metadata-version field as a JSON integer in the +full `VersionTime` (`UInt32`) range. Consumers MUST compare duplicate +values without narrowing and report out-of-range values as invalid metadata. Metadata-version values retain their native [ConfigurationVersion][UA -ConfigurationVersion] meaning. Descriptor versioning does not change when Part -14 requires a MajorVersion or MinorVersion update. +ConfigurationVersion] meaning. Apply Part 14's MajorVersion and +MinorVersion update rules independently of Descriptor versioning. When `dataschema` or the Descriptor supplies a schema, Producers MUST NOT include metadata-version values in CloudEvents context attributes or the `opcuawriter` entry. Native fields retained in `data` are unaffected. -`opcuadatasetname` is OPTIONAL and valid only in Descriptor metadata. -It MUST equal `DataSetMetaDataType.Name` from the applicable -[DataSet metadata][UA DataSet Metadata] or its approved configuration, not -a name inferred from the writer, topic or TD affordance. It need not be -unique and MUST NOT replace a REQUIRED PublisherId, DataSetWriter identity -or native field. Repeated dataset names MUST match exactly, without case -folding or Unicode normalization; a mismatch is a metadata conflict. +#### DataSet name + +`opcuadatasetname` belongs only in Descriptor metadata. It MUST equal +`DataSetMetaDataType.Name` from the applicable +[DataSet metadata][UA DataSet Metadata] or its approved configuration. +It is descriptive and can recur across writers. A Consumer MUST obtain +any REQUIRED native identifier independently. Repeated dataset names MUST +match exactly; a mismatch is a metadata conflict. + +### Using shared inputs For the listed values, an applicable Descriptor satisfies this extension's presence requirements for the corresponding field, including those of the -combined WoT mapping. The dataset name satisfies no publisher or writer identity -requirement. A Producer MAY omit the corresponding event attribute or source -query parameter. Other event attributes, including `opcuamessagetype`, MUST NOT -be replaced by Descriptor members. - -If a publisher or writer value appears in both the `source` query and the -Descriptor, the values MUST agree after decoding and type conversion. If an -event attribute and the Descriptor both supply a metadata version, their typed -values MUST agree. The same consistency requirement applies to publisher and -writer identities retained in the envelope. On a conflict, the Consumer MUST -report a metadata conflict and MUST NOT interpret the payload as a conforming -OPC UA message. If a REQUIRED value is absent from all applicable locations, the -Consumer MUST report missing metadata and MUST NOT interpret the payload as a -conforming OPC UA message. - -A Consumer MUST use only the Processing Descriptor selected by the agreed -binding for shared schema and native metadata inputs. If `describedby` is -present, missing values MUST NOT be taken from a source or subject description. -If the Consumer cannot retrieve that Descriptor, it MAY interpret the native -payload when the envelope, source query and explicit event attributes supply -every native requirement. It MUST NOT report that result as successful WoT -correlation. This is native-only interpretation, not a fallback to another -Descriptor. The [Descriptor Reference failure -rules](descriptor.md#failure-outcomes) still apply. - -Without `describedby`, the WoT profile can select a direct TD subject or a -Subject Descriptor Version without selecting a Processing Descriptor. Native -publisher and writer requirements then have to be satisfied by the retained -envelope or the existing source query. A direct TD, Subject Descriptor or its -subject annotations MUST NOT supply missing OPC UA metadata or a payload schema. -Consumers MUST NOT retrieve a source Descriptor as an implicit supplement. - -When the event uses WoT, apply -[WoT description selection](wot.md#description-selection). -Only the selected Processing Descriptor MAY supply native metadata. +combined WoT mapping. A Producer MAY omit the corresponding event attribute +or source query parameter. + +Apply the [identity consistency rules](#publisher-and-writer-metadata) +across the query, Descriptor, and native envelope. If an event attribute +and the Descriptor both supply a metadata version, their typed values MUST +agree. On a conflict, the Consumer MUST report a metadata conflict and +treat the event as nonconforming. If a REQUIRED value is absent from all +applicable locations, the Consumer MUST report missing metadata and treat +the event as nonconforming. + +A Consumer MUST use the selected Processing Descriptor as the sole +Descriptor source for shared schema and native metadata. +If retrieval fails, follow the [Descriptor Reference failure +rules](descriptor.md#failure-outcomes) for the Descriptor-based operation. +The Consumer MAY still interpret the native payload if the envelope, source +query, and explicit event attributes supply every native requirement. +That result is independent of WoT correlation. The Descriptor Publisher MUST NOT change these values in a Descriptor Version after any Producer is configured with its URL. A change requires a new Descriptor Version and reconfigured Producers. Consumers MUST NOT retain values from a previous Descriptor when processing an event that selects another -Descriptor. A changed payload contract also requires a changed WoT `type` -revision when that profile is used; changing only `describedby` is not -sufficient. +Descriptor. The OPC UA identifiers determine the writer identity; the +Descriptor version identifies the shared inputs. For a changed WoT payload +contract, apply the [WoT `type` revision rules](wot.md#type). Values that vary by occurrence remain in each event. In particular, -`opcuamessagetype`, `opcuasequence`, `opcuastatus` when REQUIRED, `id`, and -`time` MUST NOT be supplied by the Descriptor as replacements for their event -attributes. Tracing, recording times, and a CloudEvents `sequence`, when used, -also remain in the event. A Consumer MUST NOT use Descriptor members with those -names as event values. Core attributes retain their normal placement and meaning -even when their values happen to be constant for a stream. +the Producer MUST supply `opcuamessagetype`, `opcuasequence`, `opcuastatus`, +`id`, and `time` on the event when their respective rules require them. +Consumers MUST obtain these attributes and any tracing, recording time, +and CloudEvents `sequence` values from the event itself. Core attributes +retain their CloudEvents placement and meaning. When the agreed route selects no Processing Descriptor, the Producer MUST supply -all REQUIRED OPC UA values through the other locations defined above. An absent -`describedby` alone does not determine whether a Processing Descriptor was -selected. Producers SHOULD use Descriptor metadata only when the intended -Consumers support the agreed mapping. +all REQUIRED OPC UA values through the other applicable locations. +Producers SHOULD use Descriptor metadata only when the intended Consumers +support the agreed mapping. When `source` is itself a Descriptor URL, Producers SHOULD supply shared -identity metadata in the selected versioned Descriptor instead of appending -query parameters to that URL. Appending a query changes the event's source -identity and can change the retrieved resource. Consumers MUST NOT strip a query -to make source-based retrieval work. +identity metadata in the selected versioned Descriptor. A query forms +part of the source identity and can change the retrieved resource. +Consumers MUST retrieve the exact `source` URL when that route applies. -### Descriptor entry +JSON integers in this profile preserve the full native ranges. An alternate +serialization or generated schema MUST preserve those same values, or report +an encoding error. For example, use an Avro type wide enough to preserve +the full UInt32 range. -An `opcuawriter` entry carries inline metadata and MUST omit `url`. Use -the entry of that class named by the publication profile, or the unique -entry if none is named. With no name and no entry, the Descriptor supplies -no writer metadata. A missing or wrong-class named entry or an ambiguous -selection MUST be reported. Consumers MUST NOT merge writer entries. +The [OPC UA entry schema](opcua.schema.json) checks entry shape. Verify +PublisherId encoding, ranges, and the event context under the rules above. -Each native member is OPTIONAL in the entry; the binding determines which -values the event needs. A top-level field does not supply that value. Report -invalid metadata for supplied values that violate this profile, including -null values. CloudEvents attribute decoding does not apply to entry fields. -The [OPC UA entry schema](opcua.schema.json) checks entry shape; Consumers -still verify the PublisherId encoding and range and check the event context. +## WoT mapping -JSON integers in this profile preserve the full native ranges. An alternate -serialization or generated schema MUST preserve those same values, or report -that it cannot represent them. In particular, an Avro `int` cannot represent the -upper half of UInt32; an appropriate wider encoding is needed rather than -narrowing or wrapping the value. +When a CloudEvent uses both this extension and the [WoT profile](wot.md), +apply [WoT description selection](wot.md#description-selection). For data +and event messages, the following mappings take precedence over the +corresponding OPC UA-only mappings: -A Descriptor Version preserves the shared inputs, not the native writer's -identity. That identity does not depend on the Descriptor identifier. +- The Producer MUST use the WoT [`type`](wot.md#type) and + [`subject`](wot.md#subject) mappings. Use the WoT subject as specified + there and keep the native `EventId` in the OPC UA event payload. + Convey the native message type under the + [`opcuamessagetype`](#opcuamessagetype) rules. +- The native PublisherId and at least one of DataSetWriterId and + DataSetWriterName are REQUIRED. Supply each value in the envelope, a + `source` query parameter, or the selected `opcuawriter` entry, under + [Publisher and Writer Metadata](#publisher-and-writer-metadata). For a + WoT route without a Processing Descriptor, use the envelope or `source` + query for these values. +- Use [`opcuasequence`](#opcuasequence) for the native `SequenceNumber`. + If the Producer also supplies CloudEvents `sequence`, it MUST satisfy + the [Sequence extension](sequence.md) independently. The Producer MUST + obtain that value independently of `opcuasequence`. + +All other applicable OPC UA requirements remain in effect. ## Examples @@ -750,8 +754,7 @@ opcuasequence: 4294967295 ----------------------------------------------- ``` -The referenced Descriptor Version has the following metadata. Other Core -metadata is omitted from this excerpt. +The referenced Descriptor version contains these entries: ```json { @@ -791,9 +794,8 @@ selects one of two TDs; the `payload` entry supplies the schema. The dataset name and writer name differ. With an agreed source-Descriptor binding, a Producer can instead use the -stream's Descriptor Version URL as `source` and omit `describedby`. This changes -the source identity; it is not an identity-preserving rewrite of already -published events. +stream's Descriptor version URL as `source` and omit `describedby`. The +new `source` establishes a different event identity scope. #### Subject Descriptor with separate processing metadata @@ -821,8 +823,8 @@ ce-opcuasequence: 18 The TD entry selects `/properties/processData` at the matching TD URL. The Processing Descriptor supplies the payload schema, `UInt16:12` -PublisherId and writer identity. Without `describedby` these inputs are missing: -neither the subject nor a source lookup supplies them. +PublisherId, and writer identity. This example relies on `describedby` for +all three inputs. #### Direct TD subject with the NetworkMessage envelope @@ -876,19 +878,16 @@ opcuasequence: 0 ----------------------------------------------- ``` -The native sequence has rolled over from `4294967295` to `0`; it remains -`opcuasequence`, not a CloudEvents `sequence`. The subject selects its TD -directly without a source lookup. The DataSetMessage's `MessageType` remains in -the retained NetworkMessage envelope instead of being repeated as -`opcuamessagetype`. +The rollover from `4294967295` to `0` is carried in `opcuasequence`. The +subject selects its TD directly, and the retained DataSetMessage header supplies +the native `MessageType`. ## Descriptor Retrieval Security -The Descriptor Reference extension's retrieval, authorization and cache rules -apply to this mapping. Stable writer metadata in a Descriptor does not -authenticate the Publisher or authorize access to the referenced TD or schema. A -Consumer MUST establish trust in the Descriptor before using it as OPC UA -metadata. +Follow the [Descriptor Reference security and caching rules](descriptor.md#security-considerations). +A Consumer MUST establish trust in the Descriptor before using it as OPC UA +metadata. Publisher authentication and authorization to access the TD or +schema depend on checks independent of the writer metadata. [UA DataSetWriterName]: https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table185 [UA NetworkMessage]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/7.2.5.3 diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md index ac4865e3a..d178b32a1 100644 --- a/cloudevents/extensions/openusd.md +++ b/cloudevents/extensions/openusd.md @@ -1,36 +1,54 @@ # OpenUSD -This extension associates a CloudEvent with an [OpenUSD](https://openusd.org/) -asset or a prim within it. It uses the -[Descriptor Reference extension](descriptor.md) and adds no CloudEvents -attributes or headers. Core attributes, including `source` and `subject`, -retain their meanings. +An event reporting pump telemetry can link to the pump's +[OpenUSD](https://openusd.org/) asset so a Consumer can locate the pump in +a scene. The event's [`describedby`](descriptor.md#describedby) URL points to a +[Descriptor](descriptor.md) with a `usdasset` entry. A *prim* is an element +in the OpenUSD scene, such as the object that represents the pump. The +following Descriptor associates the event with the `/Pump7` prim: + +```json +{ + "descriptorid": "pump7-geometry", + "versionid": "1", + "entries": { + "geometry": { + "class": "usdasset", + "url": "https://assets.example/pump7.usda", + "primpath": "/Pump7" + } + } +} +``` ## Notational Conventions -The key words "MUST", "MUST NOT", "REQUIRED", "MAY", and "OPTIONAL" are -to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119). -These requirements apply only to events using this extension. +As with the main [CloudEvents specification](../spec.md), the key words "MUST", +"MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", +"RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as +described in [RFC 2119](https://tools.ietf.org/html/rfc2119). + +However, the scope of these key words is limited to when this extension is +used. For example, an attribute marked as "REQUIRED" needs to be included +when the event uses this extension and meets the stated conditions. ## Attributes ### describedby -Use the existing [`describedby`](descriptor.md#describedby) attribute to -identify the Descriptor that supplies OpenUSD context. In HTTP binary -content mode it is carried in the `ce-describedby` header. If `describedby` -is absent, this extension supplies no OpenUSD context. +[`describedby`](descriptor.md#describedby) is REQUIRED to associate an +event with an OpenUSD asset through this extension. It identifies the +Descriptor that supplies the asset entries. Core attributes retain their +CloudEvents meanings. ## Asset selection -An entry with class `usdasset` MUST link to an OpenUSD asset at `url`. -When an xRegistry server hosts the asset, the Publisher MUST use the -document-view URL, not the Registry metadata URL. The Consumer can use the -linked asset or the entry's bundled `document`. -The [OpenUSD entry schema](openusd.schema.json) checks entry shape; -Consumers still validate OpenUSD paths, targets, and field uniqueness. +An entry with class `usdasset` MUST link to the OpenUSD asset itself at +`url`. The Consumer can use the linked asset or the entry's bundled +`document`. -A publication profile MAY select several asset entries. If it needs one, +A publication profile is the agreed set of rules for using the Descriptor. +It MAY select several asset entries. If it needs one, the Consumer MUST use the exact entry name specified by the profile or the unique `usdasset` entry if the profile supplies no name. The Consumer MUST report a missing, invalid, ambiguous, or unavailable asset when needed. It @@ -40,56 +58,58 @@ MUST NOT infer a selection from `subject`, a filename, or entry order. - Type: String - Description: The [absolute OpenUSD prim path][Prim Path] within the stage - composed from the asset selected by `url`. It associates the event as a - whole with that prim and anchors any field mappings. + composed from the asset at `url`. The stage is the scene formed from + the asset and its dependencies. The path associates the whole event + with that prim and anchors any field mappings. - Constraints: - - OPTIONAL. Omission selects the asset without selecting an individual - prim. + - OPTIONAL. Omission selects the asset as a whole. - If present, MUST identify an existing prim in that stage. Null, empty, root (`/`), relative, and property paths are invalid, as are paths containing variant selections. - - The Consumer MUST treat the value as an OpenUSD path, not a URL - fragment or a CloudEvents subject selector. If it cannot resolve the - path, it MUST report the failure and MUST NOT substitute another prim. + - The Consumer MUST resolve the value as an OpenUSD path. If resolution + fails, it MUST report the failure and leave the prim unselected. ### Field mappings A `usdasset` entry can associate individual JSON payload fields with descendants of the anchor prim. If `fieldmode` or `fieldmappings` is -present, `primpath` is REQUIRED. With neither member, the Consumer MUST NOT -infer field associations. Field associations do not change the event-level -association or specify writes to USD properties. +present, `primpath` is REQUIRED. The Consumer MUST derive field associations +only from these members. The event-level association still comes from +`primpath`. Writing USD property values is outside the scope of this extension. The OPTIONAL `fieldmappings` array contains objects with two REQUIRED string members: | Member | Meaning | | --- | --- | -| `field` | A nonempty [RFC 6901 JSON Pointer][JSON Pointer] rooted at CloudEvents `data`, in string form, not a URI fragment. | +| `field` | A non-empty [RFC 6901 JSON Pointer][JSON Pointer] in string form, rooted at CloudEvents `data`. | | `prim` | A relative OpenUSD prim path to an existing descendant of the anchor. Absolute paths, parent traversal (`..`), property paths, and paths containing variant selections are invalid. | -Duplicate `field` pointers are invalid. Array order does not affect -selection. A field absent from an event, such as an omitted delta frame -field, produces no association for that event and does not clear a prior -value. The Consumer MUST report an invalid mapping or an unresolved explicit -prim target rather than infer a replacement. +Duplicate `field` pointers are invalid. Apply each mapping independently +of its position in the array. If an event omits a field, skip its mapping +for that event and leave any prior value unchanged. The Consumer MUST +report an invalid mapping or an unresolved explicit prim target and leave +that field unmapped. The OPTIONAL string `fieldmode` accepts only `"byname"`. In this mode, the Consumer matches each top-level member of a JSON object in `data` to a direct child of the anchor with the exact same name. An explicit mapping for -that field takes precedence. Without `"byname"`, only explicit mappings apply. -A field without a matching child or an explicit mapping stays unmapped; it -does not fall back to the anchor. +that field takes precedence. When `fieldmode` is omitted, only explicit +mappings apply. Fields with neither kind of match stay unmapped. + +Mapping an OpenUSD prim to a WoT affordance is outside the scope of this +extension. Resolve asset dependencies under OpenUSD rules even when a +[Descriptor bundle](descriptor.md#bundled-document) supplies the asset. -This extension does not define a mapping between an OpenUSD prim and a WoT -affordance. Asset dependencies follow OpenUSD resolution rules and are not -automatically included in a Descriptor bundle. +The [OpenUSD entry schema](openusd.schema.json) checks entry shape. +Consumers using the entry verify path syntax, targets, and pointer +uniqueness under the rules above. ## Examples The following event reports Pump 7 telemetry in HTTP binary mode. Its `ce-describedby` header identifies the Descriptor that selects the asset and -its pump prim. The `ce-subject` value is not used for that selection. +its pump prim. ```http POST /events HTTP/1.1 @@ -106,8 +126,9 @@ ce-describedby: https://registry.example/descriptorgroups/streams/descriptors/pu {"pressure":4.5,"speed":1200,"status":"ok"} ``` -The Descriptor's `geometry` entry selects `/Pump7` in the linked asset -version. The stage contains `/Pump7/Sensors/PressureGauge`, `/Pump7/pressure`, +The Descriptor's `geometry` entry uses an xRegistry document-view URL for +the asset version and selects `/Pump7` in that asset. The stage contains +`/Pump7/Sensors/PressureGauge`, `/Pump7/pressure`, and `/Pump7/speed`, but no `/Pump7/status`: ```json @@ -128,16 +149,16 @@ and `/Pump7/speed`, but no `/Pump7/status`: } ``` -The explicit mapping associates `pressure` with `/Pump7/Sensors/PressureGauge` -instead of `/Pump7/pressure`. By-name matching associates `speed` with +The explicit mapping takes precedence and associates `pressure` with +`/Pump7/Sensors/PressureGauge`. By-name matching associates `speed` with `/Pump7/speed`. The `status` field stays unmapped. Without either field-mapping member, the event would still describe `/Pump7` as a whole. ## Security Considerations Follow the [Descriptor retrieval policy](descriptor.md#security-considerations) -for the asset and apply authorization and resource limits to its dependencies. -Access to a Descriptor does not grant access to either. +for the asset. Authorize access to each dependency separately and apply +resource limits during resolution. [Prim Path]: https://openusd.org/release/api/class_sdf_path.html [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index b4230d402..e60ac3762 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -1,24 +1,51 @@ # Web of Things -This profile maps [Web of Things][TD] (WoT) Thing Descriptions (TDs) to -CloudEvents Core attributes and the OPTIONAL -[Descriptor Reference extension](descriptor.md). The **Processing Descriptor** -is the Descriptor selected to supply processing inputs. Either it or the -event's `subject` selects the Thing or affordance. The `type` names the event -contract. - -Producers and Consumers agree on this mapping through a publication profile -or configuration. A direct TD subject can stand alone; see [Description -Selection](#description-selection) for use with `describedby`. This mapping -adds no attributes, transport binding or provisioning rules, and requires -no particular Registry implementation. +A Consumer can use a pump's [Web of Things][TD] (WoT) Thing Description +(TD) to identify the property that a telemetry event reports. The event's +`subject` can point directly to the TD and select one interaction, called +an *affordance* in WoT: -A **TD entry** has class `thingdescription`; a **TM entry** has class -`thingmodel`. Both MUST link to an ordinary resolved document at `url`, -not Registry metadata or a projection plan. A Registry publisher uses the -document-view URL. Entry names are local to the Descriptor. -The [WoT entry schema](wot.schema.json) checks entry shape; Consumers -still verify the linked documents and selector targets. +```json +{ + "specversion": "1.0", + "id": "sample-1", + "source": "urn:example:pump7", + "type": "com.example.pump.pressure.v1", + "subject": "https://devices.example/pump7/td.json#/properties/pressure", + "data": 4.5 +} +``` + +The Consumer retrieves the TD and evaluates `/properties/pressure` in that +document. In this example, the Producer and Consumer agree that the event +`type` identifies a numeric pressure reading. + +For streams that share processing inputs such as a payload schema or an +event binding, [`describedby`](descriptor.md#describedby) can point to a +[Descriptor](descriptor.md) that supplies them. The **Processing +Descriptor** is the Descriptor selected for that purpose. A publication +profile is the set of rules, agreed by specification or configuration, +that tells Producers and Consumers how to interpret the event. + +The publication profile chooses how to identify the Thing or affordance. +In *subject-driven selection*, `subject` supplies the selection. In +*Descriptor-driven selection*, `describedby` selects the Processing +Descriptor and a TD entry supplies the selection. For example, a +Descriptor for the same pump property can contain: + +```json +{ + "descriptorid": "pump7-pressure", + "versionid": "1", + "entries": { + "pump7": { + "class": "thingdescription", + "url": "https://devices.example/pump7/td.json", + "affordanceselector": "/properties/pressure" + } + } +} +``` ## Notational Conventions @@ -27,8 +54,9 @@ As with the main [CloudEvents specification](../spec.md), the key words "MUST", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119). -The scope of these key words is limited to events using this profile. An -attribute marked REQUIRED here is not REQUIRED in every CloudEvent. +However, the scope of these key words is limited to when this profile is +used. For example, an attribute marked as "REQUIRED" needs to be included +when the event uses this profile and meets the stated conditions. ## Mapping Core Context Attributes @@ -42,19 +70,16 @@ For example, `https://factory.example.com/line1/pump7` and `mqtt://site/line/cell/device/sensor` are valid sources. An agreed binding MAY use an absolute, fragment-free Descriptor URL as -`source` if it identifies the originating context. Consumers MUST NOT infer -that binding from URL syntax. [Description Selection](#description-selection) -defines when to retrieve the source; neither direct TD nor Subject -Descriptor URLs trigger that lookup. +`source` if it identifies the originating context. +[Description Selection](#description-selection) defines when to retrieve +the source. #### Event identity -Core requires `source` and `id` together to identify each distinct event. -Changing the `source` changes the event identity and -[Sequence extension](sequence.md) scope. -When returning to an earlier `source`, Producers MUST preserve the uniqueness -of `source` plus `id`. When using the Sequence extension, their `sequence` -values MUST remain ordered relative to earlier events from that same source. +Changing `source` to a Descriptor URL changes the +[event identity scope](../spec.md#id) and the scope of the +[Sequence extension](sequence.md). Changing `describedby` or `subject` leaves +both scopes unchanged. ### type @@ -69,11 +94,12 @@ only ASCII letters, digits and underscores. These restrictions apply only to `type`; generators still handle language keywords. The last segment MUST be the contract revision `vN`, with positive decimal `N` and no leading zeros. -A Producer MAY configure the complete type. Otherwise, it derives the type -from a governing [Thing Model][TM] (TM) and, for an affordance event, the -corresponding model-affordance path. When composition or derivation does not -identify that mapping unambiguously, the publication configuration MUST -select it explicitly. A Producer MUST NOT infer the mapping solely from +A [Thing Model][TM] (TM) defines a reusable model for Things. A Producer +MAY configure the complete type. Otherwise, it derives the type from a +governing TM and, for an affordance event, the corresponding +model-affordance path. When composition or derivation leaves the mapping +ambiguous, the publication configuration MUST select it explicitly. +A Producer MUST NOT infer the mapping solely from matching names or select the first TM link. A TM entry in the Processing Descriptor MAY carry `type` to expose an @@ -82,9 +108,8 @@ event binding. To use it, match the entry's `type` to the decoded event entry can match; otherwise, exactly one match is REQUIRED. An OPTIONAL `affordanceselector` identifies a declaration in that TM using the [pointer rules](#subject-descriptor-selection); omission selects no individual -declaration. Consumers MUST report missing, ambiguous or invalid bindings -and unavailable TMs when using the binding. Listing a TM does not itself -require retrieval. +declaration. Consumers using the binding MUST report missing, ambiguous, or invalid +bindings and unavailable TMs. Retrieve a TM when the operation needs it. For an eligible HTTPS TM identifier, derive the type as follows: @@ -136,15 +161,17 @@ silently rewriting identifiers or member names. The publication profile MUST choose Descriptor-driven or subject-driven selection before the Consumer interprets [`subject`](../spec.md#subject). -In Descriptor-driven selection, `subject` is OPTIONAL. It retains its -Core meaning, but Consumers MUST NOT use it for retrieval or correlation. -In subject-driven selection, `subject` is REQUIRED and MUST use a form below. -Consumers MUST NOT infer the mode or form from a response body or URL path. +In Descriptor-driven selection, `describedby` is REQUIRED and `subject` +is OPTIONAL with its Core meaning. The Consumer MUST use the selected TD +entry as the sole input for Thing or affordance retrieval and correlation. +In subject-driven selection, `subject` is REQUIRED and MUST use a form in +the following table. The Consumer MUST determine the mode from the +publication profile and the form from the decoded `subject`. | Subject form | Meaning | | --- | --- | -| `#` or `#/properties/processData` | Select the unique TD Reference in the Processing Descriptor, then the whole Thing or affordance. | -| `pump7#/properties/processData` | Select the Processing Descriptor's named TD Reference `pump7`, then its affordance. | +| `#` or `#/properties/processData` | Select the unique TD entry in the Processing Descriptor, then the whole Thing or affordance. | +| `pump7#/properties/processData` | Select the Processing Descriptor's named TD entry `pump7`, then its affordance. | | `https://example.com/td/pump7/versions/3#/properties/processData` | Identify the Thing's affordance through a TD document URL; description selection follows the rules below. | | `https://example.com/descriptorgroups/subjects/descriptors/pump7-process/versions/1` | Identify a Subject Descriptor Version. Its selected TD entry identifies the Thing and optionally one affordance. | @@ -156,7 +183,7 @@ as follows: 2. Otherwise, split at the first literal `#`. If the prefix begins with `http://` or `https://`, case-insensitively, it MUST be a valid absolute HTTP(S) URL and selects the direct-TD form. -3. Any other prefix MUST be empty or a valid Descriptor Reference name. +3. Any other prefix MUST be empty or a valid Descriptor entry name. It selects the Descriptor-relative form. The absence of a fragment and an empty fragment are different forms. @@ -165,9 +192,9 @@ The absence of a fragment and an empty fragment are different forms. meet that form's requirements. A percent-encoded `%23` is part of the URL, not the delimiter. Consumers MUST classify before percent-decoding a fragment. -Entry names follow the [Descriptor rules](descriptor.md#descriptor-document) -and cannot contain `/`; `http:pump7#` can name an entry but is not an HTTP URL. A -name without a literal `#` is invalid. Invalid input or an unexpected +Entry names follow the [Descriptor rules](descriptor.md#entries). For +example, `http:pump7#` has the Descriptor-relative form and names the entry +`http:pump7`. Invalid input or an unexpected representation MUST NOT be retried through another form or resolved against `source`. @@ -186,21 +213,20 @@ as specified by RFC 6901. It MUST report a correlation failure if the encoding or pointer is invalid or the pointer does not select the intended Thing or affordance. -The subject identifies what the event concerns, not an occurrence. Do not -append a writer or native occurrence identifier to a subject pointer. +The subject identifies what the event concerns. Use the TD pointer as +defined above, without appending a writer or occurrence identifier. The concrete TD path and corresponding TM declaration path can differ. This profile does not infer a declaration-lineage mapping between them. -A changed URL in `subject` affects filtering and correlation, not event -identity. A Descriptor-relative or descriptive subject can stay stable when -`describedby` changes Version. +A Descriptor-relative subject can stay stable when `describedby` selects +a new version. ### dataschema and datacontenttype Core [`dataschema`](../spec.md#dataschema) and [`datacontenttype`](../spec.md#datacontenttype) describe the schema and media -type of `data`, not the TD format. +type of `data`. The publication profile or protocol binding determines whether an external payload schema is REQUIRED. The Consumer MUST use `dataschema` when @@ -211,8 +237,8 @@ entry][Schema Descriptor Profile]. Without a Processing Descriptor, The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, invalid selector, unavailable schema or unsupported format MUST NOT cause fallback to another schema. If `dataschema` is present, the Consumer MUST -still validate applicable Descriptor selectors, but does not select a -Descriptor schema or compare schema documents. Producers and Descriptor +still validate applicable Descriptor selectors and use `dataschema` as the +sole schema input. Producers and Descriptor publishers SHOULD supply one schema source or identify the same schema in both. Producers SHOULD omit `dataschema` when the Processing Descriptor supplies the schema. @@ -224,34 +250,34 @@ Aggregated properties, event data and protocol envelopes can need different schemas. A schema supplied through `dataschema` or a Descriptor MUST describe the actual payload, including its encoding and envelope. -An xRegistry Schema Resource's document-view URL can identify that external -schema. It is not the WoT Resource's metadata-view URL. A profile MAY require -an exact schema Version independently of the selected TD Version. +A profile MAY require an exact schema version independently of the selected +TD version. ## Description Selection -Apply event-format decoding before checking presence; JSON `null` means -unset. Retrieve the Descriptor at an explicit -[`describedby`](descriptor.md#describedby) URL. It is authoritative for -processing inputs. Follow the [Descriptor Reference failure -rules](descriptor.md#failure-outcomes) without falling back to another -description. +Apply [CloudEvents event-format decoding](../formats/json-format.md#22-type-system-mapping) +before checking attribute presence. An explicit `describedby` selects the +Processing Descriptor under the [Descriptor Reference +rules](descriptor.md#describedby). A **Subject Descriptor** serves a separate +role: in subject-driven selection, a fragment-free `subject` URL can select +a Descriptor for the Thing or affordance. Only the Processing Descriptor +can supply Descriptor-based event binding, schema, or writer metadata. -In Descriptor-driven selection, `describedby` is REQUIRED. Use the Processing -Descriptor's [selected TD entry](#subject-descriptor-selection). Missing or -invalid input fails correlation without looking up `subject` or `source`. +In Descriptor-driven selection, use the Processing Descriptor's [selected +TD entry](#subject-descriptor-selection). Missing or invalid input fails +correlation in that mode. In subject-driven selection, use the decoded `subject` form: 1. For a fragment-free HTTP(S) URL, retrieve its Subject Descriptor Version and apply [Subject Descriptor selection](#subject-descriptor-selection). `describedby`, when present, - remains the Processing Descriptor. When absent, this route selects no - Processing Descriptor and MUST NOT trigger source retrieval. + remains the Processing Descriptor. The Consumer MUST limit lookup in + this form to the Descriptors selected by those attributes. 2. For a direct-TD subject without `describedby`, retrieve its TD - document. Use the prefix unchanged, including its query; the fragment is - evaluated locally and is not sent in HTTP. Do not retrieve a source - Descriptor or construct a synthetic Descriptor from the TD. + document at the exact prefix URL, including its query. Evaluate the + fragment locally. The Consumer MUST use the retrieved TD directly as + the sole description for correlation on this route. 3. Otherwise, use the Processing Descriptor selected through `describedby`, or the agreed source-Descriptor binding if `describedby` is absent. In the latter case, retrieve the exact `source` URL, which MUST be an absolute URL @@ -262,88 +288,91 @@ For a Descriptor-relative or direct-TD subject using a Processing Descriptor, select only entries of class `thingdescription`: - For an empty subject prefix, the Processing Descriptor MUST have exactly - one TD Reference. -- For a Reference-name prefix, the named entry MUST have that class. -- For a direct URL prefix, exactly one TD Reference MUST + one TD entry. +- For an entry-name prefix, the named entry MUST have that class. +- For a direct URL prefix, exactly one TD entry MUST have a `url` equal to that prefix. Consumers MUST compare the strings exactly, without URI normalization. Missing or duplicate matches are correlation failures. A named subject can disambiguate duplicate URLs. -Use the selected TD directly or from its bundled `document`. Redirect -destinations, TD `id`, and `entityid` MUST NOT repair a subject URL mismatch. -A TD or TM entry MAY include `planurl`, an absolute, fragment-free HTTP(S) -URL for the projection plan that produced the view at `url`. Its format is -profile-defined. Consumers using the plan MUST verify that it produced the -linked view. Unavailable OPTIONAL provenance does not invalidate a resolved -view. +Use the selected TD directly or from its bundled `document`. A URL mismatch +is a correlation failure even when a redirect destination, TD `id`, or +`entityid` matches. The Producer MUST supply all REQUIRED inputs through the selected route, -event and profile. A direct TD or Subject Descriptor supplies neither an -external payload schema nor native publisher metadata. Producers can use -`describedby` for shared processing inputs; Consumers MUST NOT merge source -or subject fields. +event and profile. When the Producer uses `describedby`, the Consumer MUST +take Descriptor-based processing inputs exclusively from that Descriptor. If selection, retrieval or correlation fails, the Consumer MUST report the -failure and leave the event uncorrelated. It MAY retain or forward the event -without TD-based interpretation, but MUST NOT switch routes or substitute -another TD. This does not authenticate the originating entity or authorize an -action described by the TD. +failure and leave the event uncorrelated. It MAY retain or forward the +uncorrelated event, but MUST NOT switch routes or substitute another TD. +See the [Descriptor Reference failure rules](descriptor.md#failure-outcomes) +for an explicit `describedby`. The Publisher MUST make the selected TD available before configuring Producers to use its URL or a Descriptor that references it. The Publisher SHOULD use a TD Version URL. -Changing only `describedby` does not change identity or sequence scope. A -Producer MUST NOT reuse an `id` or restart a source-wide sequence merely because -a description changes. An exact Version or successful resolution does not itself -prove that retrieved bytes are unchanged. - ### Subject Descriptor selection When `subject` selects a Descriptor, its URL MUST identify a fixed **Version** under an agreed binding. The Consumer MUST verify that the response is the -addressed Version under that binding. A `/versions/` substring or `versionid` -alone is insufficient. Report a correlation failure if verification fails. -Use the URL unchanged. Redirects do not authorize a different Version. +addressed Version under that binding, including after any redirect. A +`/versions/` substring or `versionid` alone is insufficient. Report a +correlation failure if verification fails. Use the URL unchanged. -When a Descriptor supplies the subject, select the TD entry named by the -publication profile, or the unique TD entry if it names none. Report -missing or ambiguous entries. Retrieve that TD and apply the entry's +When a Descriptor supplies the Thing or affordance selection, select the TD +entry named by the publication profile, or the unique TD entry if it names +none. Report missing or ambiguous entries. Retrieve that TD and apply the entry's `affordanceselector`. A subject carrying its own fragment uses that fragment instead. -Omit `affordanceselector` to select the whole Thing. A present selector +Put `affordanceselector` in the selected TD entry, or omit it there to +select the whole Thing. A present selector MUST be a plain RFC 6901 string selecting one existing affordance: `/properties/`, `/actions/` or `/events/`. Consumers MUST -NOT URI-fragment-decode or percent-decode it. Null, empty, object, root and -deeper selectors are invalid, not omission. Top-level selectors are not -aliases. Annotations belong beside the selector; their profile defines +apply only RFC 6901 string-form decoding. A present member with a null, +empty, object, root, or deeper selector is invalid. Annotations belong +beside the selector; their profile defines their scope, type and omission rules. Consumers MUST report invalid subject metadata, unavailable TDs and -unresolved selectors as correlation failures. Listing other References does -not require their retrieval. Consumers MUST NOT follow recursive Subject -Descriptor chains. +unresolved selectors as correlation failures. Consumers MUST limit Subject +Descriptor selection to the directly selected Descriptor and TD. When `subject` selects a Descriptor and `describedby` is present, its TD URL -MUST match the `url` of exactly one TD Reference in the Processing Descriptor. This +MUST match the `url` of exactly one TD entry in the Processing Descriptor. This comparison is byte-for-byte, without URI normalization, redirect substitution or inference from TD or entity IDs. A missing or duplicate match is a correlation -failure. The Consumer uses the matching TD representation with the Subject -Descriptor's whole-Thing selection or affordance selector and annotations. -It does not merge Descriptor fields or substitute a selector from the -Processing Descriptor to repair missing or invalid subject metadata. +failure. The Consumer MUST use the matching TD representation with the +selection and annotations from the Subject Descriptor alone. Missing or +invalid subject metadata is a correlation failure. + +If `subject` and `describedby` name the same Version, follow the +[Descriptor caching rules](descriptor.md#caching) for response reuse. +Consumers MUST validate both roles independently. + +## WoT Descriptor entries + +A **TD entry** has class `thingdescription`; a **TM entry** has class +`thingmodel`. Both MUST link to the resolved document itself at `url`. +For example, with xRegistry, use the document-view URL. The base +[Descriptor rules](descriptor.md#entries) define the entry names. + +A TD or TM entry MAY include `planurl`, an absolute, fragment-free HTTP(S) +URL for the projection plan that produced the view at `url`. The publication +profile defines its format. Consumers using the plan MUST verify that it +produced the linked view. The resolved view remains valid when this +OPTIONAL provenance is unavailable. -A subject-only lookup MUST NOT supply event binding, schema or writer -metadata, or trigger source retrieval. If `subject` and `describedby` name -the same Version, Consumers MAY reuse the response within its representation -and authorization context, but MUST validate both roles independently. +The [WoT entry schema](wot.schema.json) checks entry shape. The linked +document and selector target are checked under the relevant selection rules. ## Relationship to Other Extensions -This profile does not redefine native message types, sequence counters, or -writer identities. An event that also uses the [OPC UA extension](opcua.md) -MUST follow that extension's conditional WoT mapping. +An event that also uses the [OPC UA extension](opcua.md) MUST follow +its [combined WoT mapping](opcua.md#wot-mapping) for native message types, +sequence counters, and writer identities. ## Examples @@ -369,8 +398,7 @@ Another TD in the same Descriptor describes a gateway. } ``` -The Descriptor has the following metadata. Core bookkeeping and any -profile-specific shared metadata are omitted from this excerpt. +The Descriptor has the following entries: ```json { @@ -397,17 +425,15 @@ profile-specific shared metadata are omitted from this excerpt. } ``` -The subject prefix selects `pump7`, not the first TD in the map. The suffix -selects its property. The payload directly contains the property's object value -without a `processData` wrapper. The selected schema describes that object, not -the TD document. The USD asset does not have to be retrieved for -this correlation. +The subject prefix selects `pump7` by name, and the suffix selects its +`processData` property. The `payload` entry supplies the schema for the +object in `data`. This correlation uses the selected TD; the `geometry` +entry is available to an OpenUSD Consumer. ### Direct TD Subject This event needs only the TD and an external payload schema, so it omits -`describedby`. The source identifies an actor's originating context rather than -the pump; it is not retrieved. +`describedby`. The source identifies the service that emitted the event. ```json { @@ -425,8 +451,8 @@ the pump; it is not retrieved. } ``` -The Consumer retrieves the subject's fragment-free TD URL and evaluates -`#/properties/processData`. The URI fragment is not sent in HTTP. +The Consumer retrieves the TD at the URL before `#` and evaluates +`/properties/processData` locally. ### Direct Subject with a Descriptor @@ -448,10 +474,10 @@ The preceding event can instead select the same telemetry Descriptor: } ``` -The direct subject matches exactly the `pump7` Reference. The Descriptor now +The direct subject matches exactly the `pump7` entry. The Descriptor now supplies the schema. Changing just the subject's TD Version to `4.0.0` would fail correlation because this Descriptor names Version `3.0.0`. Adding another TD -Reference with that same Version `3.0.0` URL would also make the direct match +entry with that same Version `3.0.0` URL would also make the direct match ambiguous; a named subject would then be REQUIRED. ### Source-selected Descriptor @@ -474,10 +500,8 @@ event can use the following complete envelope without `describedby`: } ``` -This intentionally identifies the stream Descriptor as the originating context. -Its source-plus-id namespace differs from the device-source example. A new -Version in `source` changes that namespace; a new Version in `describedby` alone -does not. +Here `source` identifies the stream Descriptor as the originating context. +Changing this source URL changes the event identity scope. ### Subject Descriptor with Separate Processing Inputs @@ -503,9 +527,8 @@ examples, the configured xRegistry HTTP base is `https://registry.example`, with } ``` -The Subject Descriptor below omits Core bookkeeping. This deployment -defines `acme_purpose` as an OPTIONAL non-empty String about the selected -affordance, not processing policy. Null is invalid. +This deployment defines `acme_purpose` as an OPTIONAL non-empty string +that describes the selected affordance. Null is invalid. ```json { @@ -532,8 +555,8 @@ affordance, not processing policy. Null is invalid. } ``` -The TD's `processData` property supplies the subject. Correlation does not -invoke its form; TD security declarations do not authorize either lookup. +The TD's `processData` property supplies the subject. Access and operation +authorization follow the [security considerations](#security-considerations). A second matching TD URL in the Processing Descriptor fails correlation. The Descriptor-driven variant selects `pump7-process` through `describedby` @@ -556,14 +579,13 @@ match the TD pointer. } ``` -In contrast, an event using this URL only as `subject` needs `dataschema` -if an external schema is REQUIRED. A subject-only lookup MUST NOT supply it. +An event using this URL only as `subject` supplies an external payload +schema through `dataschema` when needed. #### Whole Thing through a Subject Descriptor The following Subject Descriptor selects the whole Thing by omitting -`affordanceselector`. The Core `description` describes the whole Thing. -The Descriptor does not use an empty or null pointer. +`affordanceselector`. Its `description` member describes the whole Thing. ```json { @@ -582,9 +604,8 @@ The Descriptor does not use an empty or null pointer. Under the configured example Registry, its subject URL is `https://registry.example/descriptorgroups/subjects/descriptors/pump7-whole/versions/1`. An aggregate-state event can select this URL with the aggregate type and -Processing Descriptor used in the Whole Thing example below. The existing -direct-TD whole-Thing subject remains the TD URL followed by `#`; it does -not use the stored affordance selector. +Processing Descriptor used in the Whole Thing example. The direct-TD +form selects the whole Thing with a TD URL followed by `#`. ### Whole Thing @@ -631,10 +652,9 @@ The referenced Descriptor Version contains the following metadata. } ``` -The empty subject prefix selects the unique TD Reference. The TD document itself -is not the payload. The `payload` entry supplies the aggregate object schema, -not the TD or either property's DataSchema alone. A direct whole-Thing subject -would end in `#` after its TD document URL. +The empty subject prefix selects the unique TD entry. The `payload` entry +supplies the schema for the complete object in `data`, which contains both +property values. ## Security Considerations @@ -644,10 +664,10 @@ MUST NOT authorize arbitrary network access, redirects or credential forwarding. Implementations SHOULD bound document sizes and dependency resolution. -The Producer controls the context attributes unless another mechanism -authenticates them. A version does not establish that a TD, its model lineage, -or a schema is authorized for the Consumer's use. It does not grant access to -referenced documents or make their dependencies available. +Treat context attributes as Producer-supplied values unless another +mechanism authenticates them. Establish trust and access independently +for each referenced document, its model lineage, and its dependencies. +Correlating an event with an affordance does not authorize invoking it. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model From 6ac67d40c38e63621d32f29c9f1a0d69c2d583da Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 20 Nov 2026 17:50:01 +0100 Subject: [PATCH 45/60] Require Descriptor lookup for WoT events Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 108 ++--- cloudevents/extensions/wot.md | 726 +++++++------------------------- 2 files changed, 192 insertions(+), 642 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index a808af762..74d66f6ef 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -125,7 +125,7 @@ For metadata, data, and event messages, a Producer MAY map `subject` to `DataSetWriterId` or `DataSetWriterName` from the [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164). A Producer using the WoT profile MUST instead follow its -[subject selection rules](wot.md#subject). +[rules for `subject`](wot.md#subject). For a native OPC UA event message (`MessageType` equals `ua-event`), a Producer using the OPC UA-specific `subject` mapping MUST append "/" and the @@ -470,16 +470,11 @@ Consumers MUST obtain these attributes and any tracing, recording time, and CloudEvents `sequence` values from the event itself. Core attributes retain their CloudEvents placement and meaning. -When the agreed route selects no Processing Descriptor, the Producer MUST supply -all REQUIRED OPC UA values through the other applicable locations. +An OPC UA-only event can omit `describedby`. In that case the Producer +MUST supply all REQUIRED OPC UA values through the other applicable locations. Producers SHOULD use Descriptor metadata only when the intended Consumers support the agreed mapping. -When `source` is itself a Descriptor URL, Producers SHOULD supply shared -identity metadata in the selected versioned Descriptor. A query forms -part of the source identity and can change the retrieved resource. -Consumers MUST retrieve the exact `source` URL when that route applies. - JSON integers in this profile preserve the full native ranges. An alternate serialization or generated schema MUST preserve those same values, or report an encoding error. For example, use an Avro type wide enough to preserve @@ -491,21 +486,20 @@ PublisherId encoding, ranges, and the event context under the rules above. ## WoT mapping When a CloudEvent uses both this extension and the [WoT profile](wot.md), -apply [WoT description selection](wot.md#description-selection). For data -and event messages, the following mappings take precedence over the -corresponding OPC UA-only mappings: +[`describedby` is REQUIRED](wot.md#description-selection). The same +Descriptor supplies the WoT selection and any Descriptor-based OPC UA +metadata. For data and event messages, the following mappings take +precedence over the corresponding OPC UA-only mappings: - The Producer MUST use the WoT [`type`](wot.md#type) and - [`subject`](wot.md#subject) mappings. Use the WoT subject as specified - there and keep the native `EventId` in the OPC UA event payload. + [`subject`](wot.md#subject) mappings. Keep the native `EventId` in the + OPC UA event payload. Convey the native message type under the [`opcuamessagetype`](#opcuamessagetype) rules. - The native PublisherId and at least one of DataSetWriterId and DataSetWriterName are REQUIRED. Supply each value in the envelope, a `source` query parameter, or the selected `opcuawriter` entry, under - [Publisher and Writer Metadata](#publisher-and-writer-metadata). For a - WoT route without a Processing Descriptor, use the envelope or `source` - query for these values. + [Publisher and Writer Metadata](#publisher-and-writer-metadata). - Use [`opcuasequence`](#opcuasequence) for the native `SequenceNumber`. If the Producer also supplies CloudEvents `sequence`, it MUST satisfy the [Sequence extension](sequence.md) independently. The Producer MUST @@ -718,13 +712,10 @@ recordedtime: 2024-03-28T23:59:59Z ### WoT and OPC UA telemetry message -This binary-mode keyframe uses the WoT event type and named affordance subject. -Its Descriptor supplies the resolved TD, payload schema, PublisherId, -DataSetWriter identity and dataset name. The native OPC UA message type and -sequence remain in the event because they can vary within this stream. The -example uses writer ID `17` within publisher `UInt16:12`. The CloudEvents -`sequence` attribute is absent because this example does not define a -source-wide ordering across DataSetWriters. +This binary-mode keyframe uses the WoT event type. Its Descriptor selects +the pump's `processData` property and supplies the payload schema, publisher, +and writer metadata. The native OPC UA message type and sequence remain in +the event. This example uses writer ID `17` within publisher `UInt16:12`. ```text ------------------ PUBLISH ------------------- @@ -736,9 +727,9 @@ Content Type: application/json specversion: 1.0 id: ua-message-25460 -source: https://registry.example/descriptorgroups/devices/descriptors/pump7 +source: urn:example:actor:telemetry-service type: com.example.models.tm.pump.properties.processData.v1 -subject: pump7#/properties/processData +subject: pump7 time: 2026-10-29T12:00:00Z describedby: https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1 opcuamessagetype: ua-keyframe @@ -763,20 +754,13 @@ The referenced Descriptor version contains these entries: "entries": { "pump7": { "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - }, - "gateway1": { - "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1.0.0" + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0", + "affordanceselector": "/properties/processData" }, "payload": { "class": "schema", "url": "https://schemas.example/pump-process-data/versions/3" }, - "geometry": { - "class": "usdasset", - "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" - }, "writer": { "class": "opcuawriter", "opcuapublisherid": "UInt16:12", @@ -788,55 +772,22 @@ The referenced Descriptor version contains these entries: } ``` -The Consumer uses the selected Descriptor's PublisherId and writer identity with -the event's `opcuamessagetype` and `opcuasequence`. The subject's `pump7` prefix -selects one of two TDs; the `payload` entry supplies the schema. -The dataset name and writer name differ. - -With an agreed source-Descriptor binding, a Producer can instead use the -stream's Descriptor version URL as `source` and omit `describedby`. The -new `source` establishes a different event identity scope. - -#### Subject Descriptor with separate processing metadata - -The following binary-mode event uses the [Subject Descriptor -example](wot.md#subject-descriptor-with-separate-processing-inputs) for its -Thing reference and affordance selector. Its `describedby` selects the -complete `pump7-telemetry` Processing Descriptor shown above. - -```http -POST /events HTTP/1.1 -Host: consumer.example -Content-Type: application/json -Content-Length: 29 -ce-specversion: 1.0 -ce-id: ua-message-25462 -ce-source: urn:example:actor:telemetry-service -ce-type: com.example.models.tm.pump.properties.processData.v1 -ce-subject: https://registry.example/descriptorgroups/subjects/descriptors/pump7-process/versions/1 -ce-describedby: https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1 -ce-opcuamessagetype: ua-keyframe -ce-opcuasequence: 18 - -{"Speed":1500,"Pressure":4.5} -``` - -The TD entry selects `/properties/processData` at the matching TD URL. -The Processing Descriptor supplies the payload schema, `UInt16:12` -PublisherId, and writer identity. This example relies on `describedby` for -all three inputs. +The Consumer selects `/properties/processData` from the TD entry and +reads the schema and native identity from the `payload` and `writer` +entries. The event's `subject` is available for filtering. -#### Direct TD subject with the NetworkMessage envelope +#### WoT telemetry with a retained NetworkMessage envelope This event retains the full Part 14 NetworkMessage envelope. Its PublisherId and DataSetWriterId satisfy the identity requirements, so `source` needs no publisher or writer query parameters. Part 14 JSON encodes the configured PublisherId `UInt16:12` as the string `"12"`. -The direct subject supplies the TD URL and affordance pointer; `dataschema` -supplies the envelope's schema. No Descriptor is REQUIRED, so `describedby` is -omitted. The event type uses revision `v2` because retaining the envelope -changes the payload contract. +`describedby` selects the [WoT example Descriptor](wot.md#web-of-things) +for the Thing and affordance. `dataschema` takes precedence over that +Descriptor's schema entry and identifies the envelope's schema. The event +type uses revision `v2` because retaining the envelope changes the payload +contract. ```text ------------------ PUBLISH ------------------- @@ -850,7 +801,7 @@ specversion: 1.0 id: ua-message-25461 source: mqtt://site/line/cell/device/sensor?site=north type: com.example.models.tm.pump.properties.processData.v2 -subject: https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0#/properties/processData +describedby: https://devices.example/pump7/descriptors/process-data.json time: 2026-10-29T12:00:01Z dataschema: https://schemas.example/pump-process-data-envelope/versions/1 opcuasequence: 0 @@ -879,8 +830,7 @@ opcuasequence: 0 ``` The rollover from `4294967295` to `0` is carried in `opcuasequence`. The -subject selects its TD directly, and the retained DataSetMessage header supplies -the native `MessageType`. +retained DataSetMessage header supplies the native `MessageType`. ## Descriptor Retrieval Security diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index e60ac3762..62afd6606 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -2,51 +2,56 @@ A Consumer can use a pump's [Web of Things][TD] (WoT) Thing Description (TD) to identify the property that a telemetry event reports. The event's -`subject` can point directly to the TD and select one interaction, called -an *affordance* in WoT: +[`describedby`](descriptor.md#describedby) URL points to a +[Descriptor](descriptor.md) that links to the TD and can identify an +interaction in it, called an *affordance*. + +For example, this event reports a reading from the `processData` property +of Pump 7: ```json { "specversion": "1.0", - "id": "sample-1", - "source": "urn:example:pump7", - "type": "com.example.pump.pressure.v1", - "subject": "https://devices.example/pump7/td.json#/properties/pressure", - "data": 4.5 + "id": "sample-4711", + "source": "urn:example:actor:telemetry-service", + "type": "com.example.models.tm.pump.properties.processData.v1", + "subject": "pump7", + "describedby": "https://devices.example/pump7/descriptors/process-data.json", + "datacontenttype": "application/json", + "data": { + "Speed": 1500, + "Pressure": 4.5 + } } ``` -The Consumer retrieves the TD and evaluates `/properties/pressure` in that -document. In this example, the Producer and Consumer agree that the event -`type` identifies a numeric pressure reading. - -For streams that share processing inputs such as a payload schema or an -event binding, [`describedby`](descriptor.md#describedby) can point to a -[Descriptor](descriptor.md) that supplies them. The **Processing -Descriptor** is the Descriptor selected for that purpose. A publication -profile is the set of rules, agreed by specification or configuration, -that tells Producers and Consumers how to interpret the event. - -The publication profile chooses how to identify the Thing or affordance. -In *subject-driven selection*, `subject` supplies the selection. In -*Descriptor-driven selection*, `describedby` selects the Processing -Descriptor and a TD entry supplies the selection. For example, a -Descriptor for the same pump property can contain: +An HTTP `GET` of `describedby` returns the following Descriptor. The +Consumer resolves the TD at `url` and evaluates `affordanceselector` in it. +The `payload` entry supplies the schema for the object in `data`. ```json { - "descriptorid": "pump7-pressure", + "descriptorid": "pump7-process-data", "versionid": "1", "entries": { "pump7": { "class": "thingdescription", "url": "https://devices.example/pump7/td.json", - "affordanceselector": "/properties/pressure" + "affordanceselector": "/properties/processData" + }, + "payload": { + "class": "schema", + "url": "https://schemas.example/pump-process-data/versions/3" } } } ``` +A *publication profile* is the set of rules, agreed by specification or +configuration, that tells Producers and Consumers how to interpret the +event. It can name an entry when a Descriptor contains several entries +of the same class. The example uses the only TD entry. + ## Notational Conventions As with the main [CloudEvents specification](../spec.md), the key words "MUST", @@ -58,58 +63,105 @@ However, the scope of these key words is limited to when this profile is used. For example, an attribute marked as "REQUIRED" needs to be included when the event uses this profile and meets the stated conditions. -## Mapping Core Context Attributes +## Description Selection -### source +[`describedby`](descriptor.md#describedby) is REQUIRED for this profile. +The Consumer MUST use the Descriptor at that URL as the sole source of +Descriptor entries for the event. The publication profile selects the TD +entry by name or, if it supplies no name, by the unique `thingdescription` +entry. A named entry MUST exist and have class `thingdescription`. With +no name, exactly one entry of that class is REQUIRED. + +Use the selected TD at its `url` or from its bundled `document`. Apply +the entry's [affordance selector](#affordanceselector) to identify the +Thing or affordance. The Publisher MUST make the selected TD available +before configuring Producers to use the Descriptor and SHOULD link to a +specific TD version. + +If Descriptor retrieval, entry selection, or TD or selector resolution +fails, the Consumer MUST report the failure and leave the event +uncorrelated. Apply the [Descriptor Reference failure +rules](descriptor.md#failure-outcomes). The Consumer MAY retain or forward +the uncorrelated event. + +## WoT Descriptor entries + +A TD entry has class `thingdescription`. A [Thing Model][TM] (TM) defines +a reusable model for Things; a TM entry has class `thingmodel`. Both +classes MUST link to the resolved document itself at `url`. For example, +with xRegistry, use the document-view URL. The +[Descriptor rules](descriptor.md#entries) define the entry names. + +### affordanceselector -The Core [`source`](../spec.md#source) identifies the context in which the event -occurred and follows Core's URI-reference rules. An actor can emit an event -concerning a different device. +A TD entry MAY include `affordanceselector` to select an affordance. +Omission selects the whole Thing. In a TM entry, this member selects a +model declaration; omission selects no individual declaration. -For example, `https://factory.example.com/line1/pump7` and -`mqtt://site/line/cell/device/sensor` are valid sources. +When present, the member MUST be a plain [RFC 6901][JSON Pointer] string +of the form `/properties/`, `/actions/`, or `/events/`. +It MUST identify an existing affordance or declaration in the linked +document. The Consumer MUST apply only RFC 6901 string-form decoding. +Null, empty, root, and more deeply nested selectors are invalid. Put +profile-defined annotations beside the selector; their profile defines +their scope, type, and omission rules. -An agreed binding MAY use an absolute, fragment-free Descriptor URL as -`source` if it identifies the originating context. -[Description Selection](#description-selection) defines when to retrieve -the source. +### Event binding -#### Event identity +A TM entry MAY carry `type` to associate an event contract with a TM or +one of its declarations. For a Consumer using this binding, the entry's +`type` MUST match the decoded event `type` exactly. If the publication +profile names a TM entry, only that entry can match. Otherwise, exactly +one match is REQUIRED. The Consumer MUST report missing, ambiguous, or +invalid bindings and unavailable TMs. The concrete TD path and the TM +declaration path can differ; derivation uses the model declaration. -Changing `source` to a Descriptor URL changes the -[event identity scope](../spec.md#id) and the scope of the -[Sequence extension](sequence.md). Changing `describedby` or `subject` leaves -both scopes unchanged. +### planurl + +A TD or TM entry MAY include `planurl`, an absolute, fragment-free +HTTP(S) URL for the projection plan that produced the view at `url`. +The publication profile defines the plan's format. Consumers using the +plan MUST verify that it produced the linked view. The resolved view +remains valid when this OPTIONAL provenance is unavailable. + +The [WoT entry schema](wot.schema.json) checks entry shape. Apply the +selection rules to check the linked document and selector target. + +## Mapping Core Context Attributes + +### source + +[`source`](../spec.md#source) identifies the event's originating context +and follows Core's URI-reference rules. For example, a telemetry service +can report a measurement for a pump. CloudEvents event identity and the +[Sequence extension](sequence.md) use the event's `source` even when +`describedby` changes. + +### subject + +[`subject`](../spec.md#subject) is OPTIONAL and retains its Core meaning. +For example, a Producer can supply `pump7` to support filtering. WoT +retrieval and correlation use the Descriptor selected by `describedby`. ### type Core [`type`](../spec.md#type) identifies the event contract: the payload -representation, members, types and semantics defined by the publication +representation, members, types, and semantics defined by the publication profile or protocol binding. Things can share a type when they share a contract. The dot-separated type supports code generation. The type MUST contain one or more segments separated by single dots. Each segment MUST start with an ASCII letter or underscore; the rest can contain -only ASCII letters, digits and underscores. These restrictions apply only -to `type`; generators still handle language keywords. The last segment MUST -be the contract revision `vN`, with positive decimal `N` and no leading zeros. +only ASCII letters, digits, and underscores. Generators still handle +language keywords. The last segment MUST be the contract revision `vN`, +with positive decimal `N` and no leading zeros. -A [Thing Model][TM] (TM) defines a reusable model for Things. A Producer -MAY configure the complete type. Otherwise, it derives the type from a -governing TM and, for an affordance event, the corresponding +A Producer MAY configure the complete type. Otherwise, it derives the type +from a governing TM and, for an affordance event, the corresponding model-affordance path. When composition or derivation leaves the mapping ambiguous, the publication configuration MUST select it explicitly. -A Producer MUST NOT infer the mapping solely from -matching names or select the first TM link. - -A TM entry in the Processing Descriptor MAY carry `type` to expose an -event binding. To use it, match the entry's `type` to the decoded event -`type` exactly. If the publication profile names a TM entry, only that -entry can match; otherwise, exactly one match is REQUIRED. An OPTIONAL -`affordanceselector` identifies a declaration in that TM using the [pointer -rules](#subject-descriptor-selection); omission selects no individual -declaration. Consumers using the binding MUST report missing, ambiguous, or invalid -bindings and unavailable TMs. Retrieve a TM when the operation needs it. +A Producer MUST NOT infer the mapping solely from matching names or select +the first TM link. For an eligible HTTPS TM identifier, derive the type as follows: @@ -131,509 +183,59 @@ com.example.models.tm.pump.properties.processData.v1 ``` For a whole-Thing event, use the TM-derived type without an affordance path, -then append the revision. The publication profile defines how interaction data -is aggregated into the payload. +then append the revision. The publication profile defines how interaction +data is aggregated into the payload. The publication profile MUST assign the same revision to the same event contract. A Producer MUST use a new revision when the contract changes, including when a member is added or removed, a member's type or meaning -changes, or the payload envelope changes. This applies even when the change is -backwardly compatible. A Producer MUST NOT reuse a revision for a different -contract with the same base type. +changes, or the payload envelope changes. This applies even to +backward-compatible changes. A Producer MUST NOT reuse a revision for a +different contract with the same base type. For example, adding a `quality` member to `com.example.models.tm.pump.properties.processData.v1` requires -`com.example.models.tm.pump.properties.processData.v2`, even if Consumers can -ignore the new member. - -Changing a value or omitting or including an OPTIONAL member does not change -the revision. Changes to `describedby`, a TD URL, the selected schema or subject metadata -require a new revision only if they change the payload contract. +`com.example.models.tm.pump.properties.processData.v2`, even if Consumers +can ignore the new member. Changing a value or omitting or including an +OPTIONAL member preserves the revision. Changes to `describedby`, a TD +URL, the selected schema, or `subject` require a new revision only if they +change the payload contract. The Producer MUST configure a valid complete type when the derivation is -unavailable, produces an invalid symbol, or collides with a different event -contract in the Producer's type namespace. A slash-to-dot conversion is not -reversible: `/tm/pump.v1` and `/tm/pump/v1` produce the same suffix. The -Producer MUST disambiguate such contracts by configuration rather than -silently rewriting identifiers or member names. - -### subject - -The publication profile MUST choose Descriptor-driven or subject-driven -selection before the Consumer interprets [`subject`](../spec.md#subject). -In Descriptor-driven selection, `describedby` is REQUIRED and `subject` -is OPTIONAL with its Core meaning. The Consumer MUST use the selected TD -entry as the sole input for Thing or affordance retrieval and correlation. -In subject-driven selection, `subject` is REQUIRED and MUST use a form in -the following table. The Consumer MUST determine the mode from the -publication profile and the form from the decoded `subject`. - -| Subject form | Meaning | -| --- | --- | -| `#` or `#/properties/processData` | Select the unique TD entry in the Processing Descriptor, then the whole Thing or affordance. | -| `pump7#/properties/processData` | Select the Processing Descriptor's named TD entry `pump7`, then its affordance. | -| `https://example.com/td/pump7/versions/3#/properties/processData` | Identify the Thing's affordance through a TD document URL; description selection follows the rules below. | -| `https://example.com/descriptorgroups/subjects/descriptors/pump7-process/versions/1` | Identify a Subject Descriptor Version. Its selected TD entry identifies the Thing and optionally one affordance. | - -In subject-driven selection, the Consumer MUST classify the decoded `subject` -as follows: - -1. If there is no literal `#`, the value MUST be an absolute HTTP(S) URL. - It selects a Subject Descriptor Version under the rules below. -2. Otherwise, split at the first literal `#`. If the prefix begins with - `http://` or `https://`, case-insensitively, it MUST be a valid absolute - HTTP(S) URL and selects the direct-TD form. -3. Any other prefix MUST be empty or a valid Descriptor entry name. - It selects the Descriptor-relative form. - -The absence of a fragment and an empty fragment are different forms. -`https://example.com/document#` selects a whole TD; -`https://example.com/document` selects a Subject Descriptor Version and MUST -meet that form's requirements. A percent-encoded `%23` is part of the URL, not -the delimiter. Consumers MUST classify before percent-decoding a fragment. - -Entry names follow the [Descriptor rules](descriptor.md#entries). For -example, `http:pump7#` has the Descriptor-relative form and names the entry -`http:pump7`. Invalid input or an unexpected -representation MUST NOT be retried through another form or resolved against -`source`. - -For the forms containing `#`, the suffix including it MUST be a valid [RFC -6901][JSON Pointer] URI fragment. For the whole Thing, the Producer MUST use an -empty fragment, such as `#`, `pump7#` or -`https://example.com/td/pump7/versions/3#`. For an affordance event, the pointer -MUST identify the concrete affordance in that TD, such as -`#/properties/processData`, `#/actions/setSetpoint` or `#/events/alarm`. - -The Producer MUST escape JSON Pointer tokens before applying URI-fragment -encoding. For example, property `pressure/bar` is addressed by -`#/properties/pressure~1bar`; a literal `#` in a name is percent-encoded. The -Consumer MUST apply URI-fragment decoding once, then JSON Pointer token decoding -as specified by RFC 6901. It MUST report a correlation failure if the encoding -or pointer is invalid or the pointer does not select the intended Thing or -affordance. - -The subject identifies what the event concerns. Use the TD pointer as -defined above, without appending a writer or occurrence identifier. - -The concrete TD path and corresponding TM declaration path can differ. This -profile does not infer a declaration-lineage mapping between them. - -A Descriptor-relative subject can stay stable when `describedby` selects -a new version. +unavailable, produces an invalid symbol, or collides with a different +event contract in the Producer's type namespace. For example, +`/tm/pump.v1` and `/tm/pump/v1` produce the same suffix. Disambiguate +such contracts by configuration. ### dataschema and datacontenttype Core [`dataschema`](../spec.md#dataschema) and -[`datacontenttype`](../spec.md#datacontenttype) describe the schema and media -type of `data`. - -The publication profile or protocol binding determines whether an external -payload schema is REQUIRED. The Consumer MUST use `dataschema` when -present; otherwise, select the Processing Descriptor's [schema -entry][Schema Descriptor Profile]. Without a Processing Descriptor, -`dataschema` is the only candidate. - -The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, -invalid selector, unavailable schema or unsupported format MUST NOT cause -fallback to another schema. If `dataschema` is present, the Consumer MUST -still validate applicable Descriptor selectors and use `dataschema` as the -sole schema input. Producers and Descriptor -publishers SHOULD supply one schema source or identify the same schema in -both. Producers SHOULD omit `dataschema` when the Processing Descriptor -supplies the schema. - -A TD can contain several DataSchemas. A Producer MUST NOT use a TD URL as -`dataschema` unless the URL identifies the schema for `data` itself. -The profile or binding maps an affordance's DataSchema to the wire payload. -Aggregated properties, event data and protocol envelopes can need different -schemas. A schema supplied through `dataschema` or a Descriptor MUST describe -the actual payload, including its encoding and envelope. - -A profile MAY require an exact schema version independently of the selected -TD version. - -## Description Selection - -Apply [CloudEvents event-format decoding](../formats/json-format.md#22-type-system-mapping) -before checking attribute presence. An explicit `describedby` selects the -Processing Descriptor under the [Descriptor Reference -rules](descriptor.md#describedby). A **Subject Descriptor** serves a separate -role: in subject-driven selection, a fragment-free `subject` URL can select -a Descriptor for the Thing or affordance. Only the Processing Descriptor -can supply Descriptor-based event binding, schema, or writer metadata. - -In Descriptor-driven selection, use the Processing Descriptor's [selected -TD entry](#subject-descriptor-selection). Missing or invalid input fails -correlation in that mode. - -In subject-driven selection, use the decoded `subject` form: - -1. For a fragment-free HTTP(S) URL, retrieve its Subject - Descriptor Version and apply [Subject Descriptor - selection](#subject-descriptor-selection). `describedby`, when present, - remains the Processing Descriptor. The Consumer MUST limit lookup in - this form to the Descriptors selected by those attributes. -2. For a direct-TD subject without `describedby`, retrieve its TD - document at the exact prefix URL, including its query. Evaluate the - fragment locally. The Consumer MUST use the retrieved TD directly as - the sole description for correlation on this route. -3. Otherwise, use the Processing Descriptor selected through `describedby`, - or the agreed source-Descriptor binding if `describedby` is absent. In the - latter case, retrieve the exact `source` URL, which MUST be an absolute URL - without a fragment. If no such binding was agreed, report a correlation - failure. - -For a Descriptor-relative or direct-TD subject using a Processing Descriptor, -select only entries of class `thingdescription`: - -- For an empty subject prefix, the Processing Descriptor MUST have exactly - one TD entry. -- For an entry-name prefix, the named entry MUST have that class. -- For a direct URL prefix, exactly one TD entry MUST - have a `url` equal to that prefix. Consumers MUST compare the strings exactly, - without URI normalization. Missing or duplicate matches are correlation - failures. A named subject can disambiguate duplicate URLs. - -Use the selected TD directly or from its bundled `document`. A URL mismatch -is a correlation failure even when a redirect destination, TD `id`, or -`entityid` matches. - -The Producer MUST supply all REQUIRED inputs through the selected route, -event and profile. When the Producer uses `describedby`, the Consumer MUST -take Descriptor-based processing inputs exclusively from that Descriptor. - -If selection, retrieval or correlation fails, the Consumer MUST report the -failure and leave the event uncorrelated. It MAY retain or forward the -uncorrelated event, but MUST NOT switch routes or substitute another TD. -See the [Descriptor Reference failure rules](descriptor.md#failure-outcomes) -for an explicit `describedby`. - -The Publisher MUST make the selected TD available before configuring -Producers to use its URL or a Descriptor that references it. The Publisher -SHOULD use a TD Version URL. - -### Subject Descriptor selection - -When `subject` selects a Descriptor, its URL MUST identify a fixed **Version** -under an agreed binding. The Consumer MUST verify that the response is the -addressed Version under that binding, including after any redirect. A -`/versions/` substring or `versionid` alone is insufficient. Report a -correlation failure if verification fails. Use the URL unchanged. - -When a Descriptor supplies the Thing or affordance selection, select the TD -entry named by the publication profile, or the unique TD entry if it names -none. Report missing or ambiguous entries. Retrieve that TD and apply the entry's -`affordanceselector`. A subject carrying its own fragment uses that fragment -instead. - -Put `affordanceselector` in the selected TD entry, or omit it there to -select the whole Thing. A present selector -MUST be a plain RFC 6901 string selecting one existing affordance: -`/properties/`, `/actions/` or `/events/`. Consumers MUST -apply only RFC 6901 string-form decoding. A present member with a null, -empty, object, root, or deeper selector is invalid. Annotations belong -beside the selector; their profile defines -their scope, type and omission rules. - -Consumers MUST report invalid subject metadata, unavailable TDs and -unresolved selectors as correlation failures. Consumers MUST limit Subject -Descriptor selection to the directly selected Descriptor and TD. - -When `subject` selects a Descriptor and `describedby` is present, its TD URL -MUST match the `url` of exactly one TD entry in the Processing Descriptor. This -comparison is byte-for-byte, without URI normalization, redirect substitution or -inference from TD or entity IDs. A missing or duplicate match is a correlation -failure. The Consumer MUST use the matching TD representation with the -selection and annotations from the Subject Descriptor alone. Missing or -invalid subject metadata is a correlation failure. - -If `subject` and `describedby` name the same Version, follow the -[Descriptor caching rules](descriptor.md#caching) for response reuse. -Consumers MUST validate both roles independently. - -## WoT Descriptor entries - -A **TD entry** has class `thingdescription`; a **TM entry** has class -`thingmodel`. Both MUST link to the resolved document itself at `url`. -For example, with xRegistry, use the document-view URL. The base -[Descriptor rules](descriptor.md#entries) define the entry names. - -A TD or TM entry MAY include `planurl`, an absolute, fragment-free HTTP(S) -URL for the projection plan that produced the view at `url`. The publication -profile defines its format. Consumers using the plan MUST verify that it -produced the linked view. The resolved view remains valid when this -OPTIONAL provenance is unavailable. - -The [WoT entry schema](wot.schema.json) checks entry shape. The linked -document and selector target are checked under the relevant selection rules. - -## Relationship to Other Extensions - -An event that also uses the [OPC UA extension](opcua.md) MUST follow -its [combined WoT mapping](opcua.md#wot-mapping) for native message types, -sequence counters, and writer identities. - -## Examples - -### Single Affordance - -This CloudEvent identifies a pump and its `processData` property. Its Descriptor -selects version `3.0.0` of the resolved TD and supplies the payload schema. -Another TD in the same Descriptor describes a gateway. - -```json -{ - "specversion": "1.0", - "id": "sample-4711", - "source": "https://registry.example/descriptorgroups/devices/descriptors/pump7", - "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "pump7#/properties/processData", - "datacontenttype": "application/json", - "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1", - "data": { - "Speed": 1500, - "Pressure": 4.5 - } -} -``` - -The Descriptor has the following entries: - -```json -{ - "descriptorid": "pump7-telemetry", - "versionid": "1", - "entries": { - "pump7": { - "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - }, - "gateway1": { - "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/gateway1/versions/1.0.0" - }, - "payload": { - "class": "schema", - "url": "https://schemas.example/pump-process-data/versions/3" - }, - "geometry": { - "class": "usdasset", - "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2" - } - } -} -``` - -The subject prefix selects `pump7` by name, and the suffix selects its -`processData` property. The `payload` entry supplies the schema for the -object in `data`. This correlation uses the selected TD; the `geometry` -entry is available to an OpenUSD Consumer. - -### Direct TD Subject - -This event needs only the TD and an external payload schema, so it omits -`describedby`. The source identifies the service that emitted the event. - -```json -{ - "specversion": "1.0", - "id": "sample-4712", - "source": "urn:example:actor:telemetry-service", - "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0#/properties/processData", - "dataschema": "https://schemas.example/pump-process-data/versions/3", - "datacontenttype": "application/json", - "data": { - "Speed": 1500, - "Pressure": 4.5 - } -} -``` - -The Consumer retrieves the TD at the URL before `#` and evaluates -`/properties/processData` locally. - -### Direct Subject with a Descriptor - -The preceding event can instead select the same telemetry Descriptor: - -```json -{ - "specversion": "1.0", - "id": "sample-4714", - "source": "urn:example:actor:telemetry-service", - "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0#/properties/processData", - "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1", - "datacontenttype": "application/json", - "data": { - "Speed": 1500, - "Pressure": 4.5 - } -} -``` - -The direct subject matches exactly the `pump7` entry. The Descriptor now -supplies the schema. Changing just the subject's TD Version to `4.0.0` would -fail correlation because this Descriptor names Version `3.0.0`. Adding another TD -entry with that same Version `3.0.0` URL would also make the direct match -ambiguous; a named subject would then be REQUIRED. - -### Source-selected Descriptor - -When the agreed source-Descriptor binding is enabled, the Single Affordance -event can use the following complete envelope without `describedby`: - -```json -{ - "specversion": "1.0", - "id": "sample-4715", - "source": "https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1", - "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "pump7#/properties/processData", - "datacontenttype": "application/json", - "data": { - "Speed": 1500, - "Pressure": 4.5 - } -} -``` - -Here `source` identifies the stream Descriptor as the originating context. -Changing this source URL changes the event identity scope. - -### Subject Descriptor with Separate Processing Inputs - -This event selects a Subject Descriptor Version through a fragment-free -`subject` URL. Its `describedby` independently selects the `pump7-telemetry` -Processing Descriptor shown in the Single Affordance example. For these -examples, the configured xRegistry HTTP base is `https://registry.example`, with -`descriptorgroups` and `descriptors` as the Descriptor collections. - -```json -{ - "specversion": "1.0", - "id": "sample-4716", - "source": "urn:example:actor:telemetry-service", - "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "https://registry.example/descriptorgroups/subjects/descriptors/pump7-process/versions/1", - "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-telemetry/versions/1", - "datacontenttype": "application/json", - "data": { - "Speed": 1500, - "Pressure": 4.5 - } -} -``` - -This deployment defines `acme_purpose` as an OPTIONAL non-empty string -that describes the selected affordance. Null is invalid. - -```json -{ - "descriptorid": "pump7-process", - "versionid": "1", - "entries": { - "pump7": { - "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0", - "affordanceselector": "/properties/processData", - "acme_purpose": "maintenance" - }, - "pumpmodel": { - "class": "thingmodel", - "url": "https://registry.example/thingmodelgroups/factory/thingmodels/pump/versions/1.0.0", - "type": "com.example.models.tm.pump.properties.processData.v1", - "affordanceselector": "/properties/processData" - }, - "payload": { - "class": "schema", - "url": "https://schemas.example/pump-process-data/versions/3" - } - } -} -``` - -The TD's `processData` property supplies the subject. Access and operation -authorization follow the [security considerations](#security-considerations). -A second matching TD URL in the Processing Descriptor fails correlation. - -The Descriptor-driven variant selects `pump7-process` through `describedby` -and omits `subject`. The same Descriptor supplies the concrete TD selector, -the schema, and the `type` binding to `pumpmodel`. The TM pointer need not -match the TD pointer. - -```json -{ - "specversion": "1.0", - "id": "sample-4717", - "source": "urn:example:actor:telemetry-service", - "type": "com.example.models.tm.pump.properties.processData.v1", - "describedby": "https://registry.example/descriptorgroups/subjects/descriptors/pump7-process/versions/1", - "datacontenttype": "application/json", - "data": { - "Speed": 1500, - "Pressure": 4.5 - } -} -``` - -An event using this URL only as `subject` supplies an external payload -schema through `dataschema` when needed. - -#### Whole Thing through a Subject Descriptor - -The following Subject Descriptor selects the whole Thing by omitting -`affordanceselector`. Its `description` member describes the whole Thing. - -```json -{ - "descriptorid": "pump7-whole", - "versionid": "1", - "description": "Pump 7 operating state", - "entries": { - "pump7": { - "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - } - } -} -``` - -Under the configured example Registry, its subject URL is -`https://registry.example/descriptorgroups/subjects/descriptors/pump7-whole/versions/1`. -An aggregate-state event can select this URL with the aggregate type and -Processing Descriptor used in the Whole Thing example. The direct-TD -form selects the whole Thing with a TD URL followed by `#`. - -### Whole Thing - -This CloudEvent carries aggregated data for the same pump. Its Descriptor -selects version `3.0.0` of the resolved TD and the aggregate payload schema. The -publication profile defines a payload containing the `processData` and `running` -property values. The subject selects the whole TD. - -```json -{ - "specversion": "1.0", - "id": "sample-4713", - "source": "https://factory.example.com/line1/pump7", - "type": "com.example.models.tm.pump.v1", - "subject": "#", - "datacontenttype": "application/json", - "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-state/versions/1", - "data": { - "processData": { - "Speed": 1500, - "Pressure": 4.5 - }, - "running": true - } -} -``` - -The referenced Descriptor Version contains the following metadata. +[`datacontenttype`](../spec.md#datacontenttype) describe the schema and +media type of `data`. The publication profile or protocol binding +determines whether an external payload schema is REQUIRED. + +If `dataschema` is present, the Consumer MUST use it as the sole schema +input and still validate applicable Descriptor selectors. Otherwise, +select the Descriptor's [schema entry][Schema Descriptor Profile]. +Producers and Descriptor publishers SHOULD supply one schema source or +identify the same schema in both. Producers SHOULD omit `dataschema` +when the Descriptor supplies the schema. + +The Consumer MUST report a missing REQUIRED schema. An ambiguous +selection, invalid selector, unavailable schema, or unsupported format +MUST NOT cause fallback to another schema. The selected schema MUST +describe the actual payload, including its encoding and envelope. For +example, a TD URL belongs in `dataschema` only when it identifies the +schema for `data` itself. The profile or binding maps an affordance's +DataSchema to the wire payload and can require a specific schema version +independently of the TD version. + +## Whole-Thing example + +To report the pump's aggregate state, the Producer uses +`com.example.models.tm.pump.v1` as `type` and points `describedby` to a +Descriptor whose TD entry omits `affordanceselector`. The schema entry +describes the aggregate object, including both `processData` and `running`. ```json { @@ -642,7 +244,7 @@ The referenced Descriptor Version contains the following metadata. "entries": { "pump7": { "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + "url": "https://devices.example/pump7/td.json" }, "payload": { "class": "schema", @@ -652,22 +254,20 @@ The referenced Descriptor Version contains the following metadata. } ``` -The empty subject prefix selects the unique TD entry. The `payload` entry -supplies the schema for the complete object in `data`, which contains both -property values. +## Relationship to Other Extensions -## Security Considerations +An event that also uses the [OPC UA extension](opcua.md) MUST follow +its [combined WoT mapping](opcua.md#wot-mapping) for native message types, +sequence counters, and writer identities. -Resolvers MUST apply their configured trust, authorization and retrieval -policies before accessing documents. An untrusted identity or schema URI -MUST NOT authorize arbitrary network access, redirects or credential -forwarding. Implementations SHOULD bound document sizes and dependency -resolution. +## Security Considerations -Treat context attributes as Producer-supplied values unless another -mechanism authenticates them. Establish trust and access independently -for each referenced document, its model lineage, and its dependencies. -Correlating an event with an affordance does not authorize invoking it. +Apply the [Descriptor Reference security rules](descriptor.md#security-considerations) +to the Descriptor and its linked documents. Treat context attributes as +Producer-supplied values unless another mechanism authenticates them. +Establish trust and access independently for each document, its model +lineage, and its dependencies. Correlating an event with an affordance +does not authorize invoking it. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model From 12705463abfc80f40f9cabaeb25e9d2c05f7bf6c Mon Sep 17 00:00:00 2001 From: Marc Date: Sat, 21 Nov 2026 12:44:58 +0100 Subject: [PATCH 46/60] Clarify Descriptor retrieval failures Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index 8be291e61..ec1c6c855 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -193,9 +193,11 @@ inputs from a failed payload validation. | Applicable validation completed | Payload valid or invalid, according to that validator. | | Validation not performed or could not complete | Payload not checked; not a successful validation. | -If an explicit `describedby` is invalid, unavailable or incomplete, the -Consumer MUST report the failure and MUST NOT substitute another description -for it. A profile MAY permit processing that does not depend on the Descriptor, +If an explicit `describedby` URL is invalid or fails to return a valid +Descriptor response with the REQUIRED inputs, the Consumer MUST report the +failure and MUST NOT substitute another description for it. + +A profile MAY permit processing that does not depend on the Descriptor, but the Consumer MUST NOT report successful Descriptor-based interpretation or validation without REQUIRED inputs. Unless the profile dictates the outcome, local policy determines whether to defer, reject, retain or forward an From b13b194d2c8dd270a0ec0405e770bb8d747ae159 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 23 Nov 2026 11:44:19 +0100 Subject: [PATCH 47/60] Clarify Descriptor entries and bundle documentation Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 202 ++++++++++++++++----------- 1 file changed, 118 insertions(+), 84 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index ec1c6c855..5f5032107 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -37,6 +37,9 @@ used. For example, an attribute being marked as "REQUIRED" does not mean it needs to be in all CloudEvents, rather it needs to be included only when this extension is being used. +In pseudo-JSON examples, `?` marks an OPTIONAL member and `...` stands for +additional members. Whitespace is for readability. + ## Attributes ### describedby @@ -50,15 +53,9 @@ this extension is being used. A successful response serving the Descriptor metadata MUST use `Content-Type: application/json`. -Use the supplied URL, including its query if present. Other extensions can -reuse the Descriptor document format and define how to locate a Descriptor -without using `describedby`. - ## Descriptor document A Descriptor document MUST be a JSON object with the following structure. -A question mark identifies an OPTIONAL member. The structure shows one named -entry; the `entries` object can hold any number of entries. ```text { @@ -77,8 +74,7 @@ entry; the `entries` object can hold any number of entries. } ``` -The ellipses stand for additional fields. This specification does not define -their meaning. The entry's class determines whether it needs `url`. +Extensions MAY add members to the document and its entries. ### `descriptorid` @@ -101,42 +97,48 @@ entity. It does not trigger retrieval. ### `bundleurl` OPTIONAL. An absolute, fragment-free HTTP(S) URL for retrieving a -[bundle](#bundled-document) of this version. Omit it when the server does not -support a bundle for this Descriptor. In a bundle, this URL points to the bundle -itself. +[bundle](#bundled-document) of this Descriptor document. A Descriptor MAY +include `bundleurl` only when the server offers a bundle for it. In a bundle, +`bundleurl`, when present, MUST point to the bundle itself. ### `entries` -REQUIRED. An object whose members are named entries. An empty object is valid. +REQUIRED. A map with zero or more members. Each key is an entry name and +its value is an [entry](#entry). Entry names are one to 63 lowercase ASCII letters, digits, colons, hyphens, -underscores or dots, starting with a letter or digit. Each entry has a -REQUIRED `class` that identifies the kind of information the entry supplies. -An entry with a linked document MUST have an absolute, fragment-free HTTP(S) -`url`. An entry that supplies only inline fields MUST omit `url`. A null `url` -is invalid. The same class MAY appear under different entry names. +underscores, or dots, starting with a letter or digit. + +#### Entry + +An entry is a JSON object with the following members. Its class can define +additional members. + +##### `class` + +REQUIRED. Identifies the kind of information the entry supplies and +determines whether the entry links to a document or carries its information +inline. The same class MAY appear under different entry names. + +##### `url` + +REQUIRED for entries that link to a document. The value MUST be an absolute, +fragment-free HTTP(S) URL. Entries that supply only inline fields MUST omit +`url`. ### Bundled document -A Consumer can retrieve an advertised bundle by sending HTTP `GET` to the +A Consumer MAY retrieve an advertised bundle by sending HTTP `GET` to the supplied `bundleurl`. A successful response at that URL MUST use `Content-Type: application/json`. The bundle MUST have the same `descriptorid` and `versionid` as the Descriptor that advertised it. -A bundle has the same Descriptor members as metadata. For each entry with -a `url`, it adds a `document` object to that entry. It MUST NOT add a -`document` to an inline-only entry. Metadata responses omit all `document` -members. A bundle contains the directly linked documents only; its server -MUST NOT automatically follow links from profile fields or from the documents. - -Each `document` has a REQUIRED `contenttype` and exactly one of `content` -(a JSON value) and `contentbase64` (base64-encoded bytes). Non-JSON -representations use `contentbase64`. When the retrieved document has no -media type, use `application/octet-stream`. The server MUST decode HTTP -content codings before embedding bytes. If an allowed redirect changed the -retrieval URL, `document.baseurl` MUST give the final URL. The entry's `url` -stays unchanged. Consumers resolve any format-specific relative links against -`baseurl` if present, or the entry `url` otherwise. +A bundle is an expanded view of a Descriptor. Each entry with a `url` +MUST include a `document` member containing the linked document. This +lets the Consumer retrieve the directly linked documents in one response. +Inline-only entries and ordinary Descriptor metadata responses MUST omit +`document`. The server MUST NOT automatically follow links from profile +fields or from the linked documents. The server MUST verify authorization and obtain the complete document for every linked entry before returning a successful bundle. If it cannot do so, @@ -144,6 +146,42 @@ it MUST report failure rather than return a partial bundle. If a request to `bundleurl` fails, the Consumer MAY use the original Descriptor to retrieve only the entries it needs. This does not select another Descriptor. +#### `document` + +The `document` object contains `contenttype` and exactly one of `content` +and `contentbase64`. It has the following structure: + +```text +{ + "contenttype": "", + "content": , ? + "contentbase64": "", ? + "baseurl": "" ? +} +``` + +##### `contenttype` + +REQUIRED. The media type of the linked document. Use +`application/octet-stream` if the retrieved document has no media type. + +##### `content` + +The linked document as a JSON value. + +##### `contentbase64` + +The linked document as base64-encoded bytes. Non-JSON representations use +this member. The server MUST decode HTTP content codings before embedding +bytes. + +##### `baseurl` + +REQUIRED when an allowed redirect changed the retrieval URL. The value MUST +give the final URL. The entry's `url` stays unchanged. Consumers resolve +format-specific relative links against `baseurl` when present, or the +entry's `url` otherwise. + ### JSON Schema The [Descriptor JSON Schema](descriptor.schema.json) is available for @@ -153,20 +191,17 @@ or entry-specific checks. ## Descriptor profiles -A Descriptor profile is an agreement about how Producers and Consumers use -the information in a Descriptor. A specification or configuration can define -which entry classes to use, what their linked documents and inline fields -mean, and how to select entries when several have the same class. A profile -can also define how event attributes affect selection or require a URL that -always identifies the same Descriptor version. +A class definition specifies the representation that HTTP `GET` on an +entry's `url` returns, or the fields the entry supplies inline. A profile +can also specify how to select entries for a particular use or require +a URL that identifies a fixed Descriptor version. Standard classes use short lowercase alphanumeric tokens starting with a letter. Other specifications can define their own classes using reverse DNS names under the defining party's control. A `class` string is at most 63 -characters. A class definition specifies whether entries link to a document -and which additional fields they carry. +characters. -The following `class` strings are assigned: +The following `class` values are well-known class names: - `endpoint`: [Endpoint Descriptor profile](#endpoint) - `opcuawriter`: [OPC UA Descriptor profile](opcua.md#descriptor-entry) @@ -205,9 +240,8 @@ uninterpreted event. These outcomes add no event attributes or HTTP error codes. ### Schema -A `schema` entry MUST link to a payload schema document at `url`, not its -Registry metadata. Use the linked document or the entry's bundled -`document`. A schema registry is not REQUIRED. +A `schema` entry's `url` MUST identify a schema document for the event +payload. Use the linked document or the entry's bundled `document`. The [Descriptor JSON Schema](descriptor.schema.json) defines `schemaEntry` in `$defs` for validating this entry. @@ -235,46 +269,6 @@ failed selection with an unrelated endpoint. ## Examples -### Maintenance decision - -A maintenance service reports a decision about Pump 7. The event's -`describedby` URL identifies the Descriptor for interpreting that decision. - -```json -{ - "specversion": "1.0", - "id": "decision-47", - "source": "urn:example:maintenance-service:planner7", - "subject": "pump7", - "type": "com.example.maintenance.decision.v1", - "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-maintenance/versions/1", - "datacontenttype": "application/json", - "data": { - "inspectionNeeded": true - } -} -``` - -The `pump7` entry identifies the pump's Thing Description. The `inspection` -entry links to metadata for the inspection service endpoint. - -```json -{ - "descriptorid": "pump7-maintenance", - "versionid": "1", - "entries": { - "pump7": { - "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - }, - "inspection": { - "class": "endpoint", - "url": "https://registry.example/endpoints/inspection" - } - } -} -``` - ### Bundled endpoint The client retrieves the Descriptor metadata: @@ -353,6 +347,46 @@ Connection: close } ``` +### Maintenance decision + +A maintenance service reports a decision about Pump 7. The event's +`describedby` URL identifies the Descriptor for interpreting that decision. + +```json +{ + "specversion": "1.0", + "id": "decision-47", + "source": "urn:example:maintenance-service:planner7", + "subject": "pump7", + "type": "com.example.maintenance.decision.v1", + "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-maintenance/versions/1", + "datacontenttype": "application/json", + "data": { + "inspectionNeeded": true + } +} +``` + +The `pump7` entry identifies the pump's Thing Description. The `inspection` +entry links to metadata for the inspection service endpoint. + +```json +{ + "descriptorid": "pump7-maintenance", + "versionid": "1", + "entries": { + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + }, + "inspection": { + "class": "endpoint", + "url": "https://registry.example/endpoints/inspection" + } + } +} +``` + ## Security Considerations Consumers and bundle endpoints MUST apply authorization, URL, redirect and From 794d90bad76414ece2767c7b1a02f2b8407a8d0d Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 23 Nov 2026 11:49:20 +0100 Subject: [PATCH 48/60] Remove entityid from CloudEvents Descriptors Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 14 ++++---------- cloudevents/extensions/descriptor.schema.json | 1 - 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index 5f5032107..47fa00bdc 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -61,7 +61,6 @@ A Descriptor document MUST be a JSON object with the following structure. { "descriptorid": "", "versionid": "", - "entityid": "", ? "bundleurl": "", ? "entries": { "": { @@ -89,11 +88,6 @@ representations stable for the intended use and replay of a published version. Publish a new version when those inputs change. The identifiers alone do not establish that a URL selects a fixed version. -### `entityid` - -OPTIONAL. An absolute, fragment-free URI that identifies the primary described -entity. It does not trigger retrieval. - ### `bundleurl` OPTIONAL. An absolute, fragment-free HTTP(S) URL for retrieving a @@ -399,10 +393,10 @@ Read access to a Descriptor does not grant access to its targets. A bundle does not bypass trust checks. Versions do not authenticate content or prove unchanged bytes. -Descriptive entity IDs, TD security declarations and references to actions are -not authenticated principals, execution grants or current readiness. Device -admission and operation outcomes remain governed by their own protocols and -trusted authorities. +TD security declarations and references to actions are not authenticated +principals, execution grants or current readiness. Device admission and +operation outcomes remain governed by their own protocols and trusted +authorities. ### Caching diff --git a/cloudevents/extensions/descriptor.schema.json b/cloudevents/extensions/descriptor.schema.json index 1324b0c20..77ffed578 100644 --- a/cloudevents/extensions/descriptor.schema.json +++ b/cloudevents/extensions/descriptor.schema.json @@ -13,7 +13,6 @@ "properties": { "descriptorid": { "type": "string", "minLength": 1 }, "versionid": { "type": "string", "minLength": 1 }, - "entityid": { "$ref": "#/$defs/absoluteUri" }, "bundleurl": { "$ref": "#/$defs/httpUrl" }, "entries": { "type": "object", From d9b06dc0ae650659ca33c0b962f28c92578c2d1d Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 23 Nov 2026 12:01:49 +0100 Subject: [PATCH 49/60] Simplify the CloudEvents Descriptor format Remove portable descriptor and version IDs, bind bundle URLs to the advertised version, and leave failure handling and schema selection to the profiles. Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 89 +++---------------- cloudevents/extensions/descriptor.schema.json | 4 +- cloudevents/extensions/opcua.md | 20 +++-- cloudevents/extensions/openusd.md | 7 +- cloudevents/extensions/wot.md | 21 ++--- 5 files changed, 40 insertions(+), 101 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index 47fa00bdc..0e0e18772 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -7,12 +7,10 @@ An HTTP `GET` at that URL returns a JSON document called a Descriptor. For example, a maintenance event can set `describedby` to `https://maintenance.example/pump7/versions/1`. The returned Descriptor links -to the inspection service's endpoint metadata: +to the inspection service's xRegistry Endpoint Group: ```json { - "descriptorid": "pump7", - "versionid": "1", "entries": { "inspection": { "class": "endpoint", @@ -59,8 +57,6 @@ A Descriptor document MUST be a JSON object with the following structure. ```text { - "descriptorid": "", - "versionid": "", "bundleurl": "", ? "entries": { "": { @@ -75,18 +71,9 @@ A Descriptor document MUST be a JSON object with the following structure. Extensions MAY add members to the document and its entries. -### `descriptorid` - -REQUIRED. A non-empty string that identifies the Descriptor within its -publication scope. - -### `versionid` - -REQUIRED. A non-empty string that identifies the version of the Descriptor. -Publishers MUST keep the entries, their inline fields, and their referenced -representations stable for the intended use and replay of a published version. -Publish a new version when those inputs change. The identifiers alone do not -establish that a URL selects a fixed version. +For a published Descriptor version, the Publisher MUST keep its entries, +inline fields, and linked representations stable for the intended use and +replay. Publish a new version when those inputs change. ### `bundleurl` @@ -124,8 +111,9 @@ fragment-free HTTP(S) URL. Entries that supply only inline fields MUST omit A Consumer MAY retrieve an advertised bundle by sending HTTP `GET` to the supplied `bundleurl`. A successful response at that URL MUST use -`Content-Type: application/json`. The bundle MUST have the same `descriptorid` -and `versionid` as the Descriptor that advertised it. +`Content-Type: application/json` and contain a bundle of the exact Descriptor +version that advertised that `bundleurl`, even if the original Descriptor URL +later serves a different version. A bundle is an expanded view of a Descriptor. Each entry with a `url` MUST include a `document` member containing the linked document. This @@ -188,7 +176,8 @@ or entry-specific checks. A class definition specifies the representation that HTTP `GET` on an entry's `url` returns, or the fields the entry supplies inline. A profile can also specify how to select entries for a particular use or require -a URL that identifies a fixed Descriptor version. +a URL that identifies a fixed Descriptor version. Each profile defines +the inputs it needs and how to handle unavailable or invalid inputs. Standard classes use short lowercase alphanumeric tokens starting with a letter. Other specifications can define their own classes using reverse DNS @@ -207,59 +196,15 @@ The following `class` values are well-known class names: When a profile needs one entry and its rules leave several candidates, the Consumer MUST report ambiguity rather than select by map order. -### Failure outcomes - -Descriptor-based interpretation requires a successful response with the -specified media type and a valid document that supplies the inputs the -profile needs. The following table distinguishes unavailable or invalid -inputs from a failed payload validation. - -| Condition | Result | -| --- | --- | -| REQUIRED inputs obtained and selected | Processing context available. It does not validate the payload or authorize an operation. | -| Missing, ambiguous, unavailable or unsupported REQUIRED input | Processing context unavailable. | -| Invalid shape, selector or profile value | Invalid metadata. | -| Applicable validation completed | Payload valid or invalid, according to that validator. | -| Validation not performed or could not complete | Payload not checked; not a successful validation. | - -If an explicit `describedby` URL is invalid or fails to return a valid -Descriptor response with the REQUIRED inputs, the Consumer MUST report the -failure and MUST NOT substitute another description for it. - -A profile MAY permit processing that does not depend on the Descriptor, -but the Consumer MUST NOT report successful Descriptor-based interpretation or -validation without REQUIRED inputs. Unless the profile dictates the outcome, -local policy determines whether to defer, reject, retain or forward an -uninterpreted event. These outcomes add no event attributes or HTTP error codes. - ### Schema -A `schema` entry's `url` MUST identify a schema document for the event -payload. Use the linked document or the entry's bundled `document`. -The [Descriptor JSON Schema](descriptor.schema.json) defines `schemaEntry` -in `$defs` for validating this entry. - -To select one schema, use the `schema` entry named by the publication -profile. If the profile supplies no name, one `schema` entry selects that -schema, no entries means absence, and multiple entries are ambiguous. -A specified name that is missing or has the wrong class is invalid, not -absence. An invalid or ambiguous selection, unsupported format, or -unavailable selected document MUST NOT cause fallback to another schema. -The event binding defines precedence between this entry and `dataschema`. +A `schema` entry's `url` MUST identify a schema document for the event's +`data`. ### Endpoint -An `endpoint` entry MUST link to a representation of endpoint metadata -at `url`. For an xRegistry [Endpoint Group][Endpoint Group], use the -Group's metadata URL. The entry does not authorize invoking the endpoint. -The [Descriptor JSON Schema](descriptor.schema.json) defines `endpointEntry` -in `$defs` for validating this entry. - -To select one endpoint, use the `endpoint` entry named by the publication -profile or the unique entry of that class if no name is supplied. -An absent entry, wrong class or ambiguous selection MUST be reported -when the operation needs that endpoint. The Consumer MUST NOT replace a -failed selection with an unrelated endpoint. +An `endpoint` entry's `url` MUST identify the metadata of an xRegistry +[Endpoint Group][Endpoint Group]. ## Examples @@ -282,8 +227,6 @@ Connection: close ```json { - "descriptorid": "inspection-endpoint", - "versionid": "1", "bundleurl": "https://static.example/bundles/inspection-endpoint/1", "entries": { "inspection": { @@ -311,8 +254,6 @@ Connection: close ```json { - "descriptorid": "inspection-endpoint", - "versionid": "1", "bundleurl": "https://static.example/bundles/inspection-endpoint/1", "entries": { "inspection": { @@ -362,12 +303,10 @@ A maintenance service reports a decision about Pump 7. The event's ``` The `pump7` entry identifies the pump's Thing Description. The `inspection` -entry links to metadata for the inspection service endpoint. +entry links to the inspection service's xRegistry Endpoint Group. ```json { - "descriptorid": "pump7-maintenance", - "versionid": "1", "entries": { "pump7": { "class": "thingdescription", diff --git a/cloudevents/extensions/descriptor.schema.json b/cloudevents/extensions/descriptor.schema.json index 77ffed578..417cdaf12 100644 --- a/cloudevents/extensions/descriptor.schema.json +++ b/cloudevents/extensions/descriptor.schema.json @@ -8,11 +8,9 @@ "$defs": { "descriptor": { "type": "object", - "required": ["descriptorid", "versionid", "entries"], + "required": ["entries"], "additionalProperties": true, "properties": { - "descriptorid": { "type": "string", "minLength": 1 }, - "versionid": { "type": "string", "minLength": 1 }, "bundleurl": { "$ref": "#/$defs/httpUrl" }, "entries": { "type": "object", diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 74d66f6ef..a1cfc63b7 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -31,8 +31,6 @@ When Consumers need metadata shared by a stream, the Producer can use ```json { - "descriptorid": "pump7-stream", - "versionid": "1", "entries": { "writer": { "class": "opcuawriter", @@ -106,8 +104,13 @@ or [Avro Schema](https://avro.apache.org/docs/1.11.1/specification/). `dataschema` identifies and versions that schema. A Processing Descriptor MAY supply the schema. The Consumer MUST use -`dataschema` when present; otherwise, use the Processing Descriptor's schema -under the [Schema Descriptor profile][Schema Descriptor Profile]. +`dataschema` when present. Otherwise, when a Processing Descriptor is +available, select its [schema entry][Schema Descriptor Profile] by the +name in the publication profile. If the profile supplies no name, select +the sole `schema` entry; zero entries means no schema, and multiple entries +are ambiguous. A named entry that is missing or has the wrong class is +invalid. Use the selected schema at its `url` or from its bundled +`document`. The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, invalid selector, unavailable schema or unsupported format MUST NOT cause @@ -448,9 +451,10 @@ applicable locations, the Consumer MUST report missing metadata and treat the event as nonconforming. A Consumer MUST use the selected Processing Descriptor as the sole -Descriptor source for shared schema and native metadata. -If retrieval fails, follow the [Descriptor Reference failure -rules](descriptor.md#failure-outcomes) for the Descriptor-based operation. +Descriptor source for shared schema and native metadata. If `describedby` +is present but the URL is invalid or the Consumer cannot obtain a valid +Descriptor there, the Consumer MUST report the failure and treat the +Descriptor-based inputs as unavailable. The Consumer MAY still interpret the native payload if the envelope, source query, and explicit event attributes supply every native requirement. That result is independent of WoT correlation. @@ -749,8 +753,6 @@ The referenced Descriptor version contains these entries: ```json { - "descriptorid": "pump7-telemetry", - "versionid": "1", "entries": { "pump7": { "class": "thingdescription", diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md index d178b32a1..43f34e839 100644 --- a/cloudevents/extensions/openusd.md +++ b/cloudevents/extensions/openusd.md @@ -9,8 +9,6 @@ following Descriptor associates the event with the `/Pump7` prim: ```json { - "descriptorid": "pump7-geometry", - "versionid": "1", "entries": { "geometry": { "class": "usdasset", @@ -43,6 +41,9 @@ CloudEvents meanings. ## Asset selection +If the Consumer cannot obtain a valid Descriptor at `describedby`, it MUST +report the failure and leave the event unassociated with an OpenUSD asset. + An entry with class `usdasset` MUST link to the OpenUSD asset itself at `url`. The Consumer can use the linked asset or the entry's bundled `document`. @@ -133,8 +134,6 @@ and `/Pump7/speed`, but no `/Pump7/status`: ```json { - "descriptorid": "pump7-geometry", - "versionid": "1", "entries": { "geometry": { "class": "usdasset", diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 62afd6606..bba5b31a3 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -31,8 +31,6 @@ The `payload` entry supplies the schema for the object in `data`. ```json { - "descriptorid": "pump7-process-data", - "versionid": "1", "entries": { "pump7": { "class": "thingdescription", @@ -78,11 +76,10 @@ Thing or affordance. The Publisher MUST make the selected TD available before configuring Producers to use the Descriptor and SHOULD link to a specific TD version. -If Descriptor retrieval, entry selection, or TD or selector resolution -fails, the Consumer MUST report the failure and leave the event -uncorrelated. Apply the [Descriptor Reference failure -rules](descriptor.md#failure-outcomes). The Consumer MAY retain or forward -the uncorrelated event. +Correlation fails if `describedby` is missing or invalid, the URL does not +yield a valid Descriptor, or the Consumer cannot select the TD entry or +resolve its TD or selector. The Consumer MUST report the failure and MAY +retain or forward the uncorrelated event. ## WoT Descriptor entries @@ -216,7 +213,13 @@ determines whether an external payload schema is REQUIRED. If `dataschema` is present, the Consumer MUST use it as the sole schema input and still validate applicable Descriptor selectors. Otherwise, -select the Descriptor's [schema entry][Schema Descriptor Profile]. +select the Descriptor's [schema entry][Schema Descriptor Profile] by the +name in the publication profile. If the profile supplies no name, select +the sole `schema` entry; zero entries means no schema, and multiple entries +are ambiguous. A named entry that is missing or has the wrong class is +invalid. Use the selected schema at its `url` or from its bundled +`document`. + Producers and Descriptor publishers SHOULD supply one schema source or identify the same schema in both. Producers SHOULD omit `dataschema` when the Descriptor supplies the schema. @@ -239,8 +242,6 @@ describes the aggregate object, including both `processData` and `running`. ```json { - "descriptorid": "pump7-state", - "versionid": "1", "entries": { "pump7": { "class": "thingdescription", From 47e7c30262a44a10f90d5de8c1179eca2d2423d2 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 23 Nov 2026 12:16:46 +0100 Subject: [PATCH 50/60] Simplify Descriptor class name constraints Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 12 ++++-------- cloudevents/extensions/descriptor.schema.json | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index 0e0e18772..a808e7597 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -97,9 +97,10 @@ additional members. ##### `class` -REQUIRED. Identifies the kind of information the entry supplies and -determines whether the entry links to a document or carries its information -inline. The same class MAY appear under different entry names. +REQUIRED. A string of 1 to 63 characters, inclusive. It identifies the kind +of information the entry supplies and determines whether the entry links to +a document or carries its information inline. The same class MAY appear +under different entry names. ##### `url` @@ -179,11 +180,6 @@ can also specify how to select entries for a particular use or require a URL that identifies a fixed Descriptor version. Each profile defines the inputs it needs and how to handle unavailable or invalid inputs. -Standard classes use short lowercase alphanumeric tokens starting with a -letter. Other specifications can define their own classes using reverse DNS -names under the defining party's control. A `class` string is at most 63 -characters. - The following `class` values are well-known class names: - `endpoint`: [Endpoint Descriptor profile](#endpoint) diff --git a/cloudevents/extensions/descriptor.schema.json b/cloudevents/extensions/descriptor.schema.json index 417cdaf12..9e103cd02 100644 --- a/cloudevents/extensions/descriptor.schema.json +++ b/cloudevents/extensions/descriptor.schema.json @@ -34,8 +34,8 @@ "properties": { "class": { "type": "string", - "maxLength": 63, - "pattern": "^(?:[a-z][a-z0-9]*|[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+)(?![\\s\\S])" + "minLength": 1, + "maxLength": 63 }, "url": { "$ref": "#/$defs/httpUrl" } } From 278dcbde5f51b65e62863c5d0d144c7f366fec74 Mon Sep 17 00:00:00 2001 From: Marc Date: Tue, 24 Nov 2026 09:51:24 +0100 Subject: [PATCH 51/60] Tighten Descriptor, OPC UA, and OpenUSD prose Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 5 +-- cloudevents/extensions/opcua.md | 51 ++++++++++++---------------- cloudevents/extensions/openusd.md | 4 +-- 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index a808e7597..eeded4c2d 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -79,8 +79,9 @@ replay. Publish a new version when those inputs change. OPTIONAL. An absolute, fragment-free HTTP(S) URL for retrieving a [bundle](#bundled-document) of this Descriptor document. A Descriptor MAY -include `bundleurl` only when the server offers a bundle for it. In a bundle, -`bundleurl`, when present, MUST point to the bundle itself. +include `bundleurl` only if the server supports direct retrieval of that +Descriptor's bundle. If a bundle includes `bundleurl`, the URL MUST point to +the bundle itself. ### `entries` diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index a1cfc63b7..1edb236de 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -519,8 +519,8 @@ The OPC UA-only examples use writer name `energy-consumption-asset` in ### Metadata message -The metadata message helps Cloud applications to understand the semantics and -structure of dataset messages. +Cloud applications use the metadata message to interpret the structure and +meaning of DataSetMessages. ```text ------------------ PUBLISH ------------------- @@ -555,15 +555,13 @@ subject: energy-consumption-asset ### Telemetry message -The telemetry or data messages contain values of all OPC UA nodes that had -changed in a given period of time (`ua-deltaframe`) or contain values for all -OPC UA nodes that were monitored (`ua-keyframe`). -The complete list of monitored OPC UA nodes as well as the related type -information are defined in the metadata message. The attributes -`opcuametadatamajorversion` and `opcuametadataminorversion` are used to -reference the correct metadata message. The `ua-deltaframe` messages will be -used for hot and/or cold path processing and `ua-keyframe` messages can -additional be used to update last-known-value tables. +A `ua-deltaframe` carries values for OPC UA nodes that changed during a +given interval. A `ua-keyframe` carries values for all monitored nodes. +The metadata message lists those nodes and their types. The +`opcuametadatamajorversion` and `opcuametadataminorversion` attributes +identify the corresponding metadata message. Consumers can process delta +frames on the hot path, the cold path, or both, and can use keyframes to +update last-known-value tables. This example uses a writer-specific `source` for sequence ordering without carrying an explicit PublisherId or writer query parameter. @@ -602,9 +600,8 @@ opcuametadataminorversion: 672341762 #### OPC UA PubSub JSON single dataset Message -Using CloudEvents and model the OPC UA PubSub header information as CloudEvent -attributes enables integration into various system (independent from used -protocols) and simplifies the payload structure. +Mapping OPC UA PubSub header fields to CloudEvents attributes simplifies +the payload and lets systems use the same attributes across protocols. ```text { @@ -634,14 +631,13 @@ protocols) and simplifies the payload structure. ### Event message -The event message will contain a single event and the identifier of this event is -added to the `subject` to allow routing it into different systems without parsing -the payload. Events are routed for example in systems like Manufacturing Execution -Systems (MES), Supervisory Control and Data Acquisition systems (SCADA), -Alerting Systems or Operation Technology Operator Terminals (HMI Clients) and -also in hot and/or cold path processing. The attributes -`opcuametadatamajorversion` and `opcuametadataminorversion` are used to -reference the correct metadata message. +The message carries one event. The Producer adds its identifier to +`subject` so systems can route it without parsing the payload. Recipients +include manufacturing execution systems (MES), supervisory control and +data acquisition (SCADA) systems, alerting systems, and operator terminals +(HMI clients). Routing can serve hot-path and cold-path processing. The +`opcuametadatamajorversion` and `opcuametadataminorversion` attributes +identify the corresponding metadata message. ```text ------------------ PUBLISH ------------------- @@ -677,13 +673,10 @@ opcuametadataminorversion: 672341762 ### Telemetry message with different Encoding -One major benefit of CloudEvents for OPC UA is that it is possible to support -other encoding and external schema, while keeping the same OPC UA information for -routing. - -The example below uses Avro binary encoded payload, with the corresponding schema -referenced by `dataschema`. The `source` will be defined by an customer defined -hierarchical path. +CloudEvents carries the same OPC UA routing information when the payload +uses a different encoding and an external schema. Here the payload uses +Avro binary encoding, `dataschema` identifies its schema, and `source` is +a customer-configured hierarchical path. ```text ------------------ PUBLISH ------------------- diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md index 43f34e839..3d1bb53db 100644 --- a/cloudevents/extensions/openusd.md +++ b/cloudevents/extensions/openusd.md @@ -4,8 +4,8 @@ An event reporting pump telemetry can link to the pump's [OpenUSD](https://openusd.org/) asset so a Consumer can locate the pump in a scene. The event's [`describedby`](descriptor.md#describedby) URL points to a [Descriptor](descriptor.md) with a `usdasset` entry. A *prim* is an element -in the OpenUSD scene, such as the object that represents the pump. The -following Descriptor associates the event with the `/Pump7` prim: +in the OpenUSD scene, such as the pump's scene object. This Descriptor +associates the event with the `/Pump7` prim: ```json { From dc3914aa311be5c4ade4c4d4109da4f2feb36d28 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 27 Nov 2026 08:45:37 +0100 Subject: [PATCH 52/60] Define described-entity source identity Signed-off-by: Marc --- cloudevents/extensions/wot.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index bba5b31a3..7645c030f 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -134,6 +134,14 @@ can report a measurement for a pump. CloudEvents event identity and the [Sequence extension](sequence.md) use the event's `source` even when `describedby` changes. +A publication profile MAY declare that `source` identifies the described +entity. When it does, the Producer MUST set `source` to the `entityid` of +the Descriptor for that entity, using the exact string without +normalization. A Consumer MAY use that value to look up the entity +Descriptor where lookup is supported. This is independent of Description +Selection: only the Descriptor at `describedby` supplies Descriptor +entries for interpreting the event. + ### subject [`subject`](../spec.md#subject) is OPTIONAL and retains its Core meaning. From 9764801df9773dfbb522e7829202ab6d3be91abd Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 27 Nov 2026 08:45:39 +0100 Subject: [PATCH 53/60] Align actor and asset source examples Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 2 +- cloudevents/extensions/wot.md | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index eeded4c2d..a2e360f73 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -288,7 +288,7 @@ A maintenance service reports a decision about Pump 7. The event's { "specversion": "1.0", "id": "decision-47", - "source": "urn:example:maintenance-service:planner7", + "source": "urn:example:actor:planner7", "subject": "pump7", "type": "com.example.maintenance.decision.v1", "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-maintenance/versions/1", diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 7645c030f..804bf896e 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -129,8 +129,10 @@ selection rules to check the linked document and selector target. ### source [`source`](../spec.md#source) identifies the event's originating context -and follows Core's URI-reference rules. For example, a telemetry service -can report a measurement for a pump. CloudEvents event identity and the +and follows Core's URI-reference rules. The WoT example uses the reporting +telemetry service as `source`; the [OpenUSD profile example](openusd.md) +uses the asset as `source`. +CloudEvents event identity and the [Sequence extension](sequence.md) use the event's `source` even when `describedby` changes. From 22477ecaad13dd077c03b79148274e2f0ce05255 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 27 Nov 2026 14:20:02 +0100 Subject: [PATCH 54/60] Specify OpenUSD consistency for paired payload fields Signed-off-by: Marc --- cloudevents/extensions/openusd.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md index 3d1bb53db..77f9ef9ce 100644 --- a/cloudevents/extensions/openusd.md +++ b/cloudevents/extensions/openusd.md @@ -106,6 +106,25 @@ The [OpenUSD entry schema](openusd.schema.json) checks entry shape. Consumers using the entry verify path syntax, targets, and pointer uniqueness under the rules above. +### Consistency with OPC 12000 attribute targets + +A publication profile MAY explicitly pair a payload field of a selected +`usdasset` entry with an OPC 12000 OpenUSD attribute target for the same +asset. The profile MUST specify how to identify the corresponding asset and +composed stage. Matching retrieval URLs alone do not establish that identity. + +For each such field with both mappings, the Consumer MUST check that the +mappings refer to the same composed stage and that the prim selected for +the field by the [field mapping rules](#field-mappings) owns the OPC 12000 +target attribute. If the entry declares `primpath`, the Consumer MUST also +check that the prim owning the target attribute is the anchor prim or one +of its descendants. The Consumer MUST report each conflicting field and +leave that field unmapped. + +This check does not apply to unpaired fields, fields missing either mapping, +or other selected assets. It does not change asset selection. Property +writes remain outside the scope of this extension. + ## Examples The following event reports Pump 7 telemetry in HTTP binary mode. Its From b9e3c1f30aea5debf9286edc9bddf706a8908d4a Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 27 Nov 2026 14:20:03 +0100 Subject: [PATCH 55/60] Define inline Descriptor identifier aliases Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 56 ++++++++++++++++++- cloudevents/extensions/descriptor.schema.json | 30 +++++++++- 2 files changed, 83 insertions(+), 3 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index a2e360f73..9a00646c4 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -100,8 +100,8 @@ additional members. REQUIRED. A string of 1 to 63 characters, inclusive. It identifies the kind of information the entry supplies and determines whether the entry links to -a document or carries its information inline. The same class MAY appear -under different entry names. +a document or carries its information inline. Unless the class definition +says otherwise, the same class MAY appear under different entry names. ##### `url` @@ -184,6 +184,7 @@ the inputs it needs and how to handle unavailable or invalid inputs. The following `class` values are well-known class names: - `endpoint`: [Endpoint Descriptor profile](#endpoint) +- `identifiers`: [Identifiers Descriptor profile](#identifiers) - `opcuawriter`: [OPC UA Descriptor profile](opcua.md#descriptor-entry) - `schema`: [Schema Descriptor profile](#schema) - `thingdescription`: [Web of Things profile](wot.md) @@ -203,6 +204,27 @@ A `schema` entry's `url` MUST identify a schema document for the event's An `endpoint` entry's `url` MUST identify the metadata of an xRegistry [Endpoint Group][Endpoint Group]. +### Identifiers + +An `identifiers` entry carries aliases for the described entity inline. +A Descriptor MUST NOT contain more than one entry of this class, regardless +of entry name. Consumers MUST check this limit when validating a Descriptor; +the JSON Schema checks each entry independently. + +The entry MUST omit `url` and `document` and contain an `identifiers` member: +a non-empty array of objects, each with exactly two string members: + +| Member | Meaning | +| --- | --- | +| `scheme` | An [absolute URI][Absolute URI] identifying the identifier scheme. | +| `value` | The identifier in that scheme, represented as a string. | + +Two identifiers match only if both strings match exactly. Consumers MUST +NOT normalize either string, including by changing case or percent-encoding. +Aliases do not replace the xRegistry `entityid` metadata when it is present +or change Descriptor selection through `describedby`. Consumers MUST NOT +use an alias to establish authorization or ownership. + ## Examples ### Bundled endpoint @@ -317,6 +339,35 @@ entry links to the inspection service's xRegistry Endpoint Group. } ``` +### Asset identifiers + +The Descriptor for Pump 7 links to its Thing Description and OpenUSD asset. +The `aliases` entry gives the pump's serial number and site asset tag. The +serial number retains its leading zeros. + +```json +{ + "entries": { + "aliases": { + "class": "identifiers", + "identifiers": [ + { "scheme": "https://manufacturer.example/id/serial", "value": "000147" }, + { "scheme": "https://site.example/id/asset-tag", "value": "Pump-7" } + ] + }, + "geometry": { + "class": "usdasset", + "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2", + "primpath": "/Pump7" + }, + "pump7": { + "class": "thingdescription", + "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" + } + } +} +``` + ## Security Considerations Consumers and bundle endpoints MUST apply authorization, URL, redirect and @@ -347,3 +398,4 @@ If the server cannot establish a combined policy, it MUST send representation, not just its Descriptor metadata. [Endpoint Group]: https://github.com/xregistry/spec/blob/main/endpoint/spec.md +[Absolute URI]: https://www.rfc-editor.org/rfc/rfc3986#section-4.3 diff --git a/cloudevents/extensions/descriptor.schema.json b/cloudevents/extensions/descriptor.schema.json index 9e103cd02..a61574a55 100644 --- a/cloudevents/extensions/descriptor.schema.json +++ b/cloudevents/extensions/descriptor.schema.json @@ -38,7 +38,9 @@ "maxLength": 63 }, "url": { "$ref": "#/$defs/httpUrl" } - } + }, + "if": { "properties": { "class": { "const": "identifiers" } } }, + "then": { "$ref": "#/$defs/identifiersEntry" } }, "schemaEntry": { "$ref": "#/$defs/entry", @@ -54,6 +56,32 @@ "class": { "const": "endpoint" } } }, + "identifiersEntry": { + "type": "object", + "required": ["class", "identifiers"], + "properties": { + "class": { "const": "identifiers" }, + "url": false, + "document": false, + "identifiers": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": ["scheme", "value"], + "additionalProperties": false, + "properties": { + "scheme": { + "type": "string", + "format": "uri", + "pattern": "^[A-Za-z][A-Za-z0-9+.-]*:[^#\\s]*(?![\\s\\S])" + }, + "value": { "type": "string" } + } + } + } + } + }, "document": { "type": "object", "required": ["contenttype"], From d3a18f2ed1bc8e84347a4addb8190979374b5984 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 30 Nov 2026 15:38:37 +0100 Subject: [PATCH 56/60] Clarify Descriptor document and bundle rules Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 52 +++++++++++++++------------- cloudevents/extensions/opcua.md | 2 +- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index 9a00646c4..6171ba988 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -7,7 +7,7 @@ An HTTP `GET` at that URL returns a JSON document called a Descriptor. For example, a maintenance event can set `describedby` to `https://maintenance.example/pump7/versions/1`. The returned Descriptor links -to the inspection service's xRegistry Endpoint Group: +to the inspection service's [xRegistry Endpoint Group][Endpoint Group]: ```json { @@ -20,9 +20,6 @@ to the inspection service's xRegistry Endpoint Group: } ``` -A static HTTP server or an [xRegistry](https://xregistry.io) server can serve -the document. - ## Notational Conventions As with the main [CloudEvents specification](../spec.md), the key words "MUST", @@ -43,14 +40,17 @@ additional members. Whitespace is for readability. ### describedby - Type: `URI` -- Description: The URL of the Descriptor for this event. +- Description: The URL of the Descriptor document for this event. - Constraints: - REQUIRED. - MUST be a non-empty absolute HTTP(S) URL without a fragment. - - The URL MUST support retrieval of the Descriptor by HTTP `GET`. - A successful response serving the Descriptor metadata MUST use + - The URL MUST support retrieval of the Descriptor document by HTTP `GET`. + A successful response serving the Descriptor document MUST use `Content-Type: application/json`. +The hosting implementation is a publisher choice. A static HTTP server or an +[xRegistry](https://xregistry.io) server can serve the document. + ## Descriptor document A Descriptor document MUST be a JSON object with the following structure. @@ -69,7 +69,10 @@ A Descriptor document MUST be a JSON object with the following structure. } ``` -Extensions MAY add members to the document and its entries. +Extensions MAY add members to the top-level JSON object and to individual +entries. Consumers SHOULD ignore extension members they do not recognize +unless the applicable profile or deployment requires them to reject such +members. For a published Descriptor version, the Publisher MUST keep its entries, inline fields, and linked representations stable for the intended use and @@ -78,10 +81,10 @@ replay. Publish a new version when those inputs change. ### `bundleurl` OPTIONAL. An absolute, fragment-free HTTP(S) URL for retrieving a -[bundle](#bundled-document) of this Descriptor document. A Descriptor MAY -include `bundleurl` only if the server supports direct retrieval of that -Descriptor's bundle. If a bundle includes `bundleurl`, the URL MUST point to -the bundle itself. +[bundle](#bundled-document) of this Descriptor document. An unbundled +Descriptor document MAY include `bundleurl` only when the server supports +direct bundle retrieval. A bundle MAY also include `bundleurl`, which MUST +then identify the bundle's own retrieval URL. ### `entries` @@ -101,13 +104,13 @@ additional members. REQUIRED. A string of 1 to 63 characters, inclusive. It identifies the kind of information the entry supplies and determines whether the entry links to a document or carries its information inline. Unless the class definition -says otherwise, the same class MAY appear under different entry names. +says otherwise, the same class MAY appear under multiple entry names. ##### `url` -REQUIRED for entries that link to a document. The value MUST be an absolute, -fragment-free HTTP(S) URL. Entries that supply only inline fields MUST omit -`url`. +OPTIONAL. When present, it MUST be an absolute, fragment-free HTTP(S) URL. +Entries that link to a document MUST include it. Entries that supply only +inline fields MUST omit it. ### Bundled document @@ -120,9 +123,9 @@ later serves a different version. A bundle is an expanded view of a Descriptor. Each entry with a `url` MUST include a `document` member containing the linked document. This lets the Consumer retrieve the directly linked documents in one response. -Inline-only entries and ordinary Descriptor metadata responses MUST omit -`document`. The server MUST NOT automatically follow links from profile -fields or from the linked documents. +The `document` member MUST appear only in bundled entries that have a `url`. +The server MUST NOT automatically follow links from profile fields or from the +linked documents. The server MUST verify authorization and obtain the complete document for every linked entry before returning a successful bundle. If it cannot do so, @@ -161,10 +164,11 @@ bytes. ##### `baseurl` -REQUIRED when an allowed redirect changed the retrieval URL. The value MUST -give the final URL. The entry's `url` stays unchanged. Consumers resolve -format-specific relative links against `baseurl` when present, or the -entry's `url` otherwise. +REQUIRED when an allowed redirect changes the linked document's retrieval URL. +`baseurl` MUST be the final retrieval URL. The entry's `url` stays unchanged. +Consumers resolve relative links inside the embedded document against `baseurl` +when present, or the entry's `url` otherwise. This preserves the resolution +base the document would have after a direct fetch. ### JSON Schema @@ -173,7 +177,7 @@ validation. Under `$defs`, use `metadata` for a Descriptor without embedded documents and `bundle` for a bundle. Schema validation does not replace URL or entry-specific checks. -## Descriptor profiles +## Descriptor entry classes A class definition specifies the representation that HTTP `GET` on an entry's `url` returns, or the fields the entry supplies inline. A profile diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index 1edb236de..ced0ea2cf 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -379,7 +379,7 @@ CloudEvents `source` can carry several such streams. Publishers MUST derive shared values from the native writer and metadata configuration for the emitted message. For an agreed [Descriptor -binding](descriptor.md#descriptor-profiles), they SHOULD store stream-constant +binding](descriptor.md#descriptor-entry-classes), they SHOULD store stream-constant values in an `opcuawriter` entry. An `opcuawriter` entry carries its values inline and MUST omit `url`. When the entry supplies shared inputs, the Descriptor URL MUST identify a fixed version so that replay selects the From 745b9d73b02b47bea96f314210910e93e0ce1e05 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 2 Dec 2026 06:17:35 +0100 Subject: [PATCH 57/60] Flatten CloudEvents Descriptor properties Replace shared entries and bundling with extension-owned properties. Update profile schemas and examples and incorporate inline feedback. Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 389 +++--------------- cloudevents/extensions/descriptor.schema.json | 128 ------ cloudevents/extensions/opcua.md | 113 +++-- cloudevents/extensions/opcua.schema.json | 37 +- cloudevents/extensions/openusd.md | 70 ++-- cloudevents/extensions/openusd.schema.json | 69 ++-- cloudevents/extensions/wot.md | 123 +++--- cloudevents/extensions/wot.schema.json | 38 +- 8 files changed, 298 insertions(+), 669 deletions(-) delete mode 100644 cloudevents/extensions/descriptor.schema.json diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index 6171ba988..330a5aa95 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -1,24 +1,11 @@ # Descriptor Reference -Events can stay small when they link to additional information instead of -carrying it in every message. The Descriptor Reference extension adds -`describedby`, a single URL for information beyond what the event carries. -An HTTP `GET` at that URL returns a JSON document called a Descriptor. +The `describedby` attribute lets a Producer link to information shared by +several events instead of repeating it in each event. An HTTP `GET` of the +URL returns a JSON object called a Descriptor document. -For example, a maintenance event can set `describedby` to -`https://maintenance.example/pump7/versions/1`. The returned Descriptor links -to the inspection service's [xRegistry Endpoint Group][Endpoint Group]: - -```json -{ - "entries": { - "inspection": { - "class": "endpoint", - "url": "https://maintenance.example/endpoints/inspection" - } - } -} -``` +The [examples](#examples) show Descriptor documents for pump telemetry +and asset identifiers. ## Notational Conventions @@ -28,12 +15,8 @@ As with the main [CloudEvents specification](../spec.md), the key words "MUST", described in [RFC 2119](https://tools.ietf.org/html/rfc2119). However, the scope of these key words is limited to when this extension is -used. For example, an attribute being marked as "REQUIRED" does not mean -it needs to be in all CloudEvents, rather it needs to be included only when -this extension is being used. - -In pseudo-JSON examples, `?` marks an OPTIONAL member and `...` stands for -additional members. Whitespace is for readability. +used. An attribute marked as "REQUIRED" needs to be included when the event +uses this extension. ## Attributes @@ -48,175 +31,58 @@ additional members. Whitespace is for readability. A successful response serving the Descriptor document MUST use `Content-Type: application/json`. -The hosting implementation is a publisher choice. A static HTTP server or an +The hosting implementation is a Publisher choice. A static HTTP server or an [xRegistry](https://xregistry.io) server can serve the document. ## Descriptor document -A Descriptor document MUST be a JSON object with the following structure. - -```text -{ - "bundleurl": "", ? - "entries": { - "": { - "class": "", - "url": "", ? - ... - } - }, - ... -} -``` - -Extensions MAY add members to the top-level JSON object and to individual -entries. Consumers SHOULD ignore extension members they do not recognize -unless the applicable profile or deployment requires them to reject such -members. - -For a published Descriptor version, the Publisher MUST keep its entries, -inline fields, and linked representations stable for the intended use and -replay. Publish a new version when those inputs change. - -### `bundleurl` - -OPTIONAL. An absolute, fragment-free HTTP(S) URL for retrieving a -[bundle](#bundled-document) of this Descriptor document. An unbundled -Descriptor document MAY include `bundleurl` only when the server supports -direct bundle retrieval. A bundle MAY also include `bundleurl`, which MUST -then identify the bundle's own retrieval URL. - -### `entries` - -REQUIRED. A map with zero or more members. Each key is an entry name and -its value is an [entry](#entry). - -Entry names are one to 63 lowercase ASCII letters, digits, colons, hyphens, -underscores, or dots, starting with a letter or digit. - -#### Entry - -An entry is a JSON object with the following members. Its class can define -additional members. - -##### `class` - -REQUIRED. A string of 1 to 63 characters, inclusive. It identifies the kind -of information the entry supplies and determines whether the entry links to -a document or carries its information inline. Unless the class definition -says otherwise, the same class MAY appear under multiple entry names. - -##### `url` - -OPTIONAL. When present, it MUST be an absolute, fragment-free HTTP(S) URL. -Entries that link to a document MUST include it. Entries that supply only -inline fields MUST omit it. - -### Bundled document - -A Consumer MAY retrieve an advertised bundle by sending HTTP `GET` to the -supplied `bundleurl`. A successful response at that URL MUST use -`Content-Type: application/json` and contain a bundle of the exact Descriptor -version that advertised that `bundleurl`, even if the original Descriptor URL -later serves a different version. - -A bundle is an expanded view of a Descriptor. Each entry with a `url` -MUST include a `document` member containing the linked document. This -lets the Consumer retrieve the directly linked documents in one response. -The `document` member MUST appear only in bundled entries that have a `url`. -The server MUST NOT automatically follow links from profile fields or from the -linked documents. - -The server MUST verify authorization and obtain the complete document for -every linked entry before returning a successful bundle. If it cannot do so, -it MUST report failure rather than return a partial bundle. If a request to -`bundleurl` fails, the Consumer MAY use the original Descriptor to retrieve -only the entries it needs. This does not select another Descriptor. - -#### `document` - -The `document` object contains `contenttype` and exactly one of `content` -and `contentbase64`. It has the following structure: - -```text -{ - "contenttype": "", - "content": , ? - "contentbase64": "", ? - "baseurl": "" ? -} -``` - -##### `contenttype` - -REQUIRED. The media type of the linked document. Use -`application/octet-stream` if the retrieved document has no media type. - -##### `content` - -The linked document as a JSON value. - -##### `contentbase64` - -The linked document as base64-encoded bytes. Non-JSON representations use -this member. The server MUST decode HTTP content codings before embedding -bytes. - -##### `baseurl` - -REQUIRED when an allowed redirect changes the linked document's retrieval URL. -`baseurl` MUST be the final retrieval URL. The entry's `url` stays unchanged. -Consumers resolve relative links inside the embedded document against `baseurl` -when present, or the entry's `url` otherwise. This preserves the resolution -base the document would have after a direct fetch. - -### JSON Schema - -The [Descriptor JSON Schema](descriptor.schema.json) is available for -validation. Under `$defs`, use `metadata` for a Descriptor without embedded -documents and `bundle` for a bundle. Schema validation does not replace URL -or entry-specific checks. - -## Descriptor entry classes +A Descriptor document MUST be a JSON object. Its top-level property names +MUST be unique within the object. Extensions MAY reserve top-level property +names. An extension that reserves a name specifies the property's value +type and schema, including any nested structure, and defines any selection +rules. The schema can allow any JSON type. For example, an extension that +reserves `age` and defines it as an integer can use `"age": 18`. -A class definition specifies the representation that HTTP `GET` on an -entry's `url` returns, or the fields the entry supplies inline. A profile -can also specify how to select entries for a particular use or require -a URL that identifies a fixed Descriptor version. Each profile defines -the inputs it needs and how to handle unavailable or invalid inputs. +Consumers SHOULD ignore properties they do not recognize, including +extension members within a profile's objects, unless the applicable +profile or deployment requires rejection. Each profile defines which +inputs it needs and how to handle unavailable or invalid inputs. -The following `class` values are well-known class names: +For a published Descriptor version, the Publisher MUST keep its properties +and linked representations stable for the intended use and replay and MUST +publish a new version when those inputs change. -- `endpoint`: [Endpoint Descriptor profile](#endpoint) -- `identifiers`: [Identifiers Descriptor profile](#identifiers) -- `opcuawriter`: [OPC UA Descriptor profile](opcua.md#descriptor-entry) -- `schema`: [Schema Descriptor profile](#schema) -- `thingdescription`: [Web of Things profile](wot.md) -- `thingmodel`: [Web of Things profile](wot.md) -- `usdasset`: [OpenUSD profile](openusd.md#asset-selection) +## Descriptor properties -When a profile needs one entry and its rules leave several candidates, the -Consumer MUST report ambiguity rather than select by map order. +| Property | Definition | +| --- | --- | +| `schema` | [Payload schema](#schema) | +| `endpoint` | [Endpoint Group](#endpoint) | +| `identifiers` | [Entity aliases](#identifiers) | +| `opcua` | [OPC UA writer metadata](opcua.md#descriptor-property) | +| `thingdescription`, `thingmodel` | [Web of Things properties](wot.md#wot-descriptor-properties) | +| `usdasset` | [OpenUSD asset selection](openusd.md#asset-selection) | ### Schema -A `schema` entry's `url` MUST identify a schema document for the event's -`data`. +`schema` is an object. Its REQUIRED `url` MUST be an absolute, +fragment-free HTTP(S) URL of a schema document for the event's `data`. +The OPTIONAL `format` identifies the linked schema's format. When present, +it MUST be a non-empty, case-insensitive string and MUST use the +[xRegistry format identifier][Schema Formats] for formats defined there. +Examples include `JsonSchema/draft-07`, `Avro/1.9`, and `XSD/1.1`. +The profile or binding defines how it uses `schema` and `dataschema`. ### Endpoint -An `endpoint` entry's `url` MUST identify the metadata of an xRegistry -[Endpoint Group][Endpoint Group]. +`endpoint` is an object. Its REQUIRED `url` MUST be an absolute, +fragment-free HTTP(S) URL of an xRegistry [Endpoint Group][Endpoint Group]'s +metadata. ### Identifiers -An `identifiers` entry carries aliases for the described entity inline. -A Descriptor MUST NOT contain more than one entry of this class, regardless -of entry name. Consumers MUST check this limit when validating a Descriptor; -the JSON Schema checks each entry independently. - -The entry MUST omit `url` and `document` and contain an `identifiers` member: -a non-empty array of objects, each with exactly two string members: +`identifiers` is a non-empty array of aliases for the described entity. +Each alias MUST be an object with exactly two string members: | Member | Meaning | | --- | --- | @@ -231,175 +97,44 @@ use an alias to establish authorization or ownership. ## Examples -### Bundled endpoint - -The client retrieves the Descriptor metadata: - -```http -GET /descriptors/inspection-endpoint/versions/1 HTTP/1.1 -Host: static.example -``` - -The response advertises a bundle: - -```http -HTTP/1.1 200 OK -Content-Type: application/json -Connection: close -``` - -```json -{ - "bundleurl": "https://static.example/bundles/inspection-endpoint/1", - "entries": { - "inspection": { - "class": "endpoint", - "url": "https://registry.example/endpoints/inspection" - } - } -} -``` - -The client retrieves the bundle directly from `bundleurl`: - -```http -GET /bundles/inspection-endpoint/1 HTTP/1.1 -Host: static.example -``` - -The response includes the endpoint metadata in the `inspection` entry: - -```http -HTTP/1.1 200 OK -Content-Type: application/json -Connection: close -``` - -```json -{ - "bundleurl": "https://static.example/bundles/inspection-endpoint/1", - "entries": { - "inspection": { - "class": "endpoint", - "url": "https://registry.example/endpoints/inspection", - "document": { - "contenttype": "application/json", - "content": { - "endpointid": "inspection", - "self": "https://registry.example/endpoints/inspection", - "xid": "/endpoints/inspection", - "epoch": 1, - "createdat": "2026-10-29T12:00:00Z", - "modifiedat": "2026-10-29T12:00:00Z", - "usage": ["producer"], - "protocol": "HTTP", - "protocoloptions": { - "endpoints": [ - { "uri": "https://maintenance.example/inspection-requests" } - ] - } - } - } - } - } -} -``` - -### Maintenance decision - -A maintenance service reports a decision about Pump 7. The event's -`describedby` URL identifies the Descriptor for interpreting that decision. - -```json -{ - "specversion": "1.0", - "id": "decision-47", - "source": "urn:example:actor:planner7", - "subject": "pump7", - "type": "com.example.maintenance.decision.v1", - "describedby": "https://registry.example/descriptorgroups/streams/descriptors/pump7-maintenance/versions/1", - "datacontenttype": "application/json", - "data": { - "inspectionNeeded": true - } -} -``` +### Pump telemetry -The `pump7` entry identifies the pump's Thing Description. The `inspection` -entry links to the inspection service's xRegistry Endpoint Group. +The Descriptor points to the pump's Thing Description and the schema for +the reported data. `opcua` supplies the publisher and writer +identifiers for a stream that uses the combined WoT and OPC UA mapping. ```json { - "entries": { + "thingdescription": { "pump7": { - "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - }, - "inspection": { - "class": "endpoint", - "url": "https://registry.example/endpoints/inspection" + "url": "https://devices.example/pump7/td.json", + "affordanceselector": "/properties/processData" } + }, + "schema": { + "url": "https://schemas.example/pump-process-data/versions/3" + }, + "opcua": { + "opcuapublisherid": "UInt16:12", + "opcuadatasetwriterid": 17 } } ``` ### Asset identifiers -The Descriptor for Pump 7 links to its Thing Description and OpenUSD asset. -The `aliases` entry gives the pump's serial number and site asset tag. The +The Descriptor for Pump 7 gives its serial number and site asset tag. The serial number retains its leading zeros. ```json { - "entries": { - "aliases": { - "class": "identifiers", - "identifiers": [ - { "scheme": "https://manufacturer.example/id/serial", "value": "000147" }, - { "scheme": "https://site.example/id/asset-tag", "value": "Pump-7" } - ] - }, - "geometry": { - "class": "usdasset", - "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2", - "primpath": "/Pump7" - }, - "pump7": { - "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0" - } - } + "identifiers": [ + { "scheme": "https://manufacturer.example/id/serial", "value": "000147" }, + { "scheme": "https://site.example/id/asset-tag", "value": "Pump-7" } + ] } ``` -## Security Considerations - -Consumers and bundle endpoints MUST apply authorization, URL, redirect and -content-trust policies before retrieving or using Descriptors or their -representations. An event-provided URL MUST NOT authorize arbitrary network -access or credential forwarding. Implementations SHOULD bound response sizes, -decompression, retrieval time, redirects and dependency processing. - -Read access to a Descriptor does not grant access to its targets. -A bundle does not bypass trust checks. -Versions do not authenticate content or prove unchanged bytes. - -TD security declarations and references to actions are not authenticated -principals, execution grants or current readiness. Device admission and -operation outcomes remain governed by their own protocols and trusted -authorities. - -### Caching - -Consumers can reuse responses under HTTP caching rules. When choosing a cached -response, account for the requested URL, the representation, and the -authorization context. A cache MUST NOT share a representation across -authorization contexts unless the applicable access policy permits it. - -Bundle freshness MUST NOT outlast the Descriptor or any included document. -If the server cannot establish a combined policy, it MUST send -`Cache-Control: no-store`. An `ETag` for a bundle validates the whole -representation, not just its Descriptor metadata. - [Endpoint Group]: https://github.com/xregistry/spec/blob/main/endpoint/spec.md [Absolute URI]: https://www.rfc-editor.org/rfc/rfc3986#section-4.3 +[Schema Formats]: https://github.com/xregistry/spec/blob/main/schema/spec.md#43-schema-formats diff --git a/cloudevents/extensions/descriptor.schema.json b/cloudevents/extensions/descriptor.schema.json deleted file mode 100644 index a61574a55..000000000 --- a/cloudevents/extensions/descriptor.schema.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "CloudEvents Descriptor", - "anyOf": [ - { "$ref": "#/$defs/metadata" }, - { "$ref": "#/$defs/bundle" } - ], - "$defs": { - "descriptor": { - "type": "object", - "required": ["entries"], - "additionalProperties": true, - "properties": { - "bundleurl": { "$ref": "#/$defs/httpUrl" }, - "entries": { - "type": "object", - "propertyNames": { "pattern": "^[a-z0-9][a-z0-9:_.-]{0,62}(?![\\s\\S])" } - } - } - }, - "absoluteUri": { - "type": "string", - "format": "uri", - "pattern": "^[A-Za-z][A-Za-z0-9+.-]*:[^#\\s]+(?![\\s\\S])" - }, - "httpUrl": { - "$ref": "#/$defs/absoluteUri", - "pattern": "^[Hh][Tt][Tt][Pp][Ss]?://(?:[^/?#@\\s]*@)?(?:\\[[^\\]\\s/?#]+\\]|[^\\[\\]:@/?#\\s]+)(?::[0-9]*)?(?=[/?]|(?![\\s\\S]))" - }, - "entry": { - "type": "object", - "required": ["class"], - "additionalProperties": true, - "properties": { - "class": { - "type": "string", - "minLength": 1, - "maxLength": 63 - }, - "url": { "$ref": "#/$defs/httpUrl" } - }, - "if": { "properties": { "class": { "const": "identifiers" } } }, - "then": { "$ref": "#/$defs/identifiersEntry" } - }, - "schemaEntry": { - "$ref": "#/$defs/entry", - "required": ["url"], - "properties": { - "class": { "const": "schema" } - } - }, - "endpointEntry": { - "$ref": "#/$defs/entry", - "required": ["url"], - "properties": { - "class": { "const": "endpoint" } - } - }, - "identifiersEntry": { - "type": "object", - "required": ["class", "identifiers"], - "properties": { - "class": { "const": "identifiers" }, - "url": false, - "document": false, - "identifiers": { - "type": "array", - "minItems": 1, - "items": { - "type": "object", - "required": ["scheme", "value"], - "additionalProperties": false, - "properties": { - "scheme": { - "type": "string", - "format": "uri", - "pattern": "^[A-Za-z][A-Za-z0-9+.-]*:[^#\\s]*(?![\\s\\S])" - }, - "value": { "type": "string" } - } - } - } - } - }, - "document": { - "type": "object", - "required": ["contenttype"], - "properties": { - "contenttype": { "type": "string", "minLength": 1 }, - "baseurl": { "$ref": "#/$defs/httpUrl" }, - "content": {}, - "contentbase64": { - "type": "string", - "contentEncoding": "base64", - "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?(?![\\s\\S])" - } - }, - "oneOf": [{ "required": ["content"] }, { "required": ["contentbase64"] }] - }, - "metadata": { - "$ref": "#/$defs/descriptor", - "properties": { - "entries": { - "additionalProperties": { - "$ref": "#/$defs/entry", - "properties": { "document": false } - } - } - } - }, - "bundle": { - "$ref": "#/$defs/descriptor", - "properties": { - "entries": { - "additionalProperties": { - "$ref": "#/$defs/entry", - "if": { "required": ["url"] }, - "then": { - "required": ["document"], - "properties": { "document": { "$ref": "#/$defs/document" } } - }, - "else": { "properties": { "document": false } } - } - } - } - } - } -} diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index ced0ea2cf..c5050d53d 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -26,17 +26,14 @@ ce-time: 2026-10-29T12:00:00Z When Consumers need metadata shared by a stream, the Producer can use [`describedby`](descriptor.md#describedby) to point to a Descriptor. This -**Processing Descriptor** supplies shared inputs. For example, an inline -`opcuawriter` entry can carry publisher and writer identity: +**Processing Descriptor** supplies shared inputs. For example, the +`opcua` property can carry publisher and writer identity: ```json { - "entries": { - "writer": { - "class": "opcuawriter", - "opcuapublisherid": "UInt16:12", - "opcuadatasetwriterid": 17 - } + "opcua": { + "opcuapublisherid": "UInt16:12", + "opcuadatasetwriterid": 17 } } ``` @@ -104,16 +101,11 @@ or [Avro Schema](https://avro.apache.org/docs/1.11.1/specification/). `dataschema` identifies and versions that schema. A Processing Descriptor MAY supply the schema. The Consumer MUST use -`dataschema` when present. Otherwise, when a Processing Descriptor is -available, select its [schema entry][Schema Descriptor Profile] by the -name in the publication profile. If the profile supplies no name, select -the sole `schema` entry; zero entries means no schema, and multiple entries -are ambiguous. A named entry that is missing or has the wrong class is -invalid. Use the selected schema at its `url` or from its bundled -`document`. - -The Consumer MUST report a missing REQUIRED schema. An ambiguous selection, -invalid selector, unavailable schema or unsupported format MUST NOT cause +`dataschema` when present. Otherwise, if the Processing Descriptor +contains `schema`, use the schema at [`schema.url`][Descriptor Schema]. + +The Consumer MUST report a missing REQUIRED schema. An invalid schema property, +invalid selector, unavailable schema, or unsupported format MUST NOT cause fallback to another schema. If `dataschema` is present, the Consumer MUST still validate applicable Descriptor selectors and use `dataschema` as the sole schema input. Producers and Descriptor @@ -247,7 +239,7 @@ report an error rather than omit it, wrap the value, or report it as _Good_. ## Publisher and Writer Metadata The following names identify the OPC UA Publisher and DataSetWriter -when supplied as `source` query parameters or in an `opcuawriter` entry. +when supplied as `source` query parameters or in `opcua`. The native envelope carries these values under their OPC UA field names. The [combined WoT mapping](#wot-mapping) defines when the identities are REQUIRED; in the OPC UA-only mapping these values are OPTIONAL. @@ -371,36 +363,30 @@ This profile defines Descriptor fields for OPC UA Part 14 Publisher, DataSetWriter, DataSet and ConfigurationVersion metadata. A Processing Descriptor is OPTIONAL. The native envelope and event can also carry inputs. -### Descriptor entry +### Descriptor property A message stream here is a configured flow from one Publisher and DataSetWriter with a defined payload contract. A broker topic or a CloudEvents `source` can carry several such streams. Publishers MUST derive shared values from the native writer and metadata -configuration for the emitted message. For an agreed [Descriptor -binding](descriptor.md#descriptor-entry-classes), they SHOULD store stream-constant -values in an `opcuawriter` entry. An `opcuawriter` entry carries its values -inline and MUST omit `url`. When the entry supplies shared inputs, the -Descriptor URL MUST identify a fixed version so that replay selects the -same inputs. - -A publication profile is the agreed set of rules for interpreting the event. -Use the `opcuawriter` entry named by the publication profile, or the unique -entry of that class if the profile supplies no name. With no name and no -entry, writer metadata is absent from the Descriptor. A Consumer MUST -report a missing or wrong-class named entry or an ambiguous selection and -MUST take Descriptor writer metadata from the selected entry alone. +configuration for the emitted message. When the publication profile uses +a Descriptor for writer metadata, Publishers SHOULD store stream-constant +values in the `opcua` property. The property is a single JSON object +that carries those values inline and MUST omit `url`. When `opcua` +supplies shared inputs, the Descriptor URL MUST identify a fixed version +so that replay selects the same inputs. + +If `opcua` is absent, the Descriptor supplies no writer metadata. +If present, its value MUST conform to the rules below. ### Shared Stream Metadata in a Descriptor -Each member in the following table is OPTIONAL in the entry. The binding -determines which values the event needs. Supply these fields inside the -entry. Report invalid metadata for supplied values that violate this -profile, including null values. Interpret the fields as JSON members of -the entry under their declared types. +Each member in the following table is OPTIONAL in `opcua`. The binding +determines which values the event needs. Report invalid metadata for supplied +values that violate this profile, including null values. -| Member of an `opcuawriter` entry | JSON representation | Meaning and conditions | +| Member of `opcua` | JSON representation | Meaning and conditions | | --- | --- | --- | | `opcuapublisherid` | String | The stream's typed native PublisherId, under the rules in [Publisher and Writer Metadata](#publisher-and-writer-metadata). | | `opcuadatasetwriterid` | Integer, `1` to `65535` | The stream's native DataSetWriterId, when used. | @@ -424,7 +410,7 @@ MinorVersion update rules independently of Descriptor versioning. When `dataschema` or the Descriptor supplies a schema, Producers MUST NOT include metadata-version values in CloudEvents context attributes or the -`opcuawriter` entry. Native fields retained in `data` are unaffected. +`opcua` property. Native fields retained in `data` are unaffected. #### DataSet name @@ -484,8 +470,9 @@ serialization or generated schema MUST preserve those same values, or report an encoding error. For example, use an Avro type wide enough to preserve the full UInt32 range. -The [OPC UA entry schema](opcua.schema.json) checks entry shape. Verify -PublisherId encoding, ranges, and the event context under the rules above. +The [OPC UA JSON Schema](opcua.schema.json) checks `opcua` when +present. Verify PublisherId encoding, ranges, and the event context under +the rules above. ## WoT mapping @@ -502,7 +489,7 @@ precedence over the corresponding OPC UA-only mappings: [`opcuamessagetype`](#opcuamessagetype) rules. - The native PublisherId and at least one of DataSetWriterId and DataSetWriterName are REQUIRED. Supply each value in the envelope, a - `source` query parameter, or the selected `opcuawriter` entry, under + `source` query parameter, or the Descriptor's `opcua` property, under [Publisher and Writer Metadata](#publisher-and-writer-metadata). - Use [`opcuasequence`](#opcuasequence) for the native `SequenceNumber`. If the Producer also supplies CloudEvents `sequence`, it MUST satisfy @@ -742,34 +729,29 @@ opcuasequence: 4294967295 ----------------------------------------------- ``` -The referenced Descriptor version contains these entries: +The referenced Descriptor version contains these properties: ```json { - "entries": { + "thingdescription": { "pump7": { - "class": "thingdescription", - "url": "https://registry.example/thingdescriptiongroups/factory/thingdescriptions/pump7/versions/3.0.0", + "url": "https://devices.example/pump7/td.json", "affordanceselector": "/properties/processData" - }, - "payload": { - "class": "schema", - "url": "https://schemas.example/pump-process-data/versions/3" - }, - "writer": { - "class": "opcuawriter", - "opcuapublisherid": "UInt16:12", - "opcuadatasetwriterid": 17, - "opcuadatasetwritername": "pump7-process", - "opcuadatasetname": "PumpProcessData" } + }, + "schema": { + "url": "https://schemas.example/pump-process-data/versions/3" + }, + "opcua": { + "opcuapublisherid": "UInt16:12", + "opcuadatasetwriterid": 17 } } ``` -The Consumer selects `/properties/processData` from the TD entry and -reads the schema and native identity from the `payload` and `writer` -entries. The event's `subject` is available for filtering. +The Consumer selects `/properties/processData` from the linked TD. It +retrieves the payload schema at `schema.url` and reads the native identity +from `opcua`. The event's `subject` is available for filtering. #### WoT telemetry with a retained NetworkMessage envelope @@ -780,9 +762,9 @@ PublisherId `UInt16:12` as the string `"12"`. `describedby` selects the [WoT example Descriptor](wot.md#web-of-things) for the Thing and affordance. `dataschema` takes precedence over that -Descriptor's schema entry and identifies the envelope's schema. The event -type uses revision `v2` because retaining the envelope changes the payload -contract. +Descriptor's `schema` property and identifies the envelope's schema. The +event type uses revision `v2` because retaining the envelope changes the +payload contract. ```text ------------------ PUBLISH ------------------- @@ -829,7 +811,6 @@ retained DataSetMessage header supplies the native `MessageType`. ## Descriptor Retrieval Security -Follow the [Descriptor Reference security and caching rules](descriptor.md#security-considerations). A Consumer MUST establish trust in the Descriptor before using it as OPC UA metadata. Publisher authentication and authorization to access the TD or schema depend on checks independent of the writer metadata. @@ -843,4 +824,4 @@ schema depend on checks independent of the writer metadata. [UA VersionTime]: https://reference.opcfoundation.org/specs/OPC-10000-4/v1.05.07/7.43 [UA ConfigurationVersion]: https://reference.opcfoundation.org/specs/OPC-10000-14/v1.05.06/6.2.3.2.6 [URI]: https://www.rfc-editor.org/rfc/rfc3986 -[Schema Descriptor Profile]: descriptor.md#schema +[Descriptor Schema]: descriptor.md#schema diff --git a/cloudevents/extensions/opcua.schema.json b/cloudevents/extensions/opcua.schema.json index cd3c1f4b6..1abdbd9f5 100644 --- a/cloudevents/extensions/opcua.schema.json +++ b/cloudevents/extensions/opcua.schema.json @@ -1,23 +1,26 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "CloudEvents OPC UA Descriptor entry", - "$ref": "descriptor.schema.json#/$defs/entry", + "title": "CloudEvents OPC UA Descriptor property", + "type": "object", "properties": { - "class": { "const": "opcuawriter" }, - "url": false, - "document": false, - "opcuapublisherid": { - "type": "string", - "anyOf": [ - { "pattern": "^(?:Byte|UInt16|UInt32|UInt64):[1-9][0-9]*(?![\\s\\S])" }, - { "pattern": "^String:(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,4})(?![\\s\\S])" } - ] - }, - "opcuadatasetwriterid": { "type": "integer", "minimum": 1, "maximum": 65535 }, - "opcuadatasetwritername": { "type": "string", "minLength": 1 }, - "opcuadatasetname": { "type": "string", "minLength": 1 }, - "opcuametadatamajorversion": { "$ref": "#/$defs/versionTime" }, - "opcuametadataminorversion": { "$ref": "#/$defs/versionTime" } + "opcua": { + "type": "object", + "properties": { + "url": false, + "opcuapublisherid": { + "type": "string", + "anyOf": [ + { "pattern": "^(?:Byte|UInt16|UInt32|UInt64):[1-9][0-9]*(?![\\s\\S])" }, + { "pattern": "^String:(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,4})(?![\\s\\S])" } + ] + }, + "opcuadatasetwriterid": { "type": "integer", "minimum": 1, "maximum": 65535 }, + "opcuadatasetwritername": { "type": "string", "minLength": 1 }, + "opcuadatasetname": { "type": "string", "minLength": 1 }, + "opcuametadatamajorversion": { "$ref": "#/$defs/versionTime" }, + "opcuametadataminorversion": { "$ref": "#/$defs/versionTime" } + } + } }, "$defs": { "versionTime": { "type": "integer", "minimum": 0, "maximum": 4294967295 } diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md index 77f9ef9ce..14fc8f57d 100644 --- a/cloudevents/extensions/openusd.md +++ b/cloudevents/extensions/openusd.md @@ -3,15 +3,14 @@ An event reporting pump telemetry can link to the pump's [OpenUSD](https://openusd.org/) asset so a Consumer can locate the pump in a scene. The event's [`describedby`](descriptor.md#describedby) URL points to a -[Descriptor](descriptor.md) with a `usdasset` entry. A *prim* is an element +[Descriptor](descriptor.md) with a `usdasset` property. A *prim* is an element in the OpenUSD scene, such as the pump's scene object. This Descriptor associates the event with the `/Pump7` prim: ```json { - "entries": { + "usdasset": { "geometry": { - "class": "usdasset", "url": "https://assets.example/pump7.usda", "primpath": "/Pump7" } @@ -36,7 +35,7 @@ when the event uses this extension and meets the stated conditions. [`describedby`](descriptor.md#describedby) is REQUIRED to associate an event with an OpenUSD asset through this extension. It identifies the -Descriptor that supplies the asset entries. Core attributes retain their +Descriptor that supplies the asset references. Core attributes retain their CloudEvents meanings. ## Asset selection @@ -44,16 +43,16 @@ CloudEvents meanings. If the Consumer cannot obtain a valid Descriptor at `describedby`, it MUST report the failure and leave the event unassociated with an OpenUSD asset. -An entry with class `usdasset` MUST link to the OpenUSD asset itself at -`url`. The Consumer can use the linked asset or the entry's bundled -`document`. +`usdasset` is a map of local names to asset reference objects. Each object +has a REQUIRED `url`, an absolute, fragment-free HTTP(S) URL of the +OpenUSD asset itself. A publication profile is the agreed set of rules for using the Descriptor. -It MAY select several asset entries. If it needs one, -the Consumer MUST use the exact entry name specified by the profile or the -unique `usdasset` entry if the profile supplies no name. The Consumer MUST -report a missing, invalid, ambiguous, or unavailable asset when needed. It -MUST NOT infer a selection from `subject`, a filename, or entry order. +It MAY name several assets in `usdasset`. Use the exact names specified +by the profile. If the profile needs one asset and supplies no name, the +Consumer MUST select the sole object in the map. The Consumer MUST report +a missing, invalid, ambiguous, or unavailable asset when needed. It +MUST NOT infer a selection from `subject`, a filename, or map order. ### primpath @@ -72,7 +71,7 @@ MUST NOT infer a selection from `subject`, a filename, or entry order. ### Field mappings -A `usdasset` entry can associate individual JSON payload fields with +An asset reference can associate individual JSON payload fields with descendants of the anchor prim. If `fieldmode` or `fieldmappings` is present, `primpath` is REQUIRED. The Consumer MUST derive field associations only from these members. The event-level association still comes from @@ -99,27 +98,27 @@ that field takes precedence. When `fieldmode` is omitted, only explicit mappings apply. Fields with neither kind of match stay unmapped. Mapping an OpenUSD prim to a WoT affordance is outside the scope of this -extension. Resolve asset dependencies under OpenUSD rules even when a -[Descriptor bundle](descriptor.md#bundled-document) supplies the asset. +extension. Resolve asset dependencies under OpenUSD rules. -The [OpenUSD entry schema](openusd.schema.json) checks entry shape. +The [OpenUSD JSON Schema](openusd.schema.json) checks the `usdasset` +property when present. Consumers using the entry verify path syntax, targets, and pointer uniqueness under the rules above. ### Consistency with OPC 12000 attribute targets A publication profile MAY explicitly pair a payload field of a selected -`usdasset` entry with an OPC 12000 OpenUSD attribute target for the same +asset reference with an OPC 12000 OpenUSD attribute target for the same asset. The profile MUST specify how to identify the corresponding asset and composed stage. Matching retrieval URLs alone do not establish that identity. For each such field with both mappings, the Consumer MUST check that the mappings refer to the same composed stage and that the prim selected for the field by the [field mapping rules](#field-mappings) owns the OPC 12000 -target attribute. If the entry declares `primpath`, the Consumer MUST also -check that the prim owning the target attribute is the anchor prim or one -of its descendants. The Consumer MUST report each conflicting field and -leave that field unmapped. +target attribute. If the asset reference declares `primpath`, the Consumer +MUST also check that the prim owning the target attribute is the anchor +prim or one of its descendants. The Consumer MUST report each conflicting +field and leave that field unmapped. This check does not apply to unpaired fields, fields missing either mapping, or other selected assets. It does not change asset selection. Property @@ -146,16 +145,15 @@ ce-describedby: https://registry.example/descriptorgroups/streams/descriptors/pu {"pressure":4.5,"speed":1200,"status":"ok"} ``` -The Descriptor's `geometry` entry uses an xRegistry document-view URL for +The `geometry` object in `usdasset` uses an xRegistry document-view URL for the asset version and selects `/Pump7` in that asset. The stage contains `/Pump7/Sensors/PressureGauge`, `/Pump7/pressure`, and `/Pump7/speed`, but no `/Pump7/status`: ```json { - "entries": { + "usdasset": { "geometry": { - "class": "usdasset", "url": "https://assets.example/usdassetgroups/line1/usdassets/pump7/versions/2", "primpath": "/Pump7", "fieldmode": "byname", @@ -172,10 +170,30 @@ The explicit mapping takes precedence and associates `pressure` with `/Pump7/speed`. The `status` field stays unmapped. Without either field-mapping member, the event would still describe `/Pump7` as a whole. +### One event, two assets + +A publication profile can associate the same pump event with the plant +layout and the detailed assembly by selecting both named objects below. +Each `primpath` resolves in the stage composed from its own asset. + +```json +{ + "usdasset": { + "plant-layout": { + "url": "https://assets.example/plant/layout-v4.usda", + "primpath": "/Plant/Line1/Pump7" + }, + "pump-assembly": { + "url": "https://assets.example/pump7/assembly-v2.usda", + "primpath": "/Pump7" + } + } +} +``` + ## Security Considerations -Follow the [Descriptor retrieval policy](descriptor.md#security-considerations) -for the asset. Authorize access to each dependency separately and apply +Authorize access to the asset and each dependency separately, and apply resource limits during resolution. [Prim Path]: https://openusd.org/release/api/class_sdf_path.html diff --git a/cloudevents/extensions/openusd.schema.json b/cloudevents/extensions/openusd.schema.json index f8e636b8d..d2baa2330 100644 --- a/cloudevents/extensions/openusd.schema.json +++ b/cloudevents/extensions/openusd.schema.json @@ -1,36 +1,51 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "CloudEvents OpenUSD Descriptor entry", - "$ref": "descriptor.schema.json#/$defs/entry", - "required": ["url"], + "title": "CloudEvents OpenUSD Descriptor property", + "type": "object", "properties": { - "class": { "const": "usdasset" }, - "primpath": { - "type": "string", - "pattern": "^/[^/.{}:\\s]+(?:/[^/.{}:\\s]+)*(?![\\s\\S])" - }, - "fieldmode": { "const": "byname" }, - "fieldmappings": { - "type": "array", - "uniqueItems": true, - "items": { - "type": "object", - "required": ["field", "prim"], - "properties": { - "field": { - "type": "string", - "pattern": "^/(?:[^~]|~[01])*(?![\\s\\S])" - }, - "prim": { - "type": "string", - "pattern": "^[^/.{}:\\s]+(?:/[^/.{}:\\s]+)*(?![\\s\\S])" + "usdasset": { + "type": "object", + "additionalProperties": { "$ref": "#/$defs/assetReference" } + } + }, + "$defs": { + "assetReference": { + "type": "object", + "required": ["url"], + "properties": { + "url": { + "type": "string", + "format": "uri", + "pattern": "^[Hh][Tt][Tt][Pp][Ss]?://(?:[^/?#@\\s]*@)?(?:\\[[^\\]\\s/?#]+\\]|[^\\[\\]:@/?#\\s]+)(?::[0-9]*)?(?:[/?][^#\\s]*)?(?![\\s\\S])" + }, + "primpath": { + "type": "string", + "pattern": "^/[^/.{}:\\s]+(?:/[^/.{}:\\s]+)*(?![\\s\\S])" + }, + "fieldmode": { "const": "byname" }, + "fieldmappings": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "object", + "required": ["field", "prim"], + "properties": { + "field": { + "type": "string", + "pattern": "^/(?:[^~]|~[01])*(?![\\s\\S])" + }, + "prim": { + "type": "string", + "pattern": "^[^/.{}:\\s]+(?:/[^/.{}:\\s]+)*(?![\\s\\S])" + } + } } } + }, + "dependentRequired": { + "fieldmode": ["primpath"], + "fieldmappings": ["primpath"] } } - }, - "dependentRequired": { - "fieldmode": ["primpath"], - "fieldmappings": ["primpath"] } } diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 804bf896e..ecb8a991b 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -27,28 +27,26 @@ of Pump 7: An HTTP `GET` of `describedby` returns the following Descriptor. The Consumer resolves the TD at `url` and evaluates `affordanceselector` in it. -The `payload` entry supplies the schema for the object in `data`. +The `schema` property links to the schema for the object in `data`. ```json { - "entries": { + "thingdescription": { "pump7": { - "class": "thingdescription", "url": "https://devices.example/pump7/td.json", "affordanceselector": "/properties/processData" - }, - "payload": { - "class": "schema", - "url": "https://schemas.example/pump-process-data/versions/3" } + }, + "schema": { + "url": "https://schemas.example/pump-process-data/versions/3" } } ``` A *publication profile* is the set of rules, agreed by specification or configuration, that tells Producers and Consumers how to interpret the -event. It can name an entry when a Descriptor contains several entries -of the same class. The example uses the only TD entry. +event. It can select a TD by name when a Descriptor links to several. +The example uses the only TD. ## Notational Conventions @@ -65,35 +63,37 @@ when the event uses this profile and meets the stated conditions. [`describedby`](descriptor.md#describedby) is REQUIRED for this profile. The Consumer MUST use the Descriptor at that URL as the sole source of -Descriptor entries for the event. The publication profile selects the TD -entry by name or, if it supplies no name, by the unique `thingdescription` -entry. A named entry MUST exist and have class `thingdescription`. With -no name, exactly one entry of that class is REQUIRED. +Descriptor properties for the event. The Consumer MUST select the named +object in `thingdescription` if the publication profile supplies a name. +Otherwise, `thingdescription` MUST contain exactly one object, which the +Consumer selects. -Use the selected TD at its `url` or from its bundled `document`. Apply -the entry's [affordance selector](#affordanceselector) to identify the -Thing or affordance. The Publisher MUST make the selected TD available -before configuring Producers to use the Descriptor and SHOULD link to a -specific TD version. +Retrieve the selected TD from its `url`. Apply the selected object's +[affordance selector](#affordanceselector) to identify the Thing or +affordance. The Publisher MUST make the selected TD available before +configuring Producers to use the Descriptor and SHOULD link to a specific +TD version. Correlation fails if `describedby` is missing or invalid, the URL does not yield a valid Descriptor, or the Consumer cannot select the TD entry or resolve its TD or selector. The Consumer MUST report the failure and MAY retain or forward the uncorrelated event. -## WoT Descriptor entries +## WoT Descriptor properties -A TD entry has class `thingdescription`. A [Thing Model][TM] (TM) defines -a reusable model for Things; a TM entry has class `thingmodel`. Both -classes MUST link to the resolved document itself at `url`. For example, -with xRegistry, use the document-view URL. The -[Descriptor rules](descriptor.md#entries) define the entry names. +`thingdescription` is a map of names to objects that link to TDs. +A [Thing Model][TM] (TM) defines a reusable model for Things; +`thingmodel` is a map of names to objects that link to TMs. Names are +local to each map and match exactly. Each object has a REQUIRED `url`, an +absolute, fragment-free HTTP(S) URL of the resolved document itself. +For example, with xRegistry, use the document-view URL. ### affordanceselector -A TD entry MAY include `affordanceselector` to select an affordance. -Omission selects the whole Thing. In a TM entry, this member selects a -model declaration; omission selects no individual declaration. +An object in `thingdescription` MAY include `affordanceselector` to select +an affordance. Omission selects the whole Thing. In `thingmodel`, this +member selects a model declaration; omission selects no individual +declaration. When present, the member MUST be a plain [RFC 6901][JSON Pointer] string of the form `/properties/`, `/actions/`, or `/events/`. @@ -105,24 +105,27 @@ their scope, type, and omission rules. ### Event binding -A TM entry MAY carry `type` to associate an event contract with a TM or -one of its declarations. For a Consumer using this binding, the entry's -`type` MUST match the decoded event `type` exactly. If the publication -profile names a TM entry, only that entry can match. Otherwise, exactly -one match is REQUIRED. The Consumer MUST report missing, ambiguous, or -invalid bindings and unavailable TMs. The concrete TD path and the TM -declaration path can differ; derivation uses the model declaration. +A `thingmodel` object MAY carry `type` to associate an event contract +with a TM or one of its declarations. For a Consumer using this binding, +the object's `type` MUST match the decoded event `type` exactly. If the +publication profile supplies a name, only the named object can match. +Otherwise, exactly one match is REQUIRED. The Consumer MUST report +missing, ambiguous, or invalid bindings and unavailable TMs. The concrete +TD path and the TM declaration path can differ; derivation uses the model +declaration. ### planurl -A TD or TM entry MAY include `planurl`, an absolute, fragment-free -HTTP(S) URL for the projection plan that produced the view at `url`. -The publication profile defines the plan's format. Consumers using the -plan MUST verify that it produced the linked view. The resolved view -remains valid when this OPTIONAL provenance is unavailable. +An object in `thingdescription` or `thingmodel` MAY include `planurl`, an +absolute, fragment-free HTTP(S) URL for the projection plan that produced +the view at `url`. The publication profile defines the plan's format. +Consumers using the plan MUST verify that it produced the linked view. +The resolved view remains valid when this OPTIONAL provenance is +unavailable. -The [WoT entry schema](wot.schema.json) checks entry shape. Apply the -selection rules to check the linked document and selector target. +The [WoT JSON Schema](wot.schema.json) checks the shapes of these properties +when present. Apply the selection rules to check the linked document and +selector target. ## Mapping Core Context Attributes @@ -142,7 +145,7 @@ the Descriptor for that entity, using the exact string without normalization. A Consumer MAY use that value to look up the entity Descriptor where lookup is supported. This is independent of Description Selection: only the Descriptor at `describedby` supplies Descriptor -entries for interpreting the event. +properties for interpreting the event. ### subject @@ -168,7 +171,7 @@ from a governing TM and, for an affordance event, the corresponding model-affordance path. When composition or derivation leaves the mapping ambiguous, the publication configuration MUST select it explicitly. A Producer MUST NOT infer the mapping solely from matching names or select -the first TM link. +a TM link by position. For an eligible HTTPS TM identifier, derive the type as follows: @@ -223,19 +226,15 @@ determines whether an external payload schema is REQUIRED. If `dataschema` is present, the Consumer MUST use it as the sole schema input and still validate applicable Descriptor selectors. Otherwise, -select the Descriptor's [schema entry][Schema Descriptor Profile] by the -name in the publication profile. If the profile supplies no name, select -the sole `schema` entry; zero entries means no schema, and multiple entries -are ambiguous. A named entry that is missing or has the wrong class is -invalid. Use the selected schema at its `url` or from its bundled -`document`. +use the schema at the Descriptor's [`schema.url`][Descriptor Schema] when +`schema` is present. Producers and Descriptor publishers SHOULD supply one schema source or identify the same schema in both. Producers SHOULD omit `dataschema` when the Descriptor supplies the schema. -The Consumer MUST report a missing REQUIRED schema. An ambiguous -selection, invalid selector, unavailable schema, or unsupported format +The Consumer MUST report a missing REQUIRED schema. An invalid schema +property, invalid selector, unavailable schema, or unsupported format MUST NOT cause fallback to another schema. The selected schema MUST describe the actual payload, including its encoding and envelope. For example, a TD URL belongs in `dataschema` only when it identifies the @@ -247,20 +246,19 @@ independently of the TD version. To report the pump's aggregate state, the Producer uses `com.example.models.tm.pump.v1` as `type` and points `describedby` to a -Descriptor whose TD entry omits `affordanceselector`. The schema entry -describes the aggregate object, including both `processData` and `running`. +Descriptor whose TD object omits `affordanceselector`. The `schema` property +links to the schema for the aggregate object, including both `processData` +and `running`. ```json { - "entries": { + "thingdescription": { "pump7": { - "class": "thingdescription", "url": "https://devices.example/pump7/td.json" - }, - "payload": { - "class": "schema", - "url": "https://schemas.example/pump-state/versions/3" } + }, + "schema": { + "url": "https://schemas.example/pump-state/versions/3" } } ``` @@ -273,9 +271,8 @@ sequence counters, and writer identities. ## Security Considerations -Apply the [Descriptor Reference security rules](descriptor.md#security-considerations) -to the Descriptor and its linked documents. Treat context attributes as -Producer-supplied values unless another mechanism authenticates them. +Treat context attributes as Producer-supplied values unless another +mechanism authenticates them. Establish trust and access independently for each document, its model lineage, and its dependencies. Correlating an event with an affordance does not authorize invoking it. @@ -283,4 +280,4 @@ does not authorize invoking it. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 -[Schema Descriptor Profile]: descriptor.md#schema +[Descriptor Schema]: descriptor.md#schema diff --git a/cloudevents/extensions/wot.schema.json b/cloudevents/extensions/wot.schema.json index 7081bba4b..42f600291 100644 --- a/cloudevents/extensions/wot.schema.json +++ b/cloudevents/extensions/wot.schema.json @@ -1,30 +1,38 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "CloudEvents WoT Descriptor entry", - "oneOf": [ - { "$ref": "#/$defs/thingdescription" }, - { "$ref": "#/$defs/thingmodel" } - ], + "title": "CloudEvents WoT Descriptor properties", + "type": "object", + "properties": { + "thingdescription": { + "type": "object", + "additionalProperties": { "$ref": "#/$defs/descriptionLink" } + }, + "thingmodel": { + "type": "object", + "additionalProperties": { "$ref": "#/$defs/modelLink" } + } + }, "$defs": { - "wotEntry": { - "$ref": "descriptor.schema.json#/$defs/entry", + "httpUrl": { + "type": "string", + "format": "uri", + "pattern": "^[Hh][Tt][Tt][Pp][Ss]?://(?:[^/?#@\\s]*@)?(?:\\[[^\\]\\s/?#]+\\]|[^\\[\\]:@/?#\\s]+)(?::[0-9]*)?(?:[/?][^#\\s]*)?(?![\\s\\S])" + }, + "descriptionLink": { + "type": "object", "required": ["url"], "properties": { - "planurl": { "$ref": "descriptor.schema.json#/$defs/httpUrl" }, + "url": { "$ref": "#/$defs/httpUrl" }, + "planurl": { "$ref": "#/$defs/httpUrl" }, "affordanceselector": { "type": "string", "pattern": "^/(?:properties|actions|events)/(?:[^~/]|~[01])+(?![\\s\\S])" } } }, - "thingdescription": { - "$ref": "#/$defs/wotEntry", - "properties": { "class": { "const": "thingdescription" } } - }, - "thingmodel": { - "$ref": "#/$defs/wotEntry", + "modelLink": { + "$ref": "#/$defs/descriptionLink", "properties": { - "class": { "const": "thingmodel" }, "type": { "type": "string", "pattern": "^(?:[A-Za-z_][A-Za-z0-9_]*\\.)*v[1-9][0-9]*(?![\\s\\S])" From 5edf640298378e2abf2f4767fb5888f99c5b141d Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 2 Dec 2026 08:04:07 +0100 Subject: [PATCH 58/60] Address inline feedback on Descriptor profiles Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 8 +- cloudevents/extensions/opcua.md | 170 +++++++++++++++------------ cloudevents/extensions/openusd.md | 38 +++--- cloudevents/extensions/wot.md | 158 +++++++++++++------------ 4 files changed, 199 insertions(+), 175 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index 330a5aa95..fe6625ebe 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -25,8 +25,9 @@ uses this extension. - Type: `URI` - Description: The URL of the Descriptor document for this event. - Constraints: - - REQUIRED. - - MUST be a non-empty absolute HTTP(S) URL without a fragment. + - The Producer MUST include `describedby` when using this extension. + - The Producer MUST supply a non-empty absolute HTTP(S) URL without a + fragment. - The URL MUST support retrieval of the Descriptor document by HTTP `GET`. A successful response serving the Descriptor document MUST use `Content-Type: application/json`. @@ -91,9 +92,6 @@ Each alias MUST be an object with exactly two string members: Two identifiers match only if both strings match exactly. Consumers MUST NOT normalize either string, including by changing case or percent-encoding. -Aliases do not replace the xRegistry `entityid` metadata when it is present -or change Descriptor selection through `describedby`. Consumers MUST NOT -use an alias to establish authorization or ownership. ## Examples diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index c5050d53d..f9af31468 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -4,25 +4,9 @@ This extension lets a Consumer route [OPC UA](https://reference.opcfoundation.org/Core/Part1/v105/docs/) [PubSub](https://reference.opcfoundation.org/Core/Part14/v105/docs/) messages using CloudEvents attributes. A DataSetWriter publishes a -DataSetMessage that carries measurements or an event. In this example, -the CloudEvents `type` identifies a keyframe and `subject` identifies its -writer. The Consumer has the OPC UA metadata for this stream. The HTTP -request uses CloudEvents binary mode: - -```http -POST /events HTTP/1.1 -Host: consumer.example -Content-Type: application/json -Content-Length: 16 -ce-specversion: 1.0 -ce-id: pump7-sample-1 -ce-source: urn:example:pump7 -ce-type: ua-keyframe -ce-subject: pump7-process -ce-time: 2026-10-29T12:00:00Z - -{"Pressure":4.5} -``` +DataSetMessage that carries measurements or an event. The +[HTTP keyframe example](#http-keyframe) shows how `type` identifies a +keyframe and `subject` identifies its writer. When Consumers need metadata shared by a stream, the Producer can use [`describedby`](descriptor.md#describedby) to point to a Descriptor. This @@ -58,7 +42,7 @@ when the event uses this extension and meets the stated conditions. ### id -MUST map to [Network Message +The Producer MUST map `id` to [Network Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.3#Table163) field `MessageId`. @@ -89,20 +73,21 @@ specifies the combined mapping. ### datacontenttype -MUST be `application/json` for OPC UA PubSub JSON payload and MAY be appended with -`+gzip` when the payload is gzip compressed. +The Producer MUST set `datacontenttype` to `application/json` for OPC UA +PubSub JSON payloads and MAY append `+gzip` when the payload is gzip +compressed. ### dataschema PubSub metadata messages carry type information. For non-OPC UA Consumers or alternate encodings such as Avro, a schema based on that metadata is -REQUIRED, for example [JSON Schema](https://json-schema.org/specification) -or [Avro Schema](https://avro.apache.org/docs/1.11.1/specification/). +REQUIRED. `dataschema` identifies and versions that schema. A Processing Descriptor MAY supply the schema. The Consumer MUST use -`dataschema` when present. Otherwise, if the Processing Descriptor -contains `schema`, use the schema at [`schema.url`][Descriptor Schema]. +`dataschema` when present. Otherwise, the Consumer MUST use the schema at +[`schema.url`][Descriptor Schema] if the Processing Descriptor contains +`schema`. The Consumer MUST report a missing REQUIRED schema. An invalid schema property, invalid selector, unavailable schema, or unsupported format MUST NOT cause @@ -129,16 +114,17 @@ field `EventId`. ### time -MUST map to [Data Set Message +The Producer MUST map `time` to [Data Set Message Header](https://reference.opcfoundation.org/Core/Part14/v105/docs/7.2.5.4#Table164) field `Timestamp`. ## Mapping for other extensions The following well-known extension attributes apply to data and event -messages. Determine the native message type from the retained DataSetMessage -`MessageType` field when present. Otherwise, use `opcuamessagetype` for the -WoT mapping or `type` for the non-WoT mapping, as specified above. +messages. The Consumer MUST determine the native message type from the +retained DataSetMessage `MessageType` field when present. Otherwise, the +Consumer MUST use `opcuamessagetype` for the WoT mapping or `type` for the +non-WoT mapping, as specified above. ### sequence @@ -150,19 +136,22 @@ The Producer MUST scope `source` to the writer's ordering scope and format padding the unsigned decimal value to ten digits. The Producer MUST NOT use the counter if a reset, rollover or shared source prevents that ordering. -For events using WoT, see the [combined mapping](#wot-mapping). +The [combined mapping](#wot-mapping) defines `sequence` for events using WoT. ### traceparent -See the [Distributed Tracing extension](./distributed-tracing.md#traceparent). +The [Distributed Tracing extension](./distributed-tracing.md#traceparent) +defines `traceparent`. ### tracestate -See the [Distributed Tracing extension](./distributed-tracing.md#tracestate). +The [Distributed Tracing extension](./distributed-tracing.md#tracestate) +defines `tracestate`. ### recordedtime -See the [Recorded Time extension](./recordedtime.md#recordedtime). +The [Recorded Time extension](./recordedtime.md#recordedtime) defines +`recordedtime`. ## Attributes @@ -198,7 +187,8 @@ payload representations can carry the full native range. - Constraints - OPTIONAL - REQUIRED if status is not _Good_ and `data` omits the native `Status` field - - MAY be omitted if status is _Good_ or `data` retains the native `Status` field + - The Producer MAY omit this attribute if status is _Good_ or `data` + retains the native `Status` field. CloudEvents `Integer` is limited to the signed 32-bit range. If the status to be conveyed in `opcuastatus` cannot be represented, the Producer MUST @@ -214,8 +204,10 @@ report an error rather than omit it, wrap the value, or report it as _Good_. - In combination with the WoT profile, the value is REQUIRED for data and event messages when `data` omits the DataSetMessage `MessageType` field, including when other DataSetMessage header fields are retained. - - MUST NOT be present when `data` includes the DataSetMessage `MessageType`. - - MUST map to the Data Set Message Header `MessageType`. + - The Producer MUST omit this attribute when `data` includes the + DataSetMessage `MessageType`. + - The Producer MUST map this attribute to the Data Set Message Header + `MessageType`. - The value MUST be the native OPC UA message type, such as `ua-keyframe`, `ua-deltaframe` or `ua-event`. @@ -226,15 +218,18 @@ report an error rather than omit it, wrap the value, or report it as _Good_. assigning CloudEvents Sequence extension ordering semantics to it. - Constraints - OPTIONAL - - If present, MUST be a canonical unsigned decimal representation in the - range `0` to `4294967295`, inclusive, with no leading zero except for `0`. + - The Producer MUST use a canonical unsigned decimal representation in + the range `0` to `4294967295`, inclusive, with no leading zero except + for `0`, when supplying this attribute. - In combination with the WoT profile, REQUIRED for keyframe, deltaframe and event messages. - - MUST map to the Data Set Message Header `SequenceNumber`. The + - The Producer MUST map this attribute to the Data Set Message Header + `SequenceNumber`. The [OPC UA JSON mapping][UA DataSetWriterName] defines this field as `UInt32`; the String representation retains the full range of that value. - - MUST NOT be interpreted as a source-wide sequence unless it also - independently satisfies the Sequence extension's requirements. + - The Consumer MUST NOT interpret this attribute as a source-wide + sequence unless it independently satisfies the Sequence extension's + requirements. ## Publisher and Writer Metadata @@ -335,16 +330,16 @@ of [event identity](../spec.md#id) and the [Sequence extension](sequence.md). ## General Constraints -- OPC UA messages MUST use `binary-mode` of CloudEvents. -- OPC UA PubSub JSON messages MUST be encoded using non-reversible encoding as -the decoding information is contained in metadata messages or by schema -referenced via `dataschema` attribute or selected through a Descriptor. +- The Producer MUST use CloudEvents binary mode for OPC UA messages. +- The Producer MUST use non-reversible encoding for OPC UA PubSub JSON + messages. Metadata messages or a schema referenced by `dataschema` or + selected through a Descriptor supply the decoding information. - A Producer MAY retain the full Part 14 NetworkMessage envelope in `data`. Otherwise, the payload MUST omit the NetworkMessage and DataSetMessage headers and supply their applicable information through the mappings in this extension. -- OPC UA PubSub JSON messages MUST contain exactly one DataSetMessage, - including when a full NetworkMessage envelope is retained. +- The Producer MUST include exactly one DataSetMessage in each OPC UA + PubSub JSON message, even when retaining a full NetworkMessage envelope. A Producer MUST supply the REQUIRED CloudEvents attributes and, when the WoT mapping applies, the per-event `opcuasequence` even with a retained @@ -352,7 +347,8 @@ envelope. Native message type conveyance follows [type](#type) and [opcuamessagetype](#opcuamessagetype), according to whether the WoT profile is used and whether the DataSetMessage `MessageType` field is present. -Read the native message type from the DataSetMessage header when present. +The Consumer MUST read the native message type from the DataSetMessage +header when the `MessageType` field is present. Any duplicated native values MUST agree after applying the specified mappings. The Consumer MUST report a conflict and MUST NOT interpret a message as conforming to this extension when they disagree. @@ -383,8 +379,8 @@ If present, its value MUST conform to the rules below. ### Shared Stream Metadata in a Descriptor Each member in the following table is OPTIONAL in `opcua`. The binding -determines which values the event needs. Report invalid metadata for supplied -values that violate this profile, including null values. +determines which values the event needs. The Consumer MUST report invalid +metadata for supplied values that violate this profile, including null values. | Member of `opcua` | JSON representation | Meaning and conditions | | --- | --- | --- | @@ -400,13 +396,15 @@ and Writer Metadata](#publisher-and-writer-metadata). #### Metadata versions -Represent each Descriptor metadata-version field as a JSON integer in the -full `VersionTime` (`UInt32`) range. Consumers MUST compare duplicate -values without narrowing and report out-of-range values as invalid metadata. +The Publisher MUST represent each Descriptor metadata-version field as a +JSON integer in the full `VersionTime` (`UInt32`) range. Consumers MUST +compare duplicate values without narrowing and report out-of-range values +as invalid metadata. Metadata-version values retain their native [ConfigurationVersion][UA -ConfigurationVersion] meaning. Apply Part 14's MajorVersion and -MinorVersion update rules independently of Descriptor versioning. +ConfigurationVersion] meaning. The Publisher MUST apply Part 14's +MajorVersion and MinorVersion update rules independently of Descriptor +versioning. When `dataschema` or the Descriptor supplies a schema, Producers MUST NOT include metadata-version values in CloudEvents context attributes or the @@ -428,10 +426,11 @@ presence requirements for the corresponding field, including those of the combined WoT mapping. A Producer MAY omit the corresponding event attribute or source query parameter. -Apply the [identity consistency rules](#publisher-and-writer-metadata) -across the query, Descriptor, and native envelope. If an event attribute -and the Descriptor both supply a metadata version, their typed values MUST -agree. On a conflict, the Consumer MUST report a metadata conflict and +The Consumer MUST apply the [identity consistency +rules](#publisher-and-writer-metadata) across the query, Descriptor, and +native envelope. If an event attribute and the Descriptor both supply a +metadata version, their typed values MUST agree. On a conflict, the +Consumer MUST report a metadata conflict and treat the event as nonconforming. If a REQUIRED value is absent from all applicable locations, the Consumer MUST report missing metadata and treat the event as nonconforming. @@ -450,8 +449,9 @@ after any Producer is configured with its URL. A change requires a new Descriptor Version and reconfigured Producers. Consumers MUST NOT retain values from a previous Descriptor when processing an event that selects another Descriptor. The OPC UA identifiers determine the writer identity; the -Descriptor version identifies the shared inputs. For a changed WoT payload -contract, apply the [WoT `type` revision rules](wot.md#type). +Descriptor version identifies the shared inputs. The Producer MUST apply +the [WoT `type` revision rules](wot.md#type) when the WoT payload contract +changes. Values that vary by occurrence remain in each event. In particular, the Producer MUST supply `opcuamessagetype`, `opcuasequence`, `opcuastatus`, @@ -467,12 +467,12 @@ support the agreed mapping. JSON integers in this profile preserve the full native ranges. An alternate serialization or generated schema MUST preserve those same values, or report -an encoding error. For example, use an Avro type wide enough to preserve -the full UInt32 range. +an encoding error. For example, an Avro schema needs a type wide enough to +preserve the full UInt32 range. The [OPC UA JSON Schema](opcua.schema.json) checks `opcua` when -present. Verify PublisherId encoding, ranges, and the event context under -the rules above. +present. The Consumer MUST verify PublisherId encoding, ranges, and the +event context under the rules above. ## WoT mapping @@ -483,15 +483,17 @@ metadata. For data and event messages, the following mappings take precedence over the corresponding OPC UA-only mappings: - The Producer MUST use the WoT [`type`](wot.md#type) and - [`subject`](wot.md#subject) mappings. Keep the native `EventId` in the - OPC UA event payload. - Convey the native message type under the + [`subject`](wot.md#subject) mappings. The Producer MUST keep the native + `EventId` in the OPC UA event payload. + The Producer MUST convey the native message type under the [`opcuamessagetype`](#opcuamessagetype) rules. -- The native PublisherId and at least one of DataSetWriterId and - DataSetWriterName are REQUIRED. Supply each value in the envelope, a - `source` query parameter, or the Descriptor's `opcua` property, under +- The Producer MUST supply the native PublisherId and at least one of + DataSetWriterId and DataSetWriterName. The Producer MUST supply each + value in the envelope, a `source` query parameter, or the Descriptor's + `opcua` property, under [Publisher and Writer Metadata](#publisher-and-writer-metadata). -- Use [`opcuasequence`](#opcuasequence) for the native `SequenceNumber`. +- The Producer MUST use [`opcuasequence`](#opcuasequence) for the native + `SequenceNumber`. If the Producer also supplies CloudEvents `sequence`, it MUST satisfy the [Sequence extension](sequence.md) independently. The Producer MUST obtain that value independently of `opcuasequence`. @@ -694,6 +696,26 @@ recordedtime: 2024-03-28T23:59:59Z ----------------------------------------------- ``` +### HTTP keyframe + +This request uses CloudEvents binary mode. The Consumer already has the +OPC UA metadata for this stream. + +```http +POST /events HTTP/1.1 +Host: consumer.example +Content-Type: application/json +Content-Length: 16 +ce-specversion: 1.0 +ce-id: pump7-sample-1 +ce-source: urn:example:pump7 +ce-type: ua-keyframe +ce-subject: pump7-process +ce-time: 2026-10-29T12:00:00Z + +{"Pressure":4.5} +``` + ### WoT and OPC UA telemetry message This binary-mode keyframe uses the WoT event type. Its Descriptor selects @@ -760,7 +782,7 @@ and DataSetWriterId satisfy the identity requirements, so `source` needs no publisher or writer query parameters. Part 14 JSON encodes the configured PublisherId `UInt16:12` as the string `"12"`. -`describedby` selects the [WoT example Descriptor](wot.md#web-of-things) +`describedby` selects the [WoT example Descriptor](wot.md#pump-telemetry-example) for the Thing and affordance. `dataschema` takes precedence over that Descriptor's `schema` property and identifies the envelope's schema. The event type uses revision `v2` because retaining the envelope changes the diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md index 14fc8f57d..b4a2153ff 100644 --- a/cloudevents/extensions/openusd.md +++ b/cloudevents/extensions/openusd.md @@ -48,11 +48,12 @@ has a REQUIRED `url`, an absolute, fragment-free HTTP(S) URL of the OpenUSD asset itself. A publication profile is the agreed set of rules for using the Descriptor. -It MAY name several assets in `usdasset`. Use the exact names specified -by the profile. If the profile needs one asset and supplies no name, the -Consumer MUST select the sole object in the map. The Consumer MUST report -a missing, invalid, ambiguous, or unavailable asset when needed. It -MUST NOT infer a selection from `subject`, a filename, or map order. +It MAY name several assets in `usdasset`. The Consumer MUST use the exact +names specified by the profile. The Consumer MUST select the sole object +in the map if the profile needs one asset and supplies no name. The +Consumer MUST report a missing, invalid, ambiguous, or unavailable asset +when needed. It MUST NOT infer a selection from `subject`, a filename, or +map order. ### primpath @@ -63,9 +64,9 @@ MUST NOT infer a selection from `subject`, a filename, or map order. with that prim and anchors any field mappings. - Constraints: - OPTIONAL. Omission selects the asset as a whole. - - If present, MUST identify an existing prim in that stage. Null, empty, - root (`/`), relative, and property paths are invalid, as are paths - containing variant selections. + - The Publisher MUST identify an existing prim in that stage when it + provides `primpath`. Null, empty, root (`/`), relative, and property + paths are invalid, as are paths containing variant selections. - The Consumer MUST resolve the value as an OpenUSD path. If resolution fails, it MUST report the failure and leave the prim unselected. @@ -85,11 +86,11 @@ string members: | `field` | A non-empty [RFC 6901 JSON Pointer][JSON Pointer] in string form, rooted at CloudEvents `data`. | | `prim` | A relative OpenUSD prim path to an existing descendant of the anchor. Absolute paths, parent traversal (`..`), property paths, and paths containing variant selections are invalid. | -Duplicate `field` pointers are invalid. Apply each mapping independently -of its position in the array. If an event omits a field, skip its mapping -for that event and leave any prior value unchanged. The Consumer MUST -report an invalid mapping or an unresolved explicit prim target and leave -that field unmapped. +Duplicate `field` pointers are invalid. The Consumer MUST apply each +mapping independently of its position in the array. The Consumer MUST +skip the mapping for a field the event omits and leave any prior value +unchanged. The Consumer MUST report an invalid mapping or an unresolved +explicit prim target and leave that field unmapped. The OPTIONAL string `fieldmode` accepts only `"byname"`. In this mode, the Consumer matches each top-level member of a JSON object in `data` to a @@ -98,12 +99,13 @@ that field takes precedence. When `fieldmode` is omitted, only explicit mappings apply. Fields with neither kind of match stay unmapped. Mapping an OpenUSD prim to a WoT affordance is outside the scope of this -extension. Resolve asset dependencies under OpenUSD rules. +extension. The Consumer MUST resolve asset dependencies under OpenUSD +rules. The [OpenUSD JSON Schema](openusd.schema.json) checks the `usdasset` property when present. -Consumers using the entry verify path syntax, targets, and pointer -uniqueness under the rules above. +The Consumer MUST verify path syntax, targets, and pointer uniqueness +under the rules above. ### Consistency with OPC 12000 attribute targets @@ -193,8 +195,8 @@ Each `primpath` resolves in the stage composed from its own asset. ## Security Considerations -Authorize access to the asset and each dependency separately, and apply -resource limits during resolution. +The Consumer MUST authorize access to the asset and each dependency +separately and apply resource limits during resolution. [Prim Path]: https://openusd.org/release/api/class_sdf_path.html [JSON Pointer]: https://www.rfc-editor.org/rfc/rfc6901 diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index ecb8a991b..3558aefa9 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -1,52 +1,13 @@ # Web of Things A Consumer can use a pump's [Web of Things][TD] (WoT) Thing Description -(TD) to identify the property that a telemetry event reports. The event's +(TD) to identify the source and context of an event. The event's [`describedby`](descriptor.md#describedby) URL points to a -[Descriptor](descriptor.md) that links to the TD and can identify an +[Descriptor](descriptor.md) that links to a TD and can identify an interaction in it, called an *affordance*. -For example, this event reports a reading from the `processData` property -of Pump 7: - -```json -{ - "specversion": "1.0", - "id": "sample-4711", - "source": "urn:example:actor:telemetry-service", - "type": "com.example.models.tm.pump.properties.processData.v1", - "subject": "pump7", - "describedby": "https://devices.example/pump7/descriptors/process-data.json", - "datacontenttype": "application/json", - "data": { - "Speed": 1500, - "Pressure": 4.5 - } -} -``` - -An HTTP `GET` of `describedby` returns the following Descriptor. The -Consumer resolves the TD at `url` and evaluates `affordanceselector` in it. -The `schema` property links to the schema for the object in `data`. - -```json -{ - "thingdescription": { - "pump7": { - "url": "https://devices.example/pump7/td.json", - "affordanceselector": "/properties/processData" - } - }, - "schema": { - "url": "https://schemas.example/pump-process-data/versions/3" - } -} -``` - -A *publication profile* is the set of rules, agreed by specification or -configuration, that tells Producers and Consumers how to interpret the -event. It can select a TD by name when a Descriptor links to several. -The example uses the only TD. +The [pump telemetry example](#pump-telemetry-example) shows how a Descriptor +selects the `processData` property of Pump 7. ## Notational Conventions @@ -68,11 +29,11 @@ object in `thingdescription` if the publication profile supplies a name. Otherwise, `thingdescription` MUST contain exactly one object, which the Consumer selects. -Retrieve the selected TD from its `url`. Apply the selected object's -[affordance selector](#affordanceselector) to identify the Thing or -affordance. The Publisher MUST make the selected TD available before -configuring Producers to use the Descriptor and SHOULD link to a specific -TD version. +The Consumer retrieves the selected TD from its `url` and apply the +selected object's [affordance selector](#affordanceselector), if present, +to identify the affordance. The Publisher MUST make the selected TD +available before configuring Producers to use the Descriptor and SHOULD +link to a specific TD version. Correlation fails if `describedby` is missing or invalid, the URL does not yield a valid Descriptor, or the Consumer cannot select the TD entry or @@ -86,7 +47,8 @@ A [Thing Model][TM] (TM) defines a reusable model for Things; `thingmodel` is a map of names to objects that link to TMs. Names are local to each map and match exactly. Each object has a REQUIRED `url`, an absolute, fragment-free HTTP(S) URL of the resolved document itself. -For example, with xRegistry, use the document-view URL. +For example, a Publisher linking to a document in xRegistry supplies the +document-view URL. ### affordanceselector @@ -99,9 +61,9 @@ When present, the member MUST be a plain [RFC 6901][JSON Pointer] string of the form `/properties/`, `/actions/`, or `/events/`. It MUST identify an existing affordance or declaration in the linked document. The Consumer MUST apply only RFC 6901 string-form decoding. -Null, empty, root, and more deeply nested selectors are invalid. Put -profile-defined annotations beside the selector; their profile defines -their scope, type, and omission rules. +Null, empty, root, and more deeply nested selectors are invalid. +The Publisher MUST place profile-defined annotations beside the selector. +The profile defines their scope, type, and omission rules. ### Event binding @@ -123,9 +85,9 @@ Consumers using the plan MUST verify that it produced the linked view. The resolved view remains valid when this OPTIONAL provenance is unavailable. -The [WoT JSON Schema](wot.schema.json) checks the shapes of these properties -when present. Apply the selection rules to check the linked document and -selector target. +The [WoT JSON Schema](wot.schema.json) validates the shapes of these +properties when present. The Consumer MUST apply the selection rules to +check the linked document and selector target. ## Mapping Core Context Attributes @@ -173,17 +135,20 @@ ambiguous, the publication configuration MUST select it explicitly. A Producer MUST NOT infer the mapping solely from matching names or select a TM link by position. -For an eligible HTTPS TM identifier, derive the type as follows: +The Producer MUST follow these steps when deriving the type from an +eligible HTTPS TM identifier: -1. Require an ASCII DNS hostname without empty labels or a trailing root dot. - The identifier cannot contain user information, a port, a query, or a - fragment for this derivation. -2. Lowercase the hostname, reverse its labels, and join them with dots. -3. Append the TM identifier's path, replacing each `/` with `.`. -4. For an affordance event, append the model-affordance JSON Pointer path. - Decode its [RFC 6901][JSON Pointer] token escaping, then replace each `/` +1. The Producer MUST use an identifier with an ASCII DNS hostname + without empty labels or a trailing root dot. The identifier cannot + contain user information, a port, a query, or a fragment. +2. The Producer MUST lowercase the hostname, reverse its labels, and + join them with dots. +3. The Producer MUST append the TM identifier's path, replacing each `/` with `.`. -5. Append the event-contract revision as the final segment. +4. The Producer MUST append the model-affordance JSON Pointer path for + an affordance event. The Producer MUST decode its [RFC 6901][JSON Pointer] + token escaping before replacing each `/` with `.`. +5. The Producer MUST append the event-contract revision as the final segment. For example, TM `https://models.example.com/tm/pump` and model affordance `/properties/processData` with event-contract revision 1 produce: @@ -192,9 +157,9 @@ For example, TM `https://models.example.com/tm/pump` and model affordance com.example.models.tm.pump.properties.processData.v1 ``` -For a whole-Thing event, use the TM-derived type without an affordance path, -then append the revision. The publication profile defines how interaction -data is aggregated into the payload. +The Producer MUST omit the affordance path from the TM-derived type for +a whole-Thing event. The publication profile defines how interaction data +is aggregated into the payload. The publication profile MUST assign the same revision to the same event contract. A Producer MUST use a new revision when the contract changes, @@ -214,8 +179,7 @@ change the payload contract. The Producer MUST configure a valid complete type when the derivation is unavailable, produces an invalid symbol, or collides with a different event contract in the Producer's type namespace. For example, -`/tm/pump.v1` and `/tm/pump/v1` produce the same suffix. Disambiguate -such contracts by configuration. +`/tm/pump.v1` and `/tm/pump/v1` produce the same suffix. ### dataschema and datacontenttype @@ -224,10 +188,10 @@ Core [`dataschema`](../spec.md#dataschema) and media type of `data`. The publication profile or protocol binding determines whether an external payload schema is REQUIRED. -If `dataschema` is present, the Consumer MUST use it as the sole schema -input and still validate applicable Descriptor selectors. Otherwise, -use the schema at the Descriptor's [`schema.url`][Descriptor Schema] when -`schema` is present. +The Consumer MUST use `dataschema` as the sole schema input when present +and MUST still validate applicable Descriptor selectors. Otherwise, the +Consumer MUST use the schema at the Descriptor's +[`schema.url`][Descriptor Schema] when `schema` is present. Producers and Descriptor publishers SHOULD supply one schema source or identify the same schema in both. Producers SHOULD omit `dataschema` @@ -242,6 +206,44 @@ schema for `data` itself. The profile or binding maps an affordance's DataSchema to the wire payload and can require a specific schema version independently of the TD version. +## Pump telemetry example + +This event reports a reading from the `processData` property of Pump 7: + +```json +{ + "specversion": "1.0", + "id": "sample-4711", + "source": "urn:example:actor:telemetry-service", + "type": "com.example.models.tm.pump.properties.processData.v1", + "subject": "pump7", + "describedby": "https://devices.example/pump7/descriptors/process-data.json", + "datacontenttype": "application/json", + "data": { + "Speed": 1500, + "Pressure": 4.5 + } +} +``` + +An HTTP `GET` of `describedby` returns the following Descriptor. The +Consumer resolves the only TD at `url` and evaluates `affordanceselector` +in it. The `schema` property links to the schema for the object in `data`. + +```json +{ + "thingdescription": { + "pump7": { + "url": "https://devices.example/pump7/td.json", + "affordanceselector": "/properties/processData" + } + }, + "schema": { + "url": "https://schemas.example/pump-process-data/versions/3" + } +} +``` + ## Whole-Thing example To report the pump's aggregate state, the Producer uses @@ -271,11 +273,11 @@ sequence counters, and writer identities. ## Security Considerations -Treat context attributes as Producer-supplied values unless another -mechanism authenticates them. -Establish trust and access independently for each document, its model -lineage, and its dependencies. Correlating an event with an affordance -does not authorize invoking it. +The Consumer MUST treat context attributes as Producer-supplied values +unless another mechanism authenticates them. The Consumer MUST establish +trust and access independently for each document, its model lineage, and +its dependencies. Correlating an event with an affordance does not +authorize invoking it. [TD]: https://www.w3.org/TR/wot-thing-description11/ [TM]: https://www.w3.org/TR/wot-thing-description11/#thing-model From 77b60e47c26cabd926cfdb654c1c5809b6260670 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 2 Dec 2026 08:21:47 +0100 Subject: [PATCH 59/60] Clarify event-stream rules in Descriptor extensions Signed-off-by: Marc --- cloudevents/extensions/descriptor.md | 3 +- cloudevents/extensions/opcua.md | 9 ++--- cloudevents/extensions/openusd.md | 41 +++++++--------------- cloudevents/extensions/wot.md | 52 +++++++++++----------------- 4 files changed, 40 insertions(+), 65 deletions(-) diff --git a/cloudevents/extensions/descriptor.md b/cloudevents/extensions/descriptor.md index fe6625ebe..0b50a3593 100644 --- a/cloudevents/extensions/descriptor.md +++ b/cloudevents/extensions/descriptor.md @@ -72,7 +72,8 @@ The OPTIONAL `format` identifies the linked schema's format. When present, it MUST be a non-empty, case-insensitive string and MUST use the [xRegistry format identifier][Schema Formats] for formats defined there. Examples include `JsonSchema/draft-07`, `Avro/1.9`, and `XSD/1.1`. -The profile or binding defines how it uses `schema` and `dataschema`. +The rules for the event stream or the protocol binding define how to use +`schema` and `dataschema`. ### Endpoint diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index f9af31468..aab373772 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -366,10 +366,11 @@ DataSetWriter with a defined payload contract. A broker topic or a CloudEvents `source` can carry several such streams. Publishers MUST derive shared values from the native writer and metadata -configuration for the emitted message. When the publication profile uses -a Descriptor for writer metadata, Publishers SHOULD store stream-constant -values in the `opcua` property. The property is a single JSON object -that carries those values inline and MUST omit `url`. When `opcua` +configuration for the emitted message. When the rules Producers and +Consumers use for the event stream call for a Descriptor to supply writer +metadata, Publishers SHOULD store stream-constant values in the `opcua` +property. The property is a single JSON object that carries those values +inline and MUST omit `url`. When `opcua` supplies shared inputs, the Descriptor URL MUST identify a fixed version so that replay selects the same inputs. diff --git a/cloudevents/extensions/openusd.md b/cloudevents/extensions/openusd.md index b4a2153ff..1a4bf2289 100644 --- a/cloudevents/extensions/openusd.md +++ b/cloudevents/extensions/openusd.md @@ -47,13 +47,14 @@ report the failure and leave the event unassociated with an OpenUSD asset. has a REQUIRED `url`, an absolute, fragment-free HTTP(S) URL of the OpenUSD asset itself. -A publication profile is the agreed set of rules for using the Descriptor. -It MAY name several assets in `usdasset`. The Consumer MUST use the exact -names specified by the profile. The Consumer MUST select the sole object -in the map if the profile needs one asset and supplies no name. The -Consumer MUST report a missing, invalid, ambiguous, or unavailable asset -when needed. It MUST NOT infer a selection from `subject`, a filename, or -map order. +This extension defines the agreed set of rules for using the Descriptor to +associate an event with OpenUSD assets. Producers and Consumers MAY specify +several names in `usdasset` in the rules they use for the event stream. +The Consumer MUST use the exact names those rules specify. The Consumer +MUST select the sole object in the map if it needs one asset and the rules +specify no name. The Consumer MUST report a missing, invalid, ambiguous, +or unavailable asset when needed. It MUST NOT infer a selection from +`subject`, a filename, or map order. ### primpath @@ -107,25 +108,6 @@ property when present. The Consumer MUST verify path syntax, targets, and pointer uniqueness under the rules above. -### Consistency with OPC 12000 attribute targets - -A publication profile MAY explicitly pair a payload field of a selected -asset reference with an OPC 12000 OpenUSD attribute target for the same -asset. The profile MUST specify how to identify the corresponding asset and -composed stage. Matching retrieval URLs alone do not establish that identity. - -For each such field with both mappings, the Consumer MUST check that the -mappings refer to the same composed stage and that the prim selected for -the field by the [field mapping rules](#field-mappings) owns the OPC 12000 -target attribute. If the asset reference declares `primpath`, the Consumer -MUST also check that the prim owning the target attribute is the anchor -prim or one of its descendants. The Consumer MUST report each conflicting -field and leave that field unmapped. - -This check does not apply to unpaired fields, fields missing either mapping, -or other selected assets. It does not change asset selection. Property -writes remain outside the scope of this extension. - ## Examples The following event reports Pump 7 telemetry in HTTP binary mode. Its @@ -174,9 +156,10 @@ member, the event would still describe `/Pump7` as a whole. ### One event, two assets -A publication profile can associate the same pump event with the plant -layout and the detailed assembly by selecting both named objects below. -Each `primpath` resolves in the stage composed from its own asset. +In this example, the rules for the event stream specify both names +below. The Consumer associates the same pump event with the plant layout +and the detailed assembly. Each `primpath` resolves in the stage composed +from its own asset. ```json { diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index 3558aefa9..ba4d1f4d9 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -25,9 +25,9 @@ when the event uses this profile and meets the stated conditions. [`describedby`](descriptor.md#describedby) is REQUIRED for this profile. The Consumer MUST use the Descriptor at that URL as the sole source of Descriptor properties for the event. The Consumer MUST select the named -object in `thingdescription` if the publication profile supplies a name. -Otherwise, `thingdescription` MUST contain exactly one object, which the -Consumer selects. +object in `thingdescription` if the rules Producers and Consumers use for +the event stream specify a name. Otherwise, `thingdescription` MUST contain +exactly one object, which the Consumer selects. The Consumer retrieves the selected TD from its `url` and apply the selected object's [affordance selector](#affordanceselector), if present, @@ -62,15 +62,16 @@ of the form `/properties/`, `/actions/`, or `/events/`. It MUST identify an existing affordance or declaration in the linked document. The Consumer MUST apply only RFC 6901 string-form decoding. Null, empty, root, and more deeply nested selectors are invalid. -The Publisher MUST place profile-defined annotations beside the selector. -The profile defines their scope, type, and omission rules. +The Publisher MUST place any annotations defined for the event stream +beside the selector. The rules for the stream define each annotation's +scope, type, and when it can be omitted. ### Event binding A `thingmodel` object MAY carry `type` to associate an event contract with a TM or one of its declarations. For a Consumer using this binding, the object's `type` MUST match the decoded event `type` exactly. If the -publication profile supplies a name, only the named object can match. +rules for the event stream specify a name, only the named object can match. Otherwise, exactly one match is REQUIRED. The Consumer MUST report missing, ambiguous, or invalid bindings and unavailable TMs. The concrete TD path and the TM declaration path can differ; derivation uses the model @@ -80,7 +81,7 @@ declaration. An object in `thingdescription` or `thingmodel` MAY include `planurl`, an absolute, fragment-free HTTP(S) URL for the projection plan that produced -the view at `url`. The publication profile defines the plan's format. +the view at `url`. The rules for the event stream define the plan's format. Consumers using the plan MUST verify that it produced the linked view. The resolved view remains valid when this OPTIONAL provenance is unavailable. @@ -95,19 +96,7 @@ check the linked document and selector target. [`source`](../spec.md#source) identifies the event's originating context and follows Core's URI-reference rules. The WoT example uses the reporting -telemetry service as `source`; the [OpenUSD profile example](openusd.md) -uses the asset as `source`. -CloudEvents event identity and the -[Sequence extension](sequence.md) use the event's `source` even when -`describedby` changes. - -A publication profile MAY declare that `source` identifies the described -entity. When it does, the Producer MUST set `source` to the `entityid` of -the Descriptor for that entity, using the exact string without -normalization. A Consumer MAY use that value to look up the entity -Descriptor where lookup is supported. This is independent of Description -Selection: only the Descriptor at `describedby` supplies Descriptor -properties for interpreting the event. +telemetry service as `source`. ### subject @@ -118,9 +107,10 @@ retrieval and correlation use the Descriptor selected by `describedby`. ### type Core [`type`](../spec.md#type) identifies the event contract: the payload -representation, members, types, and semantics defined by the publication -profile or protocol binding. Things can share a type when they share a -contract. The dot-separated type supports code generation. +representation, members, types, and semantics. These come from the rules +Producers and Consumers use for the event stream or from the protocol +binding. Things can share a type when they share a contract. The +dot-separated type supports code generation. The type MUST contain one or more segments separated by single dots. Each segment MUST start with an ASCII letter or underscore; the rest can contain @@ -158,10 +148,10 @@ com.example.models.tm.pump.properties.processData.v1 ``` The Producer MUST omit the affordance path from the TM-derived type for -a whole-Thing event. The publication profile defines how interaction data -is aggregated into the payload. +a whole-Thing event. The rules for the event stream define how the +Producer aggregates interaction data into the payload. -The publication profile MUST assign the same revision to the same event +Producers MUST use the same revision for the same event contract. A Producer MUST use a new revision when the contract changes, including when a member is added or removed, a member's type or meaning changes, or the payload envelope changes. This applies even to @@ -185,8 +175,8 @@ event contract in the Producer's type namespace. For example, Core [`dataschema`](../spec.md#dataschema) and [`datacontenttype`](../spec.md#datacontenttype) describe the schema and -media type of `data`. The publication profile or protocol binding -determines whether an external payload schema is REQUIRED. +media type of `data`. The rules for the event stream or the protocol +binding determine whether an external payload schema is REQUIRED. The Consumer MUST use `dataschema` as the sole schema input when present and MUST still validate applicable Descriptor selectors. Otherwise, the @@ -202,9 +192,9 @@ property, invalid selector, unavailable schema, or unsupported format MUST NOT cause fallback to another schema. The selected schema MUST describe the actual payload, including its encoding and envelope. For example, a TD URL belongs in `dataschema` only when it identifies the -schema for `data` itself. The profile or binding maps an affordance's -DataSchema to the wire payload and can require a specific schema version -independently of the TD version. +schema for `data` itself. The rules for the event stream or the protocol +binding map an affordance's DataSchema to the wire payload and can require +a specific schema version independently of the TD version. ## Pump telemetry example From 08705c5aab8983d7c4bb302fdcd1660dd9e6e674 Mon Sep 17 00:00:00 2001 From: Marc Date: Wed, 2 Dec 2026 08:26:05 +0100 Subject: [PATCH 60/60] Clarify WoT projection and Descriptor wording Signed-off-by: Marc --- cloudevents/extensions/opcua.md | 12 ++++++------ cloudevents/extensions/wot.md | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cloudevents/extensions/opcua.md b/cloudevents/extensions/opcua.md index aab373772..bf922e813 100644 --- a/cloudevents/extensions/opcua.md +++ b/cloudevents/extensions/opcua.md @@ -11,7 +11,7 @@ keyframe and `subject` identifies its writer. When Consumers need metadata shared by a stream, the Producer can use [`describedby`](descriptor.md#describedby) to point to a Descriptor. This **Processing Descriptor** supplies shared inputs. For example, the -`opcua` property can carry publisher and writer identity: +`opcua` object can contain Publisher and DataSetWriter identifiers: ```json { @@ -177,7 +177,7 @@ Both event attributes map unsigned [VersionTime][UA VersionTime] to CloudEvents `Integer` (`0` to `2147483647`, inclusive). Producers MUST preserve the value or report an encoding error, without truncation, wrap or signed reinterpretation. Descriptor metadata and applicable native -payload representations can carry the full native range. +payload representations can preserve the full native range. ### opcuastatus @@ -369,10 +369,10 @@ Publishers MUST derive shared values from the native writer and metadata configuration for the emitted message. When the rules Producers and Consumers use for the event stream call for a Descriptor to supply writer metadata, Publishers SHOULD store stream-constant values in the `opcua` -property. The property is a single JSON object that carries those values -inline and MUST omit `url`. When `opcua` -supplies shared inputs, the Descriptor URL MUST identify a fixed version -so that replay selects the same inputs. +property. The property is a single JSON object that contains those values +inline and MUST omit `url`. When `opcua` supplies shared inputs, the +Descriptor URL MUST identify a fixed version so that replay selects the +same inputs. If `opcua` is absent, the Descriptor supplies no writer metadata. If present, its value MUST conform to the rules below. diff --git a/cloudevents/extensions/wot.md b/cloudevents/extensions/wot.md index ba4d1f4d9..ed6b118b3 100644 --- a/cloudevents/extensions/wot.md +++ b/cloudevents/extensions/wot.md @@ -68,7 +68,7 @@ scope, type, and when it can be omitted. ### Event binding -A `thingmodel` object MAY carry `type` to associate an event contract +A `thingmodel` object MAY contain `type` to associate an event contract with a TM or one of its declarations. For a Consumer using this binding, the object's `type` MUST match the decoded event `type` exactly. If the rules for the event stream specify a name, only the named object can match. @@ -80,11 +80,11 @@ declaration. ### planurl An object in `thingdescription` or `thingmodel` MAY include `planurl`, an -absolute, fragment-free HTTP(S) URL for the projection plan that produced -the view at `url`. The rules for the event stream define the plan's format. -Consumers using the plan MUST verify that it produced the linked view. -The resolved view remains valid when this OPTIONAL provenance is -unavailable. +absolute, fragment-free HTTP(S) URL for the WoT projection plan that +produced the WoT view at `url`. The rules for the event stream define the +plan's format. Consumers using the plan MUST verify that it produced the +linked WoT view. The resolved WoT view remains valid when this OPTIONAL +provenance is unavailable. The [WoT JSON Schema](wot.schema.json) validates the shapes of these properties when present. The Consumer MUST apply the selection rules to