![open-events-logo](https://camo.githubusercontent.com/29c3e2db43706896fb614fbffae34ef031e5343e/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f73657276616e742d6173736574732f696d672f6c6f676f312e706e67)

# Introduction

OpenEvents is a specification for a common, vendor-neutral format for event data.

All cloud providers (e.g. Microsoft, IBM, Google, Amazon) have their own event payload format. Lack of a consistent format means that developers must constantly re-learn how to receive events within a single provider, or across providers. This specification aims to drive convergence on a common set of attributes (e.g., names and types) for event data.

Our end goal is to offer this specification to the [Cloud Native Computing Foundation](https://www.cncf.io/).

# Version

Version 0.3 - 2017/09/20

# Schema

- **eventId** - *string* - ID of the event.  Can be specified by the producer.  The semantics of this string are explicitly undefined to ease the implementation of producers (e.g. a database commit ID).

- **eventType** - *string* - Type of the event (e.g. `customer.created`).  Producers can specify the format of this, dependening on their service.  This specification does not (yet) enforce a type format (up for discussion).  We are also discussing putting the type version in here as well.

- **createdAt** - *string* - RFC 3339, timezone Z - Timestamp of event creation generated by the producer.

- **data** - *arbitrary payload* - The event payload.  Payload depends on the event type.  Producer can specify format/ecoding of the data elsewhere in this schema.

- **dataContentType** - *string* - Content type of the data (e.g. `application/json`).

- **resource** - *object* - Describes the resource that published the event.  This object has the following fields:

  - **type** - *string* - Type of the event source.  Providers define list of event sources.

  - **id** - *string* - ID of the event source.

- **specVersion** - *string* - The version of the OpenEvents specification (e.g. `1.0`).

- **attributes** - *map<string, object>* - This is for additional metadata and this does not have a required structure.  The goals of this object are:

  - Create a place for custom fields a producer may want to include.

  - Provide a place to test properties before moving them to the main envelope (e.g. `authorization`, `contentType`) and upgrading the version of the specification.

  - Producers can put additional key/value pairs separate from data.  This avoids having to deserialized data when used in an event pipe.

# Examples

## Google Cloud Functions (WIP)

```json
{
  "eventId": "66dfc31d-6844-42fd-b1a7-a489a49f65f3",
  "eventType": "google.storage.object.finalize",
  "createdAt": "2017-09-28T19:03:12Z",
  "data": {},
  "dataContentType": "application/json",
  "resource": {
    "type": "storage#object",
    "id": "storage.googleapis.com"
  },
  "specVersion": "0.1",
  "attributes": {}
}

```

## Microsoft Event Grid (WIP)

## AWS Lambda (WIP)

## IBM (WIP)

## Serverless Inc. Event Gateway (WIP)

```json
{
  "eventId": "66dfc31d-6844-42fd-b1a7-a489a49f65f3",
  "eventType": "myapp.user.created",
  "createdAt": "2016-09-28T19:03:12Z",
  "resource": {
    "type": "",
    "id": ""
  },
  "specVersion": "0.1",
  "attributes": {},
  "dataContentType": "application/json",
  "data": {}
}
```
