mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-12 20:31:36 +00:00
25 lines
No EOL
640 B
JavaScript
25 lines
No EOL
640 B
JavaScript
const fs = require('fs')
|
|
const swaggerJSDoc = require('swagger-jsdoc')
|
|
|
|
const options = {
|
|
definition: {
|
|
openapi: '3.1.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!')
|
|
}) |