-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const swaggerJsdoc = require('swagger-jsdoc'); | ||
Check failure on line 1 in packages/rest-api/generate-swagger.js GitHub Actions / lint
Check warning on line 1 in packages/rest-api/generate-swagger.js GitHub Actions / lint
Check failure on line 1 in packages/rest-api/generate-swagger.js GitHub Actions / lint
|
||
const fs = require('fs'); | ||
Check failure on line 2 in packages/rest-api/generate-swagger.js GitHub Actions / lint
Check warning on line 2 in packages/rest-api/generate-swagger.js GitHub Actions / lint
Check failure on line 2 in packages/rest-api/generate-swagger.js GitHub Actions / lint
|
||
|
||
const options = { | ||
definition: { | ||
openapi: '3.0.0', | ||
info: { | ||
title: 'Synapse REST API', | ||
version: '1.8.4', | ||
description: 'A node.js project exposing a rest api for synapse sdk quotes', | ||
Check warning on line 10 in packages/rest-api/generate-swagger.js GitHub Actions / lint
|
||
} | ||
Check warning on line 11 in packages/rest-api/generate-swagger.js GitHub Actions / lint
|
||
}, | ||
apis: ['./src/routes/*.ts'] | ||
Check warning on line 13 in packages/rest-api/generate-swagger.js GitHub Actions / lint
|
||
}; | ||
Check warning on line 14 in packages/rest-api/generate-swagger.js GitHub Actions / lint
|
||
|
||
const swaggerSpec = swaggerJsdoc(options); | ||
Check warning on line 16 in packages/rest-api/generate-swagger.js GitHub Actions / lint
|
||
fs.writeFileSync('swagger.json', JSON.stringify(swaggerSpec, null, 2)); | ||
Check warning on line 17 in packages/rest-api/generate-swagger.js GitHub Actions / lint
|
||
console.log('Swagger JSON generated!'); | ||
Check warning on line 18 in packages/rest-api/generate-swagger.js GitHub Actions / lint
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
definition: { | ||
openapi: '3.0.0', | ||
info: { | ||
title: 'Synapse REST API', | ||
version: '1.8.4', | ||
description: 'A node.js project exposing a rest api for synapse sdk quotes', | ||
} | ||
}, | ||
apis: ['./src/routes/*.ts'] // This will look in all .ts files in src directory | ||
}; |