Skip to content

Instantly share code, notes, and snippets.

@rbramley
Created April 6, 2018 17:07
Show Gist options
  • Save rbramley/c00bbd95f3f6ecc0cc1f90e5d6d6c90c to your computer and use it in GitHub Desktop.
Save rbramley/c00bbd95f3f6ecc0cc1f90e5d6d6c90c to your computer and use it in GitHub Desktop.
CloudEvents 0.1 Avro schema (draft)
{
"namespace": "CloudEvents",
"type": "record",
"name": "Event",
"fields": [
{"name": "cloudEventsVersion", "type": "string", "doc": "The version of the CloudEvents specification which the event uses. This enables the interpretation of the context."},
{"name": "eventType", "type": "string", "doc": "Type of the event data. Producers can specify the format of this, depending on their service. This enables the interpretation of data, and can be used for routing, policy and more."},
{"name": "eventTypeVersion", "type": ["null", "string"], "doc": "The version of the event-type. This enables the interpretation of data by eventual consumers, requires the consumer to be knowledgeable about the producer."},
{"name": "source", "type": "string", "doc": "This describes the event producer. Often this will include information such as the type of the event source, the organization publishing the event, and some unique idenfitiers. The exact syntax and semantics behind the data encoded in the URI is event producer defined."},
{"name": "eventID", "type": "string", "doc": "ID of the event. The semantics of this string are explicitly undefined to ease the implementation of producers. Enables deduplication. MUST be a non-empty string. MUST be unique within the scope of the producer."},
{"name": "eventTime", "type": ["null", "string"], "doc": "Timestamp per RFC 3339. Timestamp of when the event happened."},
{"name": "schemaURL", "type": ["null", "string"], "doc": "URI per RFC 3986. A link to the schema that the data attribute adheres to."},
{"name": "contentType", "type": ["null", "string"], "doc": "String per RFC 2046. Describe the data encoding format"},
{"name": "extensions", "type": ["null", { "type": "map", "values": ["int","long","float","double","string","boolean"]}], "doc": "Map <String, Object>. This is for additional metadata and this does not have a mandated structure. This enables a place for custom fields a producer or middleware might want to include and provides a place to test metadata before adding them to the CloudEvents specification. TBD - Determine a shorter prefix for this (e.g. OpenAPI uses “x-”) See the Extensions document for a list of possible properties."},
{"name": "data", "type": ["null", "string"], "doc": "The event payload. The payload depends on the event-type, schema-url and event-type-version, the payload is encoded into a media format which is specified by the content-type attribute (e.g. application/json). Avro users may wish to declare a nested record for this."}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment