audiobookshelf/swagger.js

25 lines
640 B
JavaScript
Raw Normal View History

2024-02-16 03:59:51 +00:00
const fs = require('fs')
const swaggerJSDoc = require('swagger-jsdoc')
const options = {
definition: {
2024-02-17 03:53:33 +00:00
openapi: '3.1.0',
2024-02-16 03:59:51 +00:00
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!')
})