cloudevent
Advanced tools
Comparing version 0.2.0 to 0.2.1
# Change Log | ||
## [0.2.1](https://github.com/smartiniOnGitHub/cloudevent.js/releases/tag/0.2.1) (2018-12-20) | ||
Summary Changelog: | ||
- Updated dependencies for the development environment | ||
- Expose the JSON Schema even with a static method, for simpler usage by others | ||
- Fix documentation generation in ESDoc (using latest JavaScript syntax), | ||
and tweak configuration for documentation on tests | ||
- Added badge for the status (updated or not) for dependencies, in the README | ||
## [0.2.0](https://github.com/smartiniOnGitHub/cloudevent.js/releases/tag/0.2.0) (2018-12-09) | ||
@@ -4,0 +12,0 @@ Summary Changelog: |
{ | ||
"name": "cloudevent", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "JavaScript/Node.js implementation of the CloudEvents standard format", | ||
@@ -17,6 +17,7 @@ "main": "src/index", | ||
"esdoc-standard-plugin": "^1.0.0", | ||
"esdoc-ecmascript-proposal-plugin": "^1.0.0", | ||
"esdoc-node": "^1.0.4", | ||
"simple-get": "^3.0.3", | ||
"standard": "^12.0.1", | ||
"tap": "^12.1.0" | ||
"tap": "^12.1.1" | ||
}, | ||
@@ -23,0 +24,0 @@ "peerDependencies": {}, |
@@ -7,2 +7,3 @@ # cloudevent.js | ||
[![Coverage Status](https://coveralls.io/repos/github/smartiniOnGitHub/cloudevent.js/badge.svg?branch=master)](https://coveralls.io/github/smartiniOnGitHub/cloudevent.js/?branch=master) | ||
[![Dependencies](https://david-dm.org/smartiniOnGitHub/cloudevent.js.svg)](https://david-dm.org/smartiniOnGitHub/cloudevent.js.svg) | ||
@@ -9,0 +10,0 @@ JavaScript/Node.js implementation of [CloudEvents](http://cloudevents.io/) |
@@ -290,2 +290,38 @@ /* | ||
/** | ||
* Get the JSON Schema for a CloudEvent. | ||
* Note that it's not used in standard serialization to JSON, | ||
* but only in some serialization libraries. | ||
* | ||
* See JSON Schema. | ||
* | ||
* @return {object} the JSON Schema | ||
*/ | ||
static getJSONSchema () { | ||
// define a schema for serializing a CloudEvent object to JSON | ||
// note that properties not in the schema will be ignored | ||
// (in json output) by some json serialization libraries, if additionalProperties is false | ||
return { | ||
title: 'CloudEvent Schema with required fields', | ||
type: 'object', | ||
properties: { | ||
cloudEventsVersion: { type: 'string' }, | ||
eventID: { type: 'string' }, | ||
eventType: { type: 'string' }, | ||
// data: { type: 'object' }, | ||
eventTypeVersion: { type: 'string' }, | ||
source: { type: 'string' }, | ||
eventTime: { type: 'string' }, | ||
// extensions: { type: 'object' }, | ||
contentType: { type: 'string' }, | ||
// TODO: use if/then/else on contentType ... wip | ||
schemaURL: { type: 'string' } | ||
}, | ||
required: ['cloudEventsVersion', 'eventID', 'eventType', | ||
'source', 'contentType' | ||
], | ||
additionalProperties: true // to handle data, extensions, and maybe other (non-standard) properties | ||
} | ||
} | ||
/** | ||
* Serialize the current CloudEvent. | ||
@@ -339,3 +375,3 @@ * | ||
* | ||
* See JSON Schema. | ||
* See {@link CloudEvent.getJSONSchema}. | ||
* | ||
@@ -345,26 +381,3 @@ * @type {object} | ||
get schema () { | ||
// define a schema for serializing a CloudEvent object to JSON | ||
// note that properties not in the schema will be ignored | ||
// (in json output) by some json serialization libraries, if additionalProperties is false | ||
return { | ||
title: 'CloudEvent Schema with required fields', | ||
type: 'object', | ||
properties: { | ||
cloudEventsVersion: { type: 'string' }, | ||
eventID: { type: 'string' }, | ||
eventType: { type: 'string' }, | ||
// data: { type: 'object' }, | ||
eventTypeVersion: { type: 'string' }, | ||
source: { type: 'string' }, | ||
eventTime: { type: 'string' }, | ||
// extensions: { type: 'object' }, | ||
contentType: { type: 'string' }, | ||
// TODO: use if/then/else on contentType ... wip | ||
schemaURL: { type: 'string' } | ||
}, | ||
required: ['cloudEventsVersion', 'eventID', 'eventType', | ||
'source', 'contentType' | ||
], | ||
additionalProperties: true // to handle data, extensions, and maybe other (non-standard) properties | ||
} | ||
return this.constructor.getJSONSchema() | ||
} | ||
@@ -371,0 +384,0 @@ |
56820
974
157
7