Skip to content

Commit ffa7fb4

Browse files
committed
chore: fix warnings
1 parent 4e7bb8d commit ffa7fb4

36 files changed

+623
-445
lines changed

API.md

Lines changed: 471 additions & 366 deletions
Large diffs are not rendered by default.

dist/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/errors/parser-error.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const buildError = (from, to) => {
1515
* Represents an error while trying to parse an AsyncAPI document.
1616
*
1717
* @alias module:@asyncapi/parser#ParserError
18-
* @extends Error
18+
* @augments Error
1919
*/
2020
class ParserError extends Error {
2121
/**
@@ -56,7 +56,7 @@ class ParserError extends Error {
5656
}
5757

5858
/**
59-
* Returns a JS object representation of the error.
59+
* @returns {object} Returns a JS object representation of the error.
6060
*/
6161
toJS() {
6262
return buildError(this, {});

lib/mixins/bindings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const MixinBindings = {
3737

3838
/**
3939
* @param {string} name - Name of the binding.
40-
* @returns {(Object | null)}
40+
* @returns {(object | null)}
4141
*/
4242
binding(name) {
4343
return getMapValueByKey(this._json.bindings, name);

lib/models/asyncapi.js

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -39,64 +39,64 @@ class AsyncAPIDocument extends Base {
3939
}
4040

4141
/**
42-
* @returns {string}
42+
* @returns {string} Version.
4343
*/
4444
version() {
4545
return this._json.asyncapi;
4646
}
4747

4848
/**
49-
* @returns {Info}
49+
* @returns {Info} Info.
5050
*/
5151
info() {
5252
return new Info(this._json.info);
5353
}
5454

5555
/**
56-
* @returns {string}
56+
* @returns {string} Id.
5757
*/
5858
id() {
5959
return this._json.id;
6060
}
6161

6262
/**
63-
* @returns {boolean}
63+
* @returns {boolean} If it has servers.
6464
*/
6565
hasServers() {
6666
return !!this._json.servers;
6767
}
6868

6969
/**
70-
* @returns {object<string, Server>}
70+
* @returns {object<string, Server>} Servers.
7171
*/
7272
servers() {
7373
return createMapOfType(this._json.servers, Server);
7474
}
7575

7676
/**
7777
* @param {string} name - Name of the server.
78-
* @returns {Server}
78+
* @returns {Server} The server for given name.
7979
*/
8080
server(name) {
8181
return getMapValueOfType(this._json.servers, name, Server);
8282
}
8383

8484
/**
85-
* @returns {boolean}
85+
* @returns {boolean} If it has channels.
8686
*/
8787
hasChannels() {
8888
return !!this._json.channels;
8989
}
9090

9191
/**
92-
* @returns {object<string, Channel>}
92+
* @returns {object<string, Channel>} Channels.
9393
*/
9494
channels() {
9595
return createMapOfType(this._json.channels, Channel, this);
9696
}
9797

9898
/**
99-
* @returns {string[]}
99+
* @returns {string[]} An array with channels names.
100100
*/
101101
channelNames() {
102102
if (!this._json.channels) return [];
@@ -105,43 +105,43 @@ class AsyncAPIDocument extends Base {
105105

106106
/**
107107
* @param {string} name - Name of the channel.
108-
* @returns {Channel}
108+
* @returns {Channel} The channel for given name.
109109
*/
110110
channel(name) {
111111
return getMapValueOfType(this._json.channels, name, Channel, this);
112112
}
113113

114114
/**
115-
* @returns {string}
115+
* @returns {string} The content type.
116116
*/
117117
defaultContentType() {
118118
return this._json.defaultContentType || null;
119119
}
120120

121121
/**
122-
* @returns {boolean}
122+
* @returns {boolean} If it has Components.
123123
*/
124124
hasComponents() {
125125
return !!this._json.components;
126126
}
127127

128128
/**
129-
* @returns {Components}
129+
* @returns {Components} Components
130130
*/
131131
components() {
132132
if (!this._json.components) return null;
133133
return new Components(this._json.components);
134134
}
135135

136136
/**
137-
* @returns {boolean}
137+
* @returns {boolean} If it has messages.
138138
*/
139139
hasMessages() {
140140
return !!this.allMessages().size;
141141
}
142142

143143
/**
144-
* @returns {Map<string, Message>}
144+
* @returns {Map<string, Message>} All messages.
145145
*/
146146
allMessages() {
147147
const messages = new Map();
@@ -172,7 +172,7 @@ class AsyncAPIDocument extends Base {
172172
}
173173

174174
/**
175-
* @returns {Map<string, Schema>}
175+
* @returns {Map<string, Schema>} All schemas.
176176
*/
177177
allSchemas() {
178178
const schemas = new Map();
@@ -192,7 +192,7 @@ class AsyncAPIDocument extends Base {
192192
}
193193

194194
/**
195-
* @returns {boolean}
195+
* @returns {boolean} If it has circular refs.
196196
*/
197197
hasCircular() {
198198
return !!this._json[String(xParserCircle)];
@@ -203,7 +203,7 @@ class AsyncAPIDocument extends Base {
203203
* Assign message keys as message name to all the component messages.
204204
*
205205
* @private
206-
* @param {AsyncAPIDocument} doc
206+
* @param {AsyncAPIDocument} doc Document.
207207
*/
208208
function assignNameToComponentMessages(doc) {
209209
if (doc.hasComponents()) {
@@ -219,7 +219,7 @@ function assignNameToComponentMessages(doc) {
219219
* Assign parameter keys as uid for the parameter schema.
220220
*
221221
* @private
222-
* @param {AsyncAPIDocument} doc
222+
* @param {AsyncAPIDocument} doc Document.
223223
*/
224224
function assignUidToParameterSchemas(doc) {
225225
doc.channelNames().forEach(channelName => {
@@ -234,7 +234,7 @@ function assignUidToParameterSchemas(doc) {
234234
* Assign uid to component schemas.
235235
*
236236
* @private
237-
* @param {AsyncAPIDocument} doc
237+
* @param {AsyncAPIDocument} doc Document.
238238
*/
239239
function assignUidToComponentSchemas(doc) {
240240
if (doc.hasComponents()) {
@@ -248,7 +248,7 @@ function assignUidToComponentSchemas(doc) {
248248
* Assign anonymous names to nameless messages.
249249
*
250250
* @private
251-
* @param {AsyncAPIDocument} doc
251+
* @param {AsyncAPIDocument} doc Document.
252252
*/
253253
function assignNameToAnonymousMessages(doc) {
254254
let anonymousMessageCounter = 0;
@@ -264,9 +264,11 @@ function assignNameToAnonymousMessages(doc) {
264264

265265
/**
266266
* Add anonymous name to key if no name provided.
267-
*
267+
*
268268
* @private
269-
* @param {Message} map of messages
269+
* @param messages
270+
* @param number
271+
* @param {Message} map of messages
270272
*/
271273
function addNameToKey(messages, number) {
272274
messages.forEach(m => {
@@ -278,18 +280,21 @@ function addNameToKey(messages, number) {
278280

279281
/**
280282
* Function that indicates that a circular reference was detected.
283+
*
281284
* @private
282285
* @param {Schema} schema schema that is currently accessed and need to be checked if it is a first time
283286
* @param {Array} seenObjects list of objects that were already seen during recursion
287+
* @returns {boolean} If has circular references or not.
284288
*/
285289
function isCircular(schema, seenObjects) {
286290
return seenObjects.includes(schema.json());
287291
}
288292

289293
/**
290294
* Mark schema as being a circular ref
291-
*
295+
*
292296
* @private
297+
* @param prop
293298
* @param {Schema} schema schema that should be marked as circular
294299
*/
295300
function markCircular(schema, prop) {
@@ -302,15 +307,17 @@ function markCircular(schema, prop) {
302307

303308
/**
304309
* Callback that is called foreach schema found
310+
*
305311
* @private
306312
* @callback FoundSchemaCallback
307313
* @param {Schema} schema found.
308-
*/
314+
*/
309315
/**
310316
* Recursively go through each schema and execute callback.
311-
*
317+
*
312318
* @private
313319
* @param {Schema} schema found.
320+
* @param schemaContent
314321
* @param {FoundSchemaCallback} callback
315322
*/
316323
function recursiveSchema(schemaContent, callback) {
@@ -322,13 +329,15 @@ function recursiveSchema(schemaContent, callback) {
322329

323330
/**
324331
* Schema crawler
325-
*
332+
*
326333
* @private
327334
* @param {Schema} schemaContent schema.
335+
* @param schema
328336
* @param {Array} seenObj schema elements that crowler went through already.
329-
* @param {Function} callback(schema)
330-
* the function that is called foreach schema found.
331-
* schema {Schema}: the found schema.
337+
* @param callback
338+
* @param {Function} callback(schema)
339+
* the function that is called foreach schema found.
340+
* schema {Schema}: the found schema.
332341
*/
333342
function crawl(schema, seenObj, callback) {
334343
if (isCircular(schema, seenObj)) return true;
@@ -411,13 +420,14 @@ function assignIdToAnonymousSchemas(doc) {
411420

412421
/**
413422
* Recursively go through schema of object type and execute callback.
414-
*
423+
*
415424
* @private
416425
* @param {Schema} schema Object type.
417426
* @param {Array} seenObj schema elements that crawler went through already.
418-
* @param {Function} callback(schema)
419-
* the function that is called foreach schema found.
420-
* schema {Schema}: the found schema.
427+
* @param callback
428+
* @param {Function} callback(schema)
429+
* the function that is called foreach schema found.
430+
* schema {Schema}: the found schema.
421431
*/
422432
function recursiveSchemaObject(schema, seenObj, callback) {
423433
if (schema.additionalProperties() !== undefined && typeof schema.additionalProperties() !== 'boolean') {
@@ -434,13 +444,14 @@ function recursiveSchemaObject(schema, seenObj, callback) {
434444

435445
/**
436446
* Recursively go through schema of array type and execute callback.
437-
*
447+
*
438448
* @private
439449
* @param {Schema} schema Array type.
440450
* @param {Array} seenObj schema elements that crowler went through already.
441-
* @param {Function} callback(schema)
442-
* the function that is called foreach schema found.
443-
* schema {Schema}: the found schema.
451+
* @param callback
452+
* @param {Function} callback(schema)
453+
* the function that is called foreach schema found.
454+
* schema {Schema}: the found schema.
444455
*/
445456
function recursiveSchemaArray(schema, seenObj, callback) {
446457
if (schema.additionalItems() !== undefined) {

lib/models/base.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const ParserError = require('../errors/parser-error');
55
*
66
* @class
77
* @alias module:@asyncapi/parser#Base
8-
* @returns {Base}
8+
* @returns {Base}
99
*/
1010
class Base {
1111
constructor (json) {
@@ -14,7 +14,8 @@ class Base {
1414
}
1515

1616
/**
17-
* @returns {any}
17+
* @param {any} key Key to find
18+
* @returns {any} The value for the given key
1819
*/
1920
json(key) {
2021
if (key === undefined) return this._json;

lib/models/channel-parameter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const MixinSpecificationExtensions = require('../mixins/specification-extensions
1111
*
1212
* @class
1313
* @alias module:@asyncapi/parser#ChannelParameter
14-
* @extends Base
14+
* @augments Base
1515
* @mixes MixinDescription
1616
* @mixes MixinSpecificationExtensions
1717
* @returns {ChannelParameter}

lib/models/channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const MixinSpecificationExtensions = require('../mixins/specification-extensions
1414
*
1515
* @class
1616
* @alias module:@asyncapi/parser#Channel
17-
* @extends Base
17+
* @augments Base
1818
* @mixes MixinDescription
1919
* @mixes MixinBindings
2020
* @mixes MixinSpecificationExtensions

0 commit comments

Comments
 (0)