Skip to content

How is event_data supposed to work? #562

Description

@bradenmacdonald

Let's say we have the CONTENT_OBJECT_ASSOCIATIONS_CHANGED event:

# .. event_type: org.openedx.content_authoring.content.object.associations.changed.v1
# .. event_name: CONTENT_OBJECT_ASSOCIATIONS_CHANGED
# .. event_description: Emitted when an object's associations are changed, e.g tags, collections
# .. event_data: ContentObjectChangedData
# .. event_trigger_repository: openedx/edx-platform
CONTENT_OBJECT_ASSOCIATIONS_CHANGED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content.object.associations.changed.v1",
data={
"content_object": ContentObjectChangedData,
}
)

And I want to add the context (course/library ID) to this event, like this:

  CONTENT_OBJECT_ASSOCIATIONS_CHANGED = OpenEdxPublicSignal( 
      event_type="org.openedx.content_authoring.content.object.associations.changed.v1", 
      data={ 
          "content_object": ContentObjectChangedData,
+         "context": ContextIdData,
      } 
  ) 

Is that sort of change allowed? If so, how would I update event_data in the comment/documentation of the event? If not, why is data a dictionary? How do we know from the in-line code annotation what key (e.g. content_object) the event data is under?

This is not explained in the docs as far as I can see.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions