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

EventGridEvent ctor parameters are ordered inconsistently from other SDK languages #15476

Closed
joshfree opened this issue Sep 26, 2020 · 8 comments · Fixed by #18274
Closed

EventGridEvent ctor parameters are ordered inconsistently from other SDK languages #15476

joshfree opened this issue Sep 26, 2020 · 8 comments · Fixed by #18274
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Event Grid

Comments

@joshfree
Copy link
Member

The Event Grid C# SDK's EventGridEvent public constructor has its parameters ordered differently from other language SDKs. We should probably address this inconsistency in an upcoming beta release:

EventGridEvent.cs#L26

public EventGridEvent(object data, string subject, string eventType, string dataVersion)

EventGridEvent.java#L51

public EventGridEvent(String subject, String eventType, Object data, String dataVersion) {

https://docs.microsoft.com/en-us/azure/event-grid/event-schema#event-properties
JSON schema ordering: subject, eventType, [data], [dataVersion]

@joshfree joshfree added Event Grid Client This issue points to a problem in the data-plane of the library. labels Sep 26, 2020
@JoshLove-msft JoshLove-msft self-assigned this Sep 29, 2020
@JoshLove-msft
Copy link
Member

/cc @rakshith91 @ellismg - what are Python/JS doing here?

@ellismg
Copy link
Member

ellismg commented Sep 29, 2020

@JoshLove-msft

For JavaScript, we don't actually have an EventGridEvent or CloudEvent type that you construct. Instead, we have defined an interface that says what required and optional properties an object must have to be passed to our sendEvent method. Developers can construct such objects that fit that interface however they see fit, including using the object literal notation, i.e.:

sendEvent({ data: {}, subject: "some subject", eventType: "sample", dataVersion: "1.0");

In this case, the order of the keys in the object is uninteresting, the above is identical to:

sendEvent(subject: "some subject", eventType: "sample", { data: {}, dataVersion: "1.0");

@JoshLove-msft
Copy link
Member

@rakshith91 I assume Python is similar to JS here?

@rakshith91
Copy link

rakshith91 commented Oct 8, 2020

@JoshLove-msft Python with it's kwargs has this:

EventGridEvent( subject, event_type, **kwargs)

@JoshLove-msft
Copy link
Member

We will update to move the data parameter right before the dataVersion parameter. This will also make things more consistent with the CloudEvent ctor.

@JoshLove-msft JoshLove-msft added this to the [2021] February milestone Jan 26, 2021
@rakshith91
Copy link

@JoshLove-msft
It was discussed in the cross language consistency meeting to use this order -

def __init__(self, data, subject, event_type, data_version, **kwargs):

@JoshLove-msft
Copy link
Member

@JoshLove-msft
It was discussed in the cross language consistency meeting to use this order -

def __init__(self, data, subject, event_type, data_version, **kwargs):

I think this was before @YijunXieMS pointed out the inconsistency between the CloudEvent and EventGridEvent ctors. Can we discuss again tomorrow?

@rakshith91
Copy link

makes sense - agree with the inconsistency in both the Events - sure

@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Event Grid
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants