Inline Spec File (#129)

* fix: make application/json the default content type in binary mode (#118)

The Knative Kafka event source does not include a `Content-Type` header when
sending binary events. The CE HTTP binding specification doesn't address how
a receiver should handle this situation.

This commit makes `application/json` the default.

Fixes: https://github.com/cloudevents/sdk-javascript/issues/117
Ref: https://github.com/cloudevents/spec/issues/614

Signed-off-by: Lance Ball <lball@redhat.com>
Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

* refactor: remove ext folder

Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

* Revert "fix: make application/json the default content type in binary mode (#118)"

This reverts commit 9ccfaf25ba.

Signed-off-by: Grant Timmerman <timmerman+devrel@google.com>

Co-authored-by: Lance Ball <lball@redhat.com>
This commit is contained in:
Grant Timmerman 2020-05-06 12:12:26 -07:00 committed by GitHub
parent 54f242b79e
commit 106b943ee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 166 additions and 170 deletions

View File

@ -1,88 +0,0 @@
{
"$ref": "#/definitions/event",
"definitions": {
"specversion": {
"type": "string",
"minLength": 1,
"const": "0.3"
},
"datacontenttype": {
"type": "string"
},
"data": {
"type": [
"object",
"string"
]
},
"event": {
"properties": {
"specversion": {
"$ref": "#/definitions/specversion"
},
"datacontenttype": {
"$ref": "#/definitions/datacontenttype"
},
"data": {
"$ref": "#/definitions/data"
},
"id": {
"$ref": "#/definitions/id"
},
"time": {
"$ref": "#/definitions/time"
},
"schemaurl": {
"$ref": "#/definitions/schemaurl"
},
"subject": {
"$ref": "#/definitions/subject"
},
"type": {
"$ref": "#/definitions/type"
},
"extensions": {
"$ref": "#/definitions/extensions"
},
"source": {
"$ref": "#/definitions/source"
}
},
"required": [
"specversion",
"id",
"type",
"source"
],
"type": "object"
},
"id": {
"type": "string",
"minLength": 1
},
"time": {
"format": "date-time",
"type": "string"
},
"schemaurl": {
"type": "string",
"format": "uri-reference"
},
"subject": {
"type": "string",
"minLength": 1
},
"type": {
"type": "string",
"minLength": 1
},
"extensions": {
"type": "object"
},
"source": {
"format": "uri-reference",
"type": "string"
}
},
"type": "object"
}

View File

@ -1,80 +0,0 @@
{
"$ref": "#/definitions/event",
"definitions": {
"specversion": {
"type": "string",
"minLength": 1,
"const": "1.0"
},
"datacontenttype": {
"type": "string"
},
"data": {
"type": ["object", "string"]
},
"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"
},
"id": {
"type": "string",
"minLength": 1
},
"time": {
"format": "date-time",
"type": "string"
},
"dataschema": {
"type": "string",
"format": "uri"
},
"subject": {
"type": "string",
"minLength": 1
},
"type": {
"type": "string",
"minLength": 1
},
"source": {
"format": "uri-reference",
"type": "string"
}
},
"type": "object"
}

View File

@ -25,7 +25,92 @@ SUPPORTED_CONTENT_ENCODING.base64 = {
check: (data) => isBase64(data)
};
const schema = require("../../ext/spec_0_3.json");
const schema = {
$ref: "#/definitions/event",
definitions: {
specversion: {
const: "0.3"
},
datacontenttype: {
type: "string"
},
data: {
type: [
"object",
"string"
]
},
event: {
properties: {
specversion: {
$ref: "#/definitions/specversion"
},
datacontenttype: {
$ref: "#/definitions/datacontenttype"
},
data: {
$ref: "#/definitions/data"
},
id: {
$ref: "#/definitions/id"
},
time: {
$ref: "#/definitions/time"
},
schemaurl: {
$ref: "#/definitions/schemaurl"
},
subject: {
$ref: "#/definitions/subject"
},
type: {
$ref: "#/definitions/type"
},
extensions: {
$ref: "#/definitions/extensions"
},
source: {
$ref: "#/definitions/source"
}
},
required: [
"specversion",
"id",
"type",
"source"
],
type: "object"
},
id: {
type: "string",
minLength: 1
},
time: {
format: "date-time",
type: "string"
},
schemaurl: {
type: "string",
format: "uri-reference"
},
subject: {
type: "string",
minLength: 1
},
type: {
type: "string",
minLength: 1
},
extensions: {
type: "object"
},
source: {
format: "uri-reference",
type: "string"
}
},
type: "object"
};
const ajv = new Ajv({
extendRefs: true

View File

@ -27,7 +27,86 @@ const RESERVED_ATTRIBUTES = {
data_base64: "data_base64"
};
const schema = require("../../ext/spec_1.json");
const schema = {
$ref: "#/definitions/event",
definitions: {
specversion: {
type: "string",
minLength: 1,
const: "1.0"
},
datacontenttype: {
type: "string"
},
data: {
type: ["object", "string"]
},
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"
},
id: {
type: "string",
minLength: 1
},
time: {
format: "date-time",
type: "string"
},
dataschema: {
type: "string",
format: "uri"
},
subject: {
type: "string",
minLength: 1
},
type: {
type: "string",
minLength: 1
},
source: {
format: "uri-reference",
type: "string"
}
},
type: "object"
};
const ajv = new Ajv({
extendRefs: true