Repository navigation
Add Descriptor references and WoT/OPC UA CloudEvents mappings #1406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e5daf06
1418500
0f0c219
83539d5
e6856c2
2cc6898
a06d523
fb77f3a
6842f78
b3784a2
8552ac4
67f6198
d9c6527
376091f
47ad438
36411e0
6f3f097
88e6152
4ad755a
d7e4c23
a51945b
d997746
b56c272
a1a9883
3fb6540
0f6537f
0f58777
2b122bb
1c4caca
75c2fa8
dde5187
ae46cce
32e9d72
db8dd33
7c07c4c
8850c32
50f93bf
ae6fb09
aa61647
f6c5f1d
89ffe91
00433c9
b782353
7485bad
6ac67d4
1270546
b13b194
794d90b
d9b06dc
47e7c30
278dcbd
dc3914a
9764801
22477ec
b9e3c1f
d3a18f2
745b9d7
5edf640
77b60e4
08705c5
7536d01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| # Descriptor Reference | ||
|
|
||
| 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. | ||
|
|
||
| The [examples](#examples) show Descriptor documents for pump telemetry | ||
| and asset identifiers. | ||
|
|
||
| ## 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). | ||
|
|
||
| However, the scope of these key words is limited to when this extension is | ||
| used. An attribute marked as "REQUIRED" needs to be included when the event | ||
| uses this extension. | ||
|
|
||
| ## Attributes | ||
|
|
||
| ### describedby | ||
|
|
||
| - Type: `URI` | ||
| - Description: The URL of the Descriptor document for this event. | ||
| - Constraints: | ||
| - 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`. | ||
|
|
||
| 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. 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`. | ||
|
|
||
| Consumers SHOULD ignore properties they do not recognize, including | ||
| extension members within a profile's objects, unless the applicable | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's drop the word "profile" (and "member") since you never really define it, and I think it would easier to not define a new term and instead just refer to it as you already have been... e.g. "property". I think we can just stop there because the SHOULD implies they can reject if it they need to and we don't define how they know that and, more importantly, we don't say what to do if they do reject it. All of that is out of scope for us. |
||
| profile or deployment requires rejection. Each profile defines which | ||
| inputs it needs and how to handle unavailable or invalid inputs. | ||
|
|
||
| For a published Descriptor version, the Publisher MUST keep its properties | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we can say MUST in these two spots - that could imply "forever". Let's either use SHOULD or talk about how it's "STRONGLY RECOMMENDED". |
||
| and linked representations stable for the intended use and replay and MUST | ||
| publish a new version when those inputs change. | ||
|
|
||
| ## Descriptor properties | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need an intro sentence for this section. Something like: |
||
| | Property | Definition | | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you may want to include, in the section that fully defines each, a pseudo json showing the format for each - at least in the non-scalar cases, and a concrete example. Keeping it short, of course. |
||
| | --- | --- | | ||
| | `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 | ||
|
duglin marked this conversation as resolved.
Resolved
|
||
|
|
||
| `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, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What "format" attribute? is this old? I think we may need to explain why this is here since CE itself defines a schema URL attribute. If we keep it, and I'm not sure we should, then we should make it clear that this would probably only be used when |
||
| 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 rules for the event stream or the protocol binding define how to use | ||
| `schema` and `dataschema`. | ||
|
|
||
| ### Endpoint | ||
|
|
||
| `endpoint` is an object. Its REQUIRED `url` MUST be an absolute, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's just a URL not an object, right? |
||
| fragment-free HTTP(S) URL of an xRegistry [Endpoint Group][Endpoint Group]'s | ||
| metadata. | ||
|
|
||
| ### Identifiers | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think more info is needed here to explain when this one should be used - it's too generic to just say it's an alias. |
||
|
|
||
| `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 | | ||
| | --- | --- | | ||
| | `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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 strings? |
||
| NOT normalize either string, including by changing case or percent-encoding. | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't you missing the definition of the other ones? |
||
| ## Examples | ||
|
|
||
| ### Pump telemetry | ||
|
|
||
| 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 | ||
| { | ||
| "thingdescription": { | ||
| "pump7": { | ||
| "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 gives its serial number and site asset tag. The | ||
| serial number retains its leading zeros. | ||
|
|
||
| ```json | ||
| { | ||
| "identifiers": [ | ||
| { "scheme": "https://manufacturer.example/id/serial", "value": "000147" }, | ||
| { "scheme": "https://site.example/id/asset-tag", "value": "Pump-7" } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| [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 | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a sample Descriptor doc near this first paragraph. Having a concrete doc to look at will help people grok it. In fact, I think it would be good to show the format and the a sample.
e.g.
Pseudo-json:
Where
NAMEand a non-empty string andANYis any valid JSON data type.And the doc MAY contain zero or more properties.
Example: