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

Allow schemas to be extended #52

Open
Zsailer opened this issue Aug 31, 2020 · 0 comments
Open

Allow schemas to be extended #52

Zsailer opened this issue Aug 31, 2020 · 0 comments

Comments

@Zsailer
Copy link
Member

Zsailer commented Aug 31, 2020

#49 requires schema authors to name categories for each property in their schema. This forces schema authors to be explicit about the type of data they are recording in their application. One downside of this implementation is that it might force schema authors to include many categories to capture all possible ways users want to log data.

This opens the question about allowing users to extend schemas. They might want to 1. modify a schema in-place or 2. wrap a schema with custom categories, logic, etc.

To enable this, it would look something like:

  • allowing users to subscribe to existing event schema
  • firing a callback method that allows user to record their own schema or some other action with that event payload.
    • e.g. this could record from a custom schema.
schema_id = "uri.to.schema"

eventlog.subscribe(schema_id, callback)

def callback(event):
    # Do something with this data.
    ...
    event.log.record(event.data)
    print(event.schema_id)

# printed out: "uri.to.schema"
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

No branches or pull requests

1 participant