Skip to content

Commit

Permalink
bump version / fix jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
WaleedAshraf committed Sep 30, 2021
1 parent 8e2f4ca commit b827d4e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

Version 3.1.1 *(2021-09-30)*
----------------------------
* Add TS types
* Fix JSDocs for `fromSource()`

Version 3.1.0 *(2021-08-22)*
----------------------------
* Add support for deserialized objects as source
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "asyncapi-validator",
"version": "3.1.0",
"version": "3.1.1",
"description": "message validator through asyncapi schema",
"main": "index.js",
"types": "index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions src/ValidatorFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ const Parser = require('./Parser')
function ValidatorFactory() {
/**
* @param {string} source
* @param {{ msgIdentifier?: string ; ignoreArray?: boolean }} options
* @param {{ msgIdentifier: string ; ignoreArray?: boolean }} options
* @returns {Promise<MessageValidator>}
*/
this.fromSource = async (source, options = {}) => {
this.fromSource = async (source, options) => {
const {_json: schema} = await Parser.parse(source)
if (!options || !options.msgIdentifier) {
throw new ValidationError('"msgIdentifier" is required')
}
const channels = constructsChannels(schema, options.msgIdentifier)
return new MessageValidator(schema, options, channels)
}
Expand All @@ -21,9 +24,6 @@ function ValidatorFactory() {
*/
const constructsChannels = (schema, msgIdentifier) => {
const channels = {}
if (!msgIdentifier) {
throw new ValidationError('"msgIdentifier" is required')
}

Object.keys(schema.channels).forEach(c => {
const publish = getMessagesForOperation(schema.channels[c], 'publish', msgIdentifier)
Expand Down

0 comments on commit b827d4e

Please sign in to comment.