-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SHOULD throw if time has an invalid value? #386
Comments
This issue is stale because it has been open 30 days with no activity. |
I don't. I was suprised to find this. The field is |
This issue is stale because it has been open 30 days with no activity. |
not stale |
This issue is stale because it has been open 30 days with no activity. |
Describe the Bug
If an invalid value for
time
is given,HTTP.toEvent
silently defaults it to the current time in UTC.Steps to Reproduce
Use the following snippet:
Check the resulting event:
Expected Behavior
As with the other issues I opened regarding (silent) defaulting, I think
HTTP.toEvent
should not do this. I think it would be more appropriate to either fail fast on invalid input or take the original value with a subsequentevent.validate()
failing (maybe also thinking about strict mode as for instance inevent.cloneWith
).In case of
new CloudEvent(...)
I agree that it makes sense to provide defaults.Additional context
Origin of this behavior seems to be here:
sdk-javascript/src/parsers.ts
Line 68 in 6be3b27
The text was updated successfully, but these errors were encountered: