Skip to content

Protobuf schema for CDEvents #286

Open

Description

@prabinB

Protobuf provides compact size and faster serialization. CloudEvents already provides a Protobuf schema. Can we also create Protobuf schema for CDEvents.

Am I not sure if it was a conscious decision to not provide Protobuf and use JSON schemas, but even with JSON schema both producer and consumer has to do validations as per the spec. Protobuf would be much more faster and has a better code generation support.

Activity

  1. davidB commented on Jan 12, 2026

    @davidB
    Contributor

    Hello,

    We are in favor of more typed schemas.
    Currently we have several constraints:

    • for extensibility:
      • customData can be anything
      • subject can be anything, for custom event (aka when context.type doesn't start by dev.cdevents.)
    • each event's type has its own schema (and version)

    IMHO using google.protobuf.Any doesn't provide more type, or compact/faster (de)serialization if we have to chain (de)serialization. TBH, it's already the case with json as we have to read context.version/specversion and context.type to know how to handle the rest of the data.

    If you have a draft of a protobuf schema, I'll be happy to review and help on it.

    Look at #240 (I didn't update it) but it could give you some insight. (If needed, I could update the discussion, the matrix, and the github repo where I store my experiments)

  2. davidB commented on Jan 12, 2026

    @davidB
    Contributor

    Anyway, I guess, CDEvents will keep a "text" format, simply to ease the integration with notification/template system or event system without require them to have "native" support for the expected protobuf IDL format (in the expected version)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions