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
Describe the bug
if using an express router instead of app express, a path not defined does not return the Not Found error
Examples and context
example with code bug_openapi.js
constexpress=require("express");const{ OpenApiValidator }=require("express-openapi-validator");asyncfunctionexecute(){constrouter=express.Router();awaitnewOpenApiValidator({apiSpec: {openapi: "3.0.0",info: {version: "1.0.0",title: "test bug OpenApiValidator"},servers: [{url: "http://localhost:8080/api/"}],paths: {"/": {get: {responses: {200: {description: "home api"}}}}},},}).install(router);router.get("/",(req,res)=>res.status(200).send("home api\n"));router.get("/notDefined",(req,res)=>res.status(200).send("url api not defined\n"));constapp=express();app.get('/',(req,res)=>res.status(200).send("home\n"));app.use("/api",router);app.listen(3000);console.log("server start port 3000");}execute().catch((error)=>console.error(error.stack));
node bug_openapi.js to start server curl http://localhost:3000/api/notDefined return 200 - url api not defined.
however, a path is not defined in apiSpec. The return should have been 404 Not Found
The text was updated successfully, but these errors were encountered:
Describe the bug
if using an express router instead of app express, a path not defined does not return the Not Found error
Examples and context
example with code bug_openapi.js
node bug_openapi.js
to start servercurl http://localhost:3000/api/notDefined
return 200 - url api not defined.however, a path is not defined in apiSpec. The return should have been 404 Not Found
The text was updated successfully, but these errors were encountered: