mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-13 21:01:39 +00:00
Added swagger-jsdoc
This commit is contained in:
parent
a9e9808183
commit
4c11ca5a55
2 changed files with 26 additions and 0 deletions
|
|
@ -58,6 +58,7 @@
|
||||||
"mocha": "^10.2.0",
|
"mocha": "^10.2.0",
|
||||||
"nodemon": "^2.0.20",
|
"nodemon": "^2.0.20",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
|
"swagger-jsdoc": "^6.2.8",
|
||||||
"sinon": "^17.0.1"
|
"sinon": "^17.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
25
swagger.js
Normal file
25
swagger.js
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
const fs = require('fs')
|
||||||
|
const swaggerJSDoc = require('swagger-jsdoc')
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
definition: {
|
||||||
|
openapi: '3.0.0',
|
||||||
|
info: {
|
||||||
|
title: 'Audiobookshelf API',
|
||||||
|
version: '1.0.0',
|
||||||
|
description: 'Audiobookshelf API with autogenerated OpenAPI doc',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
apis: ['./server/**/*.js'] // Path to the API docs
|
||||||
|
}
|
||||||
|
|
||||||
|
const openAPISpecification = swaggerJSDoc(options)
|
||||||
|
|
||||||
|
// Write the specification to a file
|
||||||
|
fs.writeFile('./build-docs/swagger-output.json', JSON.stringify(openAPISpecification, null, 2), (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('OpenAPI spec generated successfully!')
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue