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
{{ message }}
Repository navigation
SHOULD throw if extension attributes are NOT following naming convention? #380
Describe the Bug
Extension attributes NOT following the naming convention (lowercase) are added to the event (no error thrown) but their value is added as undefined.
Expected Behavior
I assume according to spec an error should be thrown if attributes not following the naming convention are passed. Alternatively, if they are still accepted, their value should be passed on to the event correctly.
Additional context
If decided to still pass the extension attribute, I think the problem lies somewhere here:
header has been sanitized (converted to lowercase, e.g. ce-foo) which is not present as such in the headers object (still original casing, e.g. ce-FOO) and therefore undefined is set as value.
I assume according to spec an error should be thrown if attributes not following the naming convention are passed.
When creating a new event in code, I think I agree. But this is similar to other scenarios in that when receiving an event, the library should adhere to loose validation. That is, if we can effectively recover from the wrongly formatted event when receiving it, we should. I accept that this scenario should be caught and flagged somehow.
Alternatively, if they are still accepted, their value should be passed on to the event correctly.
It's not so clear to me. In that case, the resulting event would not conform to the specification. I think I would rather see the event ultimately represented according to spec.
Activity
lance commentedon Mar 5, 2021
When creating a new event in code, I think I agree. But this is similar to other scenarios in that when receiving an event, the library should adhere to loose validation. That is, if we can effectively recover from the wrongly formatted event when receiving it, we should. I accept that this scenario should be caught and flagged somehow.
It's not so clear to me. In that case, the resulting event would not conform to the specification. I think I would rather see the event ultimately represented according to spec.
test: add a test for extension names with all caps.
lance commentedon Mar 5, 2021
In fact, that is what's happening. See: #389
test: add a test for extension names with all caps. (#389)
github-actions commentedon Apr 5, 2021
This issue is stale because it has been open 30 days with no activity.
fix: throw on validation if extensions are improperly named
fix: throw on validation if extensions are improperly named (#420)