Hello, we have been writing a nodejs abstraction for interacting with the eventstore via http and have had quite an experience learning the nuances thereof. One of the behaviors that was noticed that we would like to bring into question is how the responses should be structured in a scenario where no data or metadata is present on an event.
Currently if an event has data or metadata present then parsed atom json representation of the response for the entry is something to the effect of
{
title,
id,
updated,
author: { name }
summary,
content: {
eventStreamId,
eventNumber,
eventType,
data,
metadata
},
links: [ { uri, relation } ]
}
``
The information embedded in the content provides us something valuable in these cases; in particular the number, type, data and metadata.
However in the case where neither data or metadata is present the response is significantly different by omitting the content
field entirely.
{
title,
id,
updated,
author: { name }
summary,
links: [ { uri, relation } ]
}
``
This inhibits us quite a bit from an event processing standpoint as we lose a lot of value from the context of the event. However we have noticed that some of the content information can be reconstituted from the available atom information if we are so brave as to parse and trust it. For instance we are able to derive the number and stream info by parsing it out of the title
field and the event type information by taking it from the summary
field.
The primary question this leads us to ask is whether or not this behavior is by design and if so what fields in these objects can we reliably count on to provide us information about the events? Since the content
field is only present when an event has been submitted with data or metadata it seems as though we shouldn’t be relying on that field to get the event number, type or stream information from. Conversely it seems counter intuitive to have to parse this information out of the atom fields as they seem quite overloaded for this purpose and there is no promise the format will not change in the future.
Just for a little further context, one of the reasons we use embed
mechanism is because we do not see another way to be able to retrieve the metadata for any particular event via http, the only metadata related operations available are at the stream level. If this is a misconception as well could you please indicate what the appropriate approach would be?