You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new CDDL approach uses a CDDL extension point to be more strict about which values are allowed in the Event:data field.
Currently, it's defined as:
; The ProtocolEventBody is any key-value map (e.g., JSON object)
; only the optional trigger field is defined in this document
$ProtocolEventBody /= {
? trigger: text
* text => any
}
; event documents are intended to extend this socket by using:
; NewProtocolSpecificEvents = EventType1 / EventType2 / ... / EventTypeN
; $ProtocolEventBody /= NewProtocolSpecificEvents
However, this effectively still allows just about any JSON object as ProtocolEventBody, as we're just extending the $ProtocolEventBody.
If we want to be (slightly) more strict, we could do something like this:
; main doc
ProtocolEventBodyPrototype = {
? trigger: text
* text => any
}
ProtocolEventBody = ProtocolEventBodyPrototype / $ProtocolEventBodies
; event docs
NewProtocolSpecificEvents = EventType1 / EventType2 / ... / EventTypeN
$ProtocolEventBodies /= NewProtocolSpecificEvents
Alternatively, we can just NOT allow the general form (the ProtocolEventBodyPrototype) and just include that as an example and require event bodies to provide at least 1 defined event.
The text was updated successfully, but these errors were encountered:
The new CDDL approach uses a CDDL extension point to be more strict about which values are allowed in the
Event:data
field.Currently, it's defined as:
However, this effectively still allows just about any JSON object as ProtocolEventBody, as we're just extending the $ProtocolEventBody.
If we want to be (slightly) more strict, we could do something like this:
Alternatively, we can just NOT allow the general form (the
ProtocolEventBodyPrototype
) and just include that as an example and require event bodies to provide at least 1 defined event.The text was updated successfully, but these errors were encountered: