Skip to content

Commit

Permalink
Updating JSON Schema (cloudevents#563)
Browse files Browse the repository at this point in the history
* Updating JSON Schema

Signed-off-by: tsurdilo <tsurdilo@redhat.com>

* reverted change of schema name and fix link

Signed-off-by: tsurdilo <tsurdilo@redhat.com>

* updating schema keyword

Signed-off-by: tsurdilo <tsurdilo@redhat.com>

* adding contentEncoding=base64 to data_base64 property

Signed-off-by: Tihomir Surdilovic <tsurdilo@redhat.com>
Signed-off-by: Mike Helmick <helmick@google.com>
  • Loading branch information
Tihomir Surdilovic authored and mikehelmick committed Mar 18, 2020
1 parent 3e41ed8 commit edab2b2
Showing 1 changed file with 103 additions and 56 deletions.
159 changes: 103 additions & 56 deletions spec.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,126 @@
{
"$ref": "#/definitions/event",
"definitions": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "CloudEvents Specification JSON Schema",
"type": "object",
"properties": {
"id": {
"description": "Identifies the event.",
"$ref": "#/definitions/iddef",
"examples": [
"A234-1234-1234"
]
},
"source": {
"description": "Identifies the context in which an event happened.",
"$ref": "#/definitions/sourcedef",
"examples" : [
"https://github.com/cloudevents",
"mailto:cncf-wg-serverless@lists.cncf.io",
"urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66",
"cloudevents/spec/pull/123",
"/sensors/tn-1234567/alerts",
"1-555-123-4567"
]
},
"specversion": {
"type": "string",
"minLength": 1
"description": "The version of the CloudEvents specification which the event uses.",
"$ref": "#/definitions/specversiondef",
"examples": [
"1.0"
]
},
"type": {
"description": "Describes the type of event related to the originating occurrence.",
"$ref": "#/definitions/typedef",
"examples" : [
"com.github.pull.create",
"com.example.object.delete.v2"
]
},
"datacontenttype": {
"type": "string"
"description": "Content type of the data value. Must adhere to RFC 2046 format.",
"$ref": "#/definitions/datacontenttypedef",
"examples": [
"text/xml",
"application/json",
"image/png",
"multipart/form-data"
]
},
"dataschema": {
"description": "Identifies the schema that data adheres to.",
"$ref": "#/definitions/dataschemadef"
},
"subject": {
"description": "Describes the subject of the event in the context of the event producer (identified by source).",
"$ref": "#/definitions/subjectdef",
"examples": [
"mynewfile.jpg"
]
},
"time": {
"description": "Timestamp of when the occurrence happened. Must adhere to RFC 3339.",
"$ref": "#/definitions/timedef",
"examples": [
"2018-04-05T17:31:00Z"
]
},
"data": {
"type": ["object", "string"]
"description": "The event payload.",
"$ref": "#/definitions/datadef",
"examples": [
"<much wow=\"xml\"/>"
]
},
"data_base64": {
"type": "string"
},
"event": {
"properties": {
"specversion": {
"$ref": "#/definitions/specversion"
},
"datacontenttype": {
"$ref": "#/definitions/datacontenttype"
},
"data": {
"$ref": "#/definitions/data"
},
"data_base64": {
"$ref": "#/definitions/data_base64"
},
"id": {
"$ref": "#/definitions/id"
},
"time": {
"$ref": "#/definitions/time"
},
"dataschema": {
"$ref": "#/definitions/dataschema"
},
"subject": {
"$ref": "#/definitions/subject"
},
"type": {
"$ref": "#/definitions/type"
},
"source": {
"$ref": "#/definitions/source"
}
},
"required": ["specversion", "id", "type", "source"],
"type": "object"
"description": "Base64 encoded event payload. Must adhere to RFC4648.",
"$ref": "#/definitions/data_base64def",
"examples": [
"Zm9vYg=="
]
}
},
"required": ["id", "source", "specversion", "type"],
"definitions": {
"iddef": {
"type": "string",
"minLength": 1
},
"id": {
"sourcedef": {
"type": "string",
"format": "uri-reference",
"minLength": 1
},
"time": {
"format": "date-time",
"type": "string"
"specversiondef": {
"type": "string",
"minLength": 1
},
"dataschema": {
"typedef": {
"type": "string",
"format": "uri"
"minLength": 1
},
"subject": {
"datacontenttypedef": {
"type": "string"
},
"dataschemadef": {
"type": "string",
"format": "uri",
"minLength": 1
},
"type": {
"subjectdef": {
"type": "string",
"minLength": 1
},
"source": {
"format": "uri-reference",
"timedef": {
"format": "date-time",
"type": "string"
},
"datadef": {
"type": ["object", "string"]
},
"data_base64def": {
"type": "string",
"contentEncoding": "base64"
}
},
"type": "object"
}
}
}

0 comments on commit edab2b2

Please sign in to comment.