-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: base CloudEvent
class as per v1 specs, including attribute validation
#242
feat: base CloudEvent
class as per v1 specs, including attribute validation
#242
Conversation
…lidation Signed-off-by: Tudor Plugaru <[email protected]>
4d7434f
to
a2ac762
Compare
Signed-off-by: Tudor Plugaru <[email protected]>
Signed-off-by: Tudor <[email protected]>
6d40b45
to
35dee7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @PlugaruT, thx for PR. Please take a look at comments and suggestions.
Signed-off-by: Tudor Plugaru <[email protected]>
Signed-off-by: Tudor Plugaru <[email protected]>
Signed-off-by: Tudor Plugaru <[email protected]>
There's a bit of a problem with |
There's a We can have |
@PlugaruT, please don't use force push. The only merge strategy allowed in this repository is force push makes it pretty hard to follow the review process in GitHub unfortunately |
Signed-off-by: Tudor Plugaru <[email protected]>
Signed-off-by: Tudor Plugaru <[email protected]>
Yes, but the problem is with arbitrary keys, like extension names, since the
There's a whole discussion going on here https ://github.com/python/mypy/issues/ 4617 (intended not to link the PR's). So yes, it will "work" for the known attributes, but users will have to set the flag when they'll use this. Up to you what we want to do here. |
Signed-off-by: Tudor Plugaru <[email protected]>
…ve tests Signed-off-by: Tudor Plugaru <[email protected]>
@xSAVIKx, I addressed all the comments, except the mypy one that is a bit tricky. Let me know your thoughts |
Signed-off-by: Tudor Plugaru <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PlugaruT overall LGTM. I'd suggest we modify the error gathering a bit, but otherwise that's good.
…ute name and typed exceptions Signed-off-by: Tudor Plugaru <[email protected]>
We can't use TypedDict here becuase it does not allow for arbitrary keys which we need in order to support custom extension attributes. Signed-off-by: Tudor Plugaru <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PlugaruT PTAL at the comments and suggestions. Doing good 👍
Signed-off-by: Tudor Plugaru <[email protected]>
Signed-off-by: Tudor Plugaru <[email protected]>
Signed-off-by: Tudor Plugaru <[email protected]>
for more information, see https://pre-commit.ci
src/cloudevents/core/v1/event.py
Outdated
if hasattr(attributes["time"], "tzinfo") and not attributes["time"].tzinfo: | ||
errors["time"].append( | ||
InvalidAttributeValueError( | ||
"time", "Attribute 'time' must be timezone aware" | ||
) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't recall this being required. Where did you get this requirement from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time
attribute should respect RFC3339 which requires having timestamps with timezone attached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here, we have 2 options, either default to UTC, but that would be a controversial behaviour, as we can't default the timezone of the clients, or, make it an explicit requirement.
From my experience, using Python SDK and Java SDK, Java SDK will break when trying to have a naive datetime string. See here for example, time
is defined as OffsetDateTime
which means exactly this, timestamp with a timezone offset
Signed-off-by: Tudor Plugaru <[email protected]>
Signed-off-by: Tudor Plugaru <[email protected]>
Signed-off-by: Tudor Plugaru <[email protected]>
@xSAVIKx can you also merge please, I don't have the perms to do it. Thanks |
Changes
The first PR towards a full rewrite of the library. What's included in this PR:
One line description for the changelog