Skip to content

Commit 351a90e

Browse files
feat: adopt jsdoc for internal docs
This adopts jsdoc as cve-services' mechanism for internal API documentation. This mostly means annotating modules, but not actually writing documentation for them, except for the new authz middleware which is the initial test case. One of the challenges I've had since joining the CVE Services team has been discovering and understanding the internal structure of the codebase, and this is in part my attempt to help ease that problem for others. Signed-off-by: Andrew Lilley Brinker <abrinker@mitre.org>
1 parent f21a9c6 commit 351a90e

72 files changed

Lines changed: 289 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/constants/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @module constants
3+
*/
4+
15
const fs = require('fs')
26
const cveSchemaV5 = JSON.parse(fs.readFileSync('src/middleware/schemas/CVE_JSON_5.2.0_bundled.json'))
37

@@ -8,6 +12,7 @@ const cveSchemaV5 = JSON.parse(fs.readFileSync('src/middleware/schemas/CVE_JSON_
812
* value re-assignment and still allow IDE type-hints and compiled regex
913
*
1014
* @return {defaults}
15+
* @alias module:constants.getConstants
1116
*/
1217
function getConstants () {
1318
/**

src/controller/audit.controller/audit.controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @module controller/audit/controller
3+
*/
4+
15
const mongoose = require('mongoose')
26
const logger = require('../../middleware/logger')
37
const errors = require('./error')

src/controller/audit.controller/audit.middleware.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @module controller/audit/middleware
3+
*/
4+
15
const utils = require('../../utils/utils')
26

37
/**

src/controller/audit.controller/error.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @module controller/audit/error
3+
*/
4+
15
const idrErr = require('../../utils/error')
26

37
class AuditControllerError extends idrErr.IDRError {

src/controller/audit.controller/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @module controller/audit
3+
*/
4+
15
const router = require('express').Router()
26
const controller = require('./audit.controller')
37
const mw = require('../../middleware/middleware')

src/controller/conversation.controller/conversation.controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @module controller/conversation/controller
3+
*/
4+
15
const mongoose = require('mongoose')
26
const logger = require('../../middleware/logger')
37
const getConstants = require('../../../src/constants').getConstants

src/controller/conversation.controller/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @module controller/conversation
3+
*/
4+
15
const router = require('express').Router()
26
const { param, query } = require('express-validator')
37
const controller = require('./conversation.controller')

src/controller/cve-id.controller/cve-id.controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @module controller/cve-id/controller
3+
*/
4+
15
require('dotenv').config()
26
const CveId = require('../../model/cve-id')
37
const logger = require('../../middleware/logger')

src/controller/cve-id.controller/cve-id.middleware.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @module controller/cve-id/middleware
3+
*/
4+
15
const { validationResult } = require('express-validator')
26
const errors = require('./error')
37
const error = new errors.CveIdControllerError()

src/controller/cve-id.controller/error.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @module controller/cve-id/error
3+
*/
4+
15
const idrErr = require('../../utils/error')
26
const getConstants = require('../../constants').getConstants
37

0 commit comments

Comments
 (0)