From 643605ca68c949313d19fa1430d1ae12ffcc9d0b Mon Sep 17 00:00:00 2001 From: Khuda Dad Nomani Date: Mon, 6 Sep 2021 06:47:20 -0700 Subject: [PATCH 1/3] added optional sign to jsdoc --- API.md | 11 +++++------ lib/parser.js | 8 ++++---- types.d.ts | 16 ++++++++-------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/API.md b/API.md index 61327f4dc..f1340ba1d 100644 --- a/API.md +++ b/API.md @@ -3200,8 +3200,7 @@ Implements functions to deal with the AsyncAPI document. #### asyncAPIDocument.traverseSchemas(callback, schemaTypesToIterate) -Traverse schemas in the document and select which types of schemas to include. -By default all schemas are iterated +Traverse schemas in the document and select which types of schemas to include. By default all schemas are iterated **Kind**: instance method of [AsyncAPIDocument](#module_@asyncapi/parser+AsyncAPIDocument) @@ -3478,10 +3477,10 @@ The complete list of parse configuration options used to parse the given data. | Name | Type | Description | | --- | --- | --- | -| path | String | Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir. | -| parse | Object | Options object to pass to [json-schema-ref-parser](https://apidevtools.org/json-schema-ref-parser/docs/options.html). | -| resolve | Object | Options object to pass to [json-schema-ref-parser](https://apidevtools.org/json-schema-ref-parser/docs/options.html). | -| applyTraits | Boolean | Whether to resolve and apply traits or not. Defaults to true. | +| [path] | String | Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir. | +| [parse] | Object | Options object to pass to [json-schema-ref-parser](https://apidevtools.org/json-schema-ref-parser/docs/options.html). | +| [resolve] | Object | Options object to pass to [json-schema-ref-parser](https://apidevtools.org/json-schema-ref-parser/docs/options.html). | +| [applyTraits] | Boolean | Whether to resolve and apply traits or not. Defaults to true. | diff --git a/lib/parser.js b/lib/parser.js index b869141b5..4b9af379b 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -30,10 +30,10 @@ module.exports = { /** * The complete list of parse configuration options used to parse the given data. * @typedef {Object} ParserOptions - * @property {String} path - Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir. - * @property {Object} parse - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. - * @property {Object} resolve - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. - * @property {Boolean} applyTraits - Whether to resolve and apply traits or not. Defaults to true. + * @property {String=} path - Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir. + * @property {Object=} parse - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. + * @property {Object=} resolve - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. + * @property {Boolean=} applyTraits - Whether to resolve and apply traits or not. Defaults to true. */ /** diff --git a/types.d.ts b/types.d.ts index c56ab8292..80225d435 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1066,16 +1066,16 @@ declare module "@asyncapi/parser" { } /** * The complete list of parse configuration options used to parse the given data. - * @property path - Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir. - * @property parse - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. - * @property resolve - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. - * @property applyTraits - Whether to resolve and apply traits or not. Defaults to true. + * @property [path] - Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir. + * @property [parse] - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. + * @property [resolve] - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. + * @property [applyTraits] - Whether to resolve and apply traits or not. Defaults to true. */ type ParserOptions = { - path: string; - parse: any; - resolve: any; - applyTraits: boolean; + path?: string; + parse?: any; + resolve?: any; + applyTraits?: boolean; }; /** * Parses and validate an AsyncAPI document from YAML or JSON. From 97568b77a97a5237a3e5274412edc1a518e3d8d6 Mon Sep 17 00:00:00 2001 From: Khuda Dad Nomani Date: Mon, 6 Sep 2021 07:19:31 -0700 Subject: [PATCH 2/3] api.md and types.d.ts reverted --- API.md | 11 ++++++----- types.d.ts | 18 +++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/API.md b/API.md index f1340ba1d..61327f4dc 100644 --- a/API.md +++ b/API.md @@ -3200,7 +3200,8 @@ Implements functions to deal with the AsyncAPI document. #### asyncAPIDocument.traverseSchemas(callback, schemaTypesToIterate) -Traverse schemas in the document and select which types of schemas to include. By default all schemas are iterated +Traverse schemas in the document and select which types of schemas to include. +By default all schemas are iterated **Kind**: instance method of [AsyncAPIDocument](#module_@asyncapi/parser+AsyncAPIDocument) @@ -3477,10 +3478,10 @@ The complete list of parse configuration options used to parse the given data. | Name | Type | Description | | --- | --- | --- | -| [path] | String | Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir. | -| [parse] | Object | Options object to pass to [json-schema-ref-parser](https://apidevtools.org/json-schema-ref-parser/docs/options.html). | -| [resolve] | Object | Options object to pass to [json-schema-ref-parser](https://apidevtools.org/json-schema-ref-parser/docs/options.html). | -| [applyTraits] | Boolean | Whether to resolve and apply traits or not. Defaults to true. | +| path | String | Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir. | +| parse | Object | Options object to pass to [json-schema-ref-parser](https://apidevtools.org/json-schema-ref-parser/docs/options.html). | +| resolve | Object | Options object to pass to [json-schema-ref-parser](https://apidevtools.org/json-schema-ref-parser/docs/options.html). | +| applyTraits | Boolean | Whether to resolve and apply traits or not. Defaults to true. | diff --git a/types.d.ts b/types.d.ts index 80225d435..76372d2e8 100644 --- a/types.d.ts +++ b/types.d.ts @@ -3,7 +3,7 @@ * @property NEW_SCHEMA - The crawler just started crawling a schema. * @property END_SCHEMA - The crawler just finished crawling a schema. */ -declare type SchemaIteratorCallbackType = { + declare type SchemaIteratorCallbackType = { NEW_SCHEMA: string; END_SCHEMA: string; }; @@ -1066,16 +1066,16 @@ declare module "@asyncapi/parser" { } /** * The complete list of parse configuration options used to parse the given data. - * @property [path] - Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir. - * @property [parse] - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. - * @property [resolve] - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. - * @property [applyTraits] - Whether to resolve and apply traits or not. Defaults to true. + * @property path - Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir. + * @property parse - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. + * @property resolve - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}. + * @property applyTraits - Whether to resolve and apply traits or not. Defaults to true. */ type ParserOptions = { - path?: string; - parse?: any; - resolve?: any; - applyTraits?: boolean; + path: string; + parse: any; + resolve: any; + applyTraits: boolean; }; /** * Parses and validate an AsyncAPI document from YAML or JSON. From b5f6def36da60e676b95eb4dd927ef6d3d1daba2 Mon Sep 17 00:00:00 2001 From: Khuda Dad Nomani Date: Mon, 6 Sep 2021 07:21:13 -0700 Subject: [PATCH 3/3] reverted --- types.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types.d.ts b/types.d.ts index 76372d2e8..c56ab8292 100644 --- a/types.d.ts +++ b/types.d.ts @@ -3,7 +3,7 @@ * @property NEW_SCHEMA - The crawler just started crawling a schema. * @property END_SCHEMA - The crawler just finished crawling a schema. */ - declare type SchemaIteratorCallbackType = { +declare type SchemaIteratorCallbackType = { NEW_SCHEMA: string; END_SCHEMA: string; };