docs: add proposal for basemessage and messagegroups that allows for …#467
Conversation
|
@thirschel-microsoft thanks. We're not quite as formal as this :-) Putting the text you wrote into an issue or PR comment is all that's needed - no need for a formal "proposal" doc that's checked into the repo. The actually PR code-changes should just include the spec-level changes you want made. |
87214c0 to
97bf28d
Compare
No problem, i've updated the PR |
| @@ -33,8 +33,9 @@ | |||
| "attributes": { | |||
| "basemessageurl": { | |||
There was a problem hiding this comment.
Updated
|
@thirschel-microsoft can you sign your commits? (git commit -s) |
…absolute urls Signed-off-by: Tyler Hirschel <thirschel@microsoft.com>
Signed-off-by: Tyler Hirschel <thirschel@microsoft.com>
90c1ef7 to
e6c2033
Compare
|
Signed the commits |
|
This looks good to me. It makes use of the URI concept with target in exactly the way we intended it, and it doesn't block us from introducing a special URI scheme for absolute xids in the future. |
|
|
||
| When the value is a relative reference (begins with `/`), it MUST be a | ||
| valid XID referencing a Resource, or Version, of type `message` within the | ||
| same registry. When the value is an absolute URI, it SHOULD resolve to a |
There was a problem hiding this comment.
I left it as SHOULD in the relative case because the server can verify that the message does exist and can offer validation. That same validation isn't available to the server if it is an external link.
If we feel the language here is better as MUST I will change it
There was a problem hiding this comment.
We'll discuss it on tomorrow's call,but I'm leaning towards making it a MUST. Even though specs often try to avoid hard requirements for things that can't be tested, I'm uncomfortable with someone using the wiggle-room to put something else at the URI other than a msgDef as an extension.
There was a problem hiding this comment.
Yeah that point makes sense. Updated. Just let me know if you want it changed back based on the discussion
| as defined by this specification. | ||
| - If the value is a relative reference, it MUST be a valid `xid` of a | ||
| Resource, or Version, of type `message` as defined by this specification. | ||
| - If the value is an absolute URI, it SHOULD point to a message definition |
There was a problem hiding this comment.
same question here, why not MUST since when it's an XID it's a MUST?
There was a problem hiding this comment.
Updated
|
LGTM just a few minor questions |
Signed-off-by: Tyler Hirschel <thirschel@microsoft.com>
Signed-off-by: Tyler Hirschel <thirschel@microsoft.com>
|
|
||
| When the value is a relative reference (begins with `/`), it MUST be a | ||
| valid XID referencing a Resource, or Version, of type `message` within the | ||
| same registry. When the value is an absolute URI, it MUST resolve to a |
There was a problem hiding this comment.
Per our call today, we're ok with MUST but let's change "resolve to" to "point to" so we don't imply that ALL clients need to be able to resolve it. There may be other spots where we need to make this change too
There was a problem hiding this comment.
Updated
Signed-off-by: Tyler Hirschel <thirschel@microsoft.com>
|
Approved on the 5/21 call - with minor tweaks |
Proposal: Change
basemessageandmessagegroupsfrom XID to URI-ReferenceSummary
Change two attributes from
Type: XID(same-registry only) toType: URI-reference(relative XIDs and absolute URIs):basemessageon Message definitions, enabling cross-registry messageinheritance.
messagegroupson Endpoint definitions, enabling endpoints to referenceMessageGroups in external registries.
Both changes remain fully backward compatible.
Motivation
basemessageenables message inheritance with deep-merge semantics: a derivedmessage references a base and shadows specific properties.
messagegroupsonendpoints references the MessageGroups whose messages the endpoint handles.
Both attributes are currently typed as XID, restricting references to the same
registry. In multi-registry environments, message contracts defined in one
registry are consumed by endpoints in another. The XID restriction forces
either duplicating definitions across registries or using ad-hoc workarounds.
Why These Changes Are Safe
Backward Compatible
Every existing
basemessagevalue is a relative XID (e.g.,/messagegroups/group1/messages/msg1). Every existingmessagegroupsentryis a relative XID (e.g.,
/messagegroups/mygroup). Under the new type:/are validated as XIDs with thetargetconstraint, which is identical behavior to today.No existing data or behavior changes.
Consistent with Existing Patterns
The message spec already uses this exact pattern for schema references:
dataschemaxidxiddataschemauriuribasemessage(current)xidbasemessage(proposed)uri-referencemessagegroupsitems (current)xidmessagegroupsitems (proposed)uri-referenceThe
dataschemauri/dataschemaxidpair is the existing precedent: URI typefor cross-registry references, XID for same-registry validation.
Dangling References Already Permitted
The spec states: "If the referenced message can not be found then an error
MUST NOT be generated, dangling references are permitted."
An absolute URI to an unreachable external registry is equivalent to
a dangling XID reference. The existing error handling covers this.
Resolution Is Client-Side
The spec says: "The processing that a client SHOULD take to materialize
the message..." Materialization is a client responsibility. The server stores
the reference; the client resolves it. Whether the target is a local XID or an
external URI is a client concern.
The Model Already Uses URI
The model.json already defines
basemessageurlastype: "uri". Thisproposal aligns the spec prose with the model.
Core Spec Infrastructure Exists
The core model spec (core/model.md:243-247) defines the behavior:
Relative references are validated as XIDs; absolute URIs pass through
unconstrained. This mechanism is already in place.
Server Behavior
basemessage/messagegroups/g1/messages/m1/messagegroups/messages[/versions]. Store. May resolve locally for inline expansion.https://other.registry/messagegroups/g1/messages/m1/notavalidpathmalformed_xid(same as today)/messagegroups/deleted/messages/gonemessagegroups/messagegroups/mygroup/messagegroups/messages. Store. Resolve locally for inline expansion.https://other.registry/messagegroups/external/notavalidpathmalformed_xid(same as today)/messagegroups/deletedClient Behavior
Example: Cross-Registry Message Inheritance
Registry A (
https://catalog-a.example.com) defines base CloudEvents messages.Registry B (
https://catalog-b.example.com) defines endpoint-specific variants.Base message in Registry A
{ "messageid": "com.xyz.orders.created", "envelope": "CloudEvents/1.0", "envelopemetadata": { "type": { "value": "com.xyz.orders.created", "required": true } }, "dataschemaformat": "Avro/1.12.0", "dataschemauri": "/schemagroups/com.xyz.orders/schemas/com.xyz.orders.created" }Derived message in Registry B (endpoint-specific override)
{ "messageid": "com.xyz.orders.created.eventhubs", "basemessage": "https://catalog-a.example.com/messagegroups/com.xyz.orders/messages/com.xyz.orders.created", "envelope": "CloudEvents/1.0", "protocoloptions": { "messagemappings": { "headers": { "ce-source": { "value": "/xyz/order-service" } } } } }The client fetches the base from Registry A, performs the deep-merge, and
produces a materialized message with the original schema reference plus the
endpoint-specific header mapping.
Registry B's server never contacts Registry A. It stores the absolute URI.
The client resolves it using its own credentials.