You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import express from 'express';
import path from 'path';
import http from 'http';
import * as exegesisExpress from 'exegesis-express';
async function createServer() {
// See https://github.com/exegesis-js/exegesis/blob/master/docs/Options.md
const options = {
controllers: path.resolve(__dirname, './controllers')
};
const exegesisMiddleware = await exegesisExpress.middleware(
path.resolve(__dirname, './openApi.yaml'),
options
);
const app = express();
// If you have any body parsers, this should go before them.
app.use(exegesisMiddleware);
app.use((req, res) => {
res.status(404).json({message: `Not found`});
});
app.use((err, req, res, next) => {
res.status(500).json({message: `Internal error: ${err.message}`});
});
const server = http.createServer(app);
server.listen(3000);
}
createServer();
when I run babel-node index.js, then I get:
➜ exegesis babel-node index.js
(node:6771) UnhandledPromiseRejectionWarning: Error: Operation /paths/~1secure/get references security scheme "sessionKey" but no authenticator was provided.
at new Operation (/Users/yaojifeng/WebstormProjects/exegesis/node_modules/exegesis/src/oas3/Operation.ts:133:27)
at Path._operations.HTTP_METHODS.map.filter.reduce (/Users/yaojifeng/WebstormProjects/exegesis/node_modules/exegesis/src/oas3/Path.ts:36:38)
at Array.reduce (<anonymous>)
at new Path (/Users/yaojifeng/WebstormProjects/exegesis/node_modules/exegesis/src/oas3/Path.ts:34:14)
at new Paths (/Users/yaojifeng/WebstormProjects/exegesis/node_modules/exegesis/src/oas3/Paths/index.ts:17:32)
at new OpenApi (/Users/yaojifeng/WebstormProjects/exegesis/node_modules/exegesis/src/oas3/OpenApi.ts:50:23)
at Object.<anonymous> (/Users/yaojifeng/WebstormProjects/exegesis/node_modules/exegesis/src/oas3/index.ts:16:12)
at Generator.next (<anonymous>)
at /Users/yaojifeng/WebstormProjects/exegesis/node_modules/exegesis/lib/oas3/index.js:7:71
at new Promise (<anonymous>)
(node:6771) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:6771) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The text was updated successfully, but these errors were encountered:
Kind of annoying that this in an unhandled promise rejection. But, the root of the problem is that your OpenAPI document has a path called "secure" that references a security scheme:
Version Info
Problem
My openAPI.yaml is:
copy from 'https://github.com/exegesis-js/exegesis-express/blob/master/test/integrationSample/openapi.yaml'.
Main is index.js:
when I run babel-node index.js, then I get:
The text was updated successfully, but these errors were encountered: