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

Updating JSON Schema #563

Merged
merged 4 commits into from
Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion json-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The following table shows exemplary attribute mappings:
### 2.4. JSONSchema Validation

The CloudEvents [JSONSchema](http://json-schema.org) for the spec is located
[here](spec.json) and contains the definitions for validating events in JSON.
[here](spec-schema.json) and contains the definitions for validating events in JSON.

## 3. Envelope

Expand Down
125 changes: 125 additions & 0 deletions spec-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"$schema": "http://json-schema.org/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": {
"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": {
"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": {
"description": "The event payload.",
"$ref": "#/definitions/datadef",
"examples": [
"<much wow=\"xml\"/>"
]
},
"data_base64": {
"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
},
"sourcedef": {
"type": "string",
"format": "uri-reference",
"minLength": 1
},
"specversiondef": {
"type": "string",
"minLength": 1
},
"typedef": {
"type": "string",
"minLength": 1
},
"datacontenttypedef": {
"type": "string"
},
"dataschemadef": {
"type": "string",
"format": "uri",
"minLength": 1
},
"subjectdef": {
"type": "string",
"minLength": 1
},
"timedef": {
"format": "date-time",
"type": "string"
},
"datadef": {
"type": ["object", "string"]
},
"data_base64def": {
"type": "string"
}
}
}
79 changes: 0 additions & 79 deletions spec.json

This file was deleted.