Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 57 additions & 46 deletions cloudevents/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ endpoint with a single, embedded message definition using an embedded Protobuf
{
"$schema": "https://cloudevents.io/schemas/registry",
"specversion": "1.0-rc4",
"registryid": "Example Registry",
"self": "http://example.com",
"registryid": "example-registry",
"self": "https://example.com",
"xid": "/",
"epoch": 4,
"createdat": "2024-04-30T12:00:00Z",
Expand All @@ -137,17 +137,14 @@ endpoint with a single, embedded message definition using an embedded Protobuf
"createdat": "2024-04-30T12:00:00Z",
"modifiedat": "2024-04-31T12:00:00Z",

"usage": "consumer",
"format": "CloudEvents/1.0",

"config": {
"protocol": "MQTT/5.0",
"usage": [ "consumer" ],
"envelope": "CloudEvents/1.0",
"protocol": "MQTT/5.0",
"protocoloptions": {
"endpoints": [
{ "uri": "mqtt://mqtt.example.com:1883" }
],
"options": {
"topic": "{deviceid}/telemetry"
}
"topic": "{deviceid}/telemetry"
},

"messagesurl": "https://example.com/endpoints/com.example.telemetry/messages",
Expand All @@ -165,8 +162,8 @@ endpoint with a single, embedded message definition using an embedded Protobuf
"modifiedat": "2024-04-31T12:00:00Z",
"ancestorid": "1.0",

"format": "CloudEvents/1.0",
"metadata": {
"envelope": "CloudEvents/1.0",
"envelopemetadata": {
"id": {
"type": "string",
"required": true
Expand All @@ -187,7 +184,7 @@ endpoint with a single, embedded message definition using an embedded Protobuf
}
},

"dataschemaformat": "Protobuf/3.0",
"dataschemaformat": "Protobuf/3",
"dataschema": "syntax = \"proto3\"; message Metrics { float metric = 1; }",
"datacontenttype": "application/x-protobuf",

Expand All @@ -210,8 +207,8 @@ other scenarios:
{
"$schema": "https://cloudevents.io/schemas/registry",
"specversion": "1.0-rc4",
"registryid": "Example Registry",
"self": "http://example.com",
"registryid": "example-registry",
"self": "https://example.com",
"xid": "/",
"epoch": 4,
"createdat": "2024-04-30T12:00:00Z",
Expand All @@ -228,17 +225,14 @@ other scenarios:
"createdat": "2024-04-30T12:00:00Z",
"modifiedat": "2024-04-31T12:00:00Z",

"usage": "consumer",
"format": "CloudEvents/1.0",

"config": {
"protocol": "MQTT/5.0",
"usage": [ "consumer" ],
"envelope": "CloudEvents/1.0",
"protocol": "MQTT/5.0",
"protocoloptions": {
"endpoints": [
{ "uri": "mqtt://mqtt.example.com:1883" }
{ "uri": "mqtt://mqtt.example.com:1883" }
],
"options": {
"topic": "{deviceid}/telemetry"
}
"topic": "{deviceid}/telemetry"
},

"messagegroups": [ "#/messagegroups/com.example.telemetryEvents" ],
Expand All @@ -265,17 +259,17 @@ other scenarios:
"com.example.telemetry": {
"messageid": "com.example.telemetry",
"versionid": "1.0",
"self": "https://example.com/endpoints/com.example.telemetry/messages/com.example.telemetry",
"xid": "/endpoints/com.example.telemetry/messages/com.example.telemetry",
"self": "https://example.com/messagegroups/com.example.telemetryEvents/messages/com.example.telemetry",
"xid": "/messagegroups/com.example.telemetryEvents/messages/com.example.telemetry",
"epoch": 5,
"isdefault": true,
"description": "device telemetry event",
"createdat": "2024-04-30T12:00:00Z",
"modifiedat": "2024-04-31T12:00:00Z",
"ancestorid": "1.0",

"format": "CloudEvents/1.0",
"metadata": {
"envelope": "CloudEvents/1.0",
"envelopemetadata": {
"id": {
"type": "string",
"required": true
Expand All @@ -296,13 +290,13 @@ other scenarios:
}
},

"dataschemaformat": "Protobuf/3.0",
"dataschemauri": "#/schemagroups/com.example.telemetry/schemas/com.example.telemetrydata/versions/1.0",
"dataschemaformat": "Protobuf/3",
"dataschemauri": "#/schemagroups/com.example.telemetry/schemas/com.example.telemetrydata/versions/1.0:Metrics",
"datacontenttype": "application/x-protobuf",

"metaurl": "https://example.com/endpoints/com.example.telemetry/messages/com.example.telemetry/meta",
"metaurl": "https://example.com/messagegroups/com.example.telemetryEvents/messages/com.example.telemetry/meta",

"versionsurl": "https://example.com/endpoints/com.example.telemetry/messages/com.example.telemetry/versions",
"versionsurl": "https://example.com/messagegroups/com.example.telemetryEvents/messages/com.example.telemetry/versions",
"versionscount": 1
}
}
Expand Down Expand Up @@ -335,29 +329,46 @@ other scenarios:
"modifiedat": "2024-04-31T12:00:00Z",
"ancestorid": "1.0",

"format": "Protobuf/3.0",
"format": "Protobuf/3",
"schema": "syntax = \"proto3\"; message Metrics { float metric = 1;}",

"metaurl": "https://example.com/schemagroups/com.example.telemetry/schemas/com.example.telemetrydata/meta",

"versionscount": 1,
"versionsurl": "https://example.com/schemagroups/com.example.telemetry/schemas/com.example.telemetrydata/versions"
"versionsurl": "https://example.com/schemagroups/com.example.telemetry/schemas/com.example.telemetrydata/versions",
"versions": {
"1.0": {
"versionid": "1.0",
"self": "https://example.com/schemagroups/com.example.telemetry/schemas/com.example.telemetrydata/versions/1.0",
"xid": "/schemagroups/com.example.telemetry/schemas/com.example.telemetrydata/versions/1.0",
"format": "Protobuf/3",
"schema": "syntax = \"proto3\"; message Metrics { float metric = 1;}"
}
}
}
}
}
}
}
```

The shared layout includes the selected Schema Version so that its local
reference can be followed within the document. The `:Metrics` suffix selects
the Protobuf message declaration using the existing
[Protobuf reference rule](../schema/spec.md#434-protobuf-schema).
Other server-managed attributes of that Version are omitted.

If we assume the message definitions and schemas to reside at an API endpoint,
an endpoint definition might just reference the associated message definition
group with a deep link to the respective object in the service:
group with a deep link to the respective object in the service. This
illustration abbreviates the protocol options using the comment notation
defined above:

```json
{
"$schema": "https://cloudevents.io/schemas/registry",
"specversion": "1.0-rc4",
"registryid": "Example Registry",
"registryid": "example-registry",

"endpointsurl": "https://example.com/endpoints",
"endpointscount": 1,
Expand All @@ -370,10 +381,10 @@ group with a deep link to the respective object in the service:
"createdat": "2024-04-30T12:00:00Z",
"modifiedat": "2024-04-31T12:00:00Z",

"usage": "consumer",
"format": "CloudEvents/1.0",

"config": {
"usage": [ "consumer" ],
"envelope": "CloudEvents/1.0",
"protocol": "MQTT/5.0",
"protocoloptions": {
# ... details ...
},

Expand All @@ -386,13 +397,13 @@ group with a deep link to the respective object in the service:
If the message definitions and schemas are stored in a file-based registry,
including files shared via public version control repositories, the reference
link will first reference the file and then the object within the file, using
[JSON Pointer][JSON Pointer] syntax:
[JSON Pointer][JSON Pointer] syntax. Protocol options are again abbreviated:

```yaml
{
"$schema": "https://cloudevents.io/schemas/registry",
"specversion": "1.0-rc4",
"registryid": "Example Registry",
"registryid": "example-registry",

"endpointsurl": "https://example.com/endpoints",
"endpointscount": 1,
Expand All @@ -405,10 +416,10 @@ link will first reference the file and then the object within the file, using
"createdat": "2024-04-30T12:00:00Z",
"modifiedat": "2024-04-31T12:00:00Z",

"usage": "consumer",
"format": "CloudEvents/1.0",

"config": {
"usage": [ "consumer" ],
"envelope": "CloudEvents/1.0",
"protocol": "MQTT/5.0",
"protocoloptions": {
# ... details ...
},

Expand Down
27 changes: 27 additions & 0 deletions tools/issue636/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# CloudEvents prose layout checks

<!-- words: pytest py cacheprovider SDK jsonpointer -->

`test_cloudevents_examples_636.py` reads the actual four concrete/projection
examples in the [CloudEvents specification](../../cloudevents/spec.md).
The first two are strictly parsed as complete JSON with duplicate-key
rejection. The two explicitly abbreviated remote-reference illustrations are
parsed as YAML because they retain the document's declared comment notation.
The final placeholder-only format sketch is not treated as a Registry.

```shell
python -B -m pytest tools/issue636 -q -p no:cacheprovider
```

The checks inspect native domain fields, scalar/array kinds, map-key/ID
agreement, parent-derived self/XID/Meta/Versions navigation, and compact versus
shared layouts. The existing Protobuf selector rule is exercised with
`jsonpointer` against the shown local Schema Version, followed by a check for
the selected declaration in that example's simple schema literal. This is not
a general Protobuf parser or a new selector grammar.

Timestamps are intentionally opaque here; the separate date correction is
issue 638. These tests do not validate all Core/model constraints, schema
identifiers, or unresolved domain-model defects, and do not fetch remote
references. They are abstract/source evidence, not real server/SDK
interoperability. Scenario samples covered by earlier work are not changed.
Loading
Loading