anything-llm/server/swagger/init.js
Timothy Carambat defe6054b3
Full developer api (#221)
* Autodocument Swagger API with JSDocs on /v1/ endpoints for API access
implement single-player API keys
WIP Admin API Keys

* Create new api keys as both single and multi-user

* Add boot and telem

* Complete Admin API

* Complete endpoints
dark mode swagger

* update docs

* undo debug

* update docs and readme
2023-08-23 19:15:07 -07:00

37 lines
907 B
JavaScript

const swaggerAutogen = require('swagger-autogen')({ openapi: '3.0.0' });
const doc = {
info: {
version: '1.0.0',
title: 'AnythingLLM Developer API',
description: 'API endpoints that enable programmatic reading, writing, and updating of your AnythingLLM instance. UI supplied by Swagger.io.',
},
host: '/api',
schemes: ['http'],
securityDefinitions: {
BearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT'
}
},
security: [
{ BearerAuth: [] }
],
definitions: {
InvalidAPIKey: {
message: 'Invalid API Key',
},
}
};
const outputFile = './openapi.json';
const endpointsFiles = [
'../endpoints/api/auth/index.js',
'../endpoints/api/admin/index.js',
'../endpoints/api/document/index.js',
'../endpoints/api/workspace/index.js',
'../endpoints/api/system/index.js',
];
swaggerAutogen(outputFile, endpointsFiles, doc)