Fix documentation

Fix missing module declarations, broken lings, broken formating and
incorrect scopes in the documentation.  For modules split over several
files it appears the only viable option is to use the memberof directive
on each documented member and only declare the index file as a module.
This commit is contained in:
Hornwitser committed 2020-05-08 17:28:06 +02:00
1 parent 7a9b6592e6
commit b151dd8469
22 files changed
+318 -56

No files matched your search

+34
View File
@@ -1,3 +1,7 @@
/**
* JSON schemas used for validating link messages
* @module
*/
const ajv = new (require('ajv'))({
verbose: true,
format: "full",
@@ -24,8 +28,20 @@ const messageSchema = {
},
};
/**
* Validator for message schemas
* @function
* @param {Object} obj - Object to validate
* @returns {boolean} True if object passed validation.
*/
const message = ajv.compile(messageSchema);
/**
* Validator for heartbeat messages
* @function
* @param {Object} obj - Object to validate
* @returns {boolean} True if object passed validation.
*/
const heartbeat = ajv.compile({
$schema: "http://json-schema.org/draft-07/schema#",
title: "Heartbeat",
@@ -47,6 +63,12 @@ const heartbeat = ajv.compile({
},
});
/**
* Validator for server sent part of handshake
* @function
* @param {Object} obj - Object to validate
* @returns {boolean} True if object passed validation.
*/
const serverHandshake = ajv.compile({
$schema: "http://json-schema.org/draft-07/schema#",
title: "Server Handshake",
@@ -104,6 +126,12 @@ const serverHandshake = ajv.compile({
],
});
/**
* Validator for client sent part of handshake
* @function
* @param {Object} obj - Object to validate
* @returns {boolean} True if object passed validation.
*/
const clientHandshake = ajv.compile({
$schema: "http://json-schema.org/draft-07/schema#",
title: "Client Message",
@@ -162,6 +190,12 @@ const clientHandshake = ajv.compile({
module.exports = {
/**
* Compile JSON schema into validator
* @function
* @param {Object} schema - JSON schema to create validator for.
* @returns {Function} Validator for the schema.
*/
compile: ajv.compile.bind(ajv),
message,