openedx / openedx/openedx-events

How is `event_data` supposed to work?

Open
#562 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13
Forks
33
Avg merge
14h 37m
Merged PRs (30d)
4

Description

Let's say we have the CONTENT_OBJECT_ASSOCIATIONS_CHANGED event:

https://github.com/openedx/openedx-events/blob/34d3fce371f14c892d77284f9fcba8a5e67fc544/openedx_events/content_authoring/signals.py#L239-L249

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with openedx_events/content_authoring/signals.py at the CONTENT_OBJECT_ASSOCIATIONS_CHANGED definition, then read the linked inline-code-annotations documentation. Review the comment thread for the intended event_data and data-key behavior, and update the documentation so the mapping and allowed context field are explicit; done means the original questions can be answered from the docs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.