Skip to content
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

refactor: use CloudEvents not cloudevents everywhere #101

Merged
merged 2 commits into from
Apr 30, 2020

Conversation

grant
Copy link
Member

@grant grant commented Apr 30, 2020

Uses the same capitalization for CloudEvents everywhere.
Fixes #100.

@helio-frota
Copy link
Contributor

👍
It would be good to apply the same camelCase for variable names as well, in another PR.

from
const cloudevent
to
const cloudEvent

Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I like the idea. Have always really disliked the naming in this module. However, there seems to be a mix of efforts here to both improve things (in a way that breaks backwards compatibility), yet also retains unnecessary functions such as event() (now newEvent()).

I think it's best to either have a clean break and forego backwards compatibility, or be much more cautious about that.

I suggest that we figure out the branching and versioning strategies before we start landing breaking changes.

@@ -23,7 +23,6 @@ module.exports = {
BinaryHTTPEmitter,
BinaryHTTPReceiver,
HTTPUnmarshaller,
Cloudevent,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change to the API. I think we need to branch a v1.x line before doing this, or simply leave this line in for backwards compat.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is a breaking change. I can change the commit message accordingly.
This would be a 2.0, we don't need separate git branches for breaking changes, just major version changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grant I'm not sure you understand my proposal. I am not suggesting that we have branches for breaking changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's talk about the breaking change issue separately and reconvene here.

function event() {
return new Cloudevent(Spec);
function newEvent() {
return new CloudEvent(Spec);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are exporting the constructor, why even have this function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't attempt to change functionality, just the name in this PR.
I don't want functionality change beyond the name changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like an arbitrary distinction. I'd argue that making breaking changes as noted above is a change in functionality.

function event() {
return new Cloudevent(Spec);
function newEvent() {
return new CloudEvent(Spec);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again - if we are exporting the ctor...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lance If I am correct, spec 0.2 had SDK conformance to expose a method event() to create new event instances. For now, it's just to not break the sdk API

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. However, this code was here before. I'm just changing the name.

v1/index.js Show resolved Hide resolved
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
@grant grant force-pushed the grant_cloudevent_capitalization branch from fd9acd4 to 74c8b53 Compare April 30, 2020 17:55
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>
@grant
Copy link
Member Author

grant commented Apr 30, 2020

I'm still in favor of merging this PR. If we think a part of the PR should be changed, please request it.

@lance
Copy link
Member

lance commented Apr 30, 2020

Yes - let's land it at some point. Let's just make sure that we know what we are doing with regard to breaking changes before we do that. OK?

@grant
Copy link
Member Author

grant commented Apr 30, 2020

Yes - let's land it at some point. Let's just make sure that we know what we are doing with regard to breaking changes before we do that. OK?

I would like to not say "at some point". I don't understand what the blocker is here as the v1.x.y system sounds fine.

@lance
Copy link
Member

lance commented Apr 30, 2020

@grant Literally 20 minutes ago you said in Slack that you wanted something different with branch management. Is it fine now?

@grant
Copy link
Member Author

grant commented Apr 30, 2020

@grant Literally 20 minutes ago you said in Slack that you wanted something different with branch management. Is it fine now?

I'm still understanding the backporting feature. It seems fine in terms of branch management so long as we can make progress with future PRs like this that make breaking changes.

@grant grant merged commit 05ecbde into master Apr 30, 2020
@grant grant deleted the grant_cloudevent_capitalization branch April 30, 2020 23:14
@grant
Copy link
Member Author

grant commented Apr 30, 2020

Thanks for your patience and responsiveness @lance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spell CloudEvent Correctly and Consistently
4 participants