swagger-express-middleware icon indicating copy to clipboard operation
swagger-express-middleware copied to clipboard

Sample1 cannot run

Open rrandom opened this issue 7 years ago • 4 comments

410 returned

rrandom avatar Jan 04 '18 08:01 rrandom

A few more details:

If you do the following:

git clone [email protected]:BigstickCarpet/swagger-express-middleware.git
cd swagger-express-middleware
npm install
cd samples
node sample1.js

You get a 410 response and the following in the logs:

  swagger:middleware GET / does not exist, but the response schema defines a fallback value.  So, using the fallback value +3ms
  swagger:middleware Setting 0 response headers... +0ms
  swagger:middleware Unable to find the file: "undefined".  Sending an HTTP 410 (Gone) +1m
Error: / no longer exists
    at ono (/swagger-express-middleware/node_modules/ono/lib/index.js:62:17)
    at /swagger-express-middleware/lib/mock/index.js:301:12
    at FSReqWrap.cb [as oncomplete] (fs.js:312:19)

On debugging, it looks as though sendFile in lib/mock/index.js is expecting the file parameter to be a Buffer object for the contents of index.html. file is being passed as a raw string containing the contents of index.html, which sendFile tries to run fs.exists(file.path on and subsequently falls over.

I guess there needs to be a route added to sendFile that allows file to be passed as a raw string.

penx avatar Feb 05 '18 14:02 penx

Thanks! @penx

rrandom avatar Feb 28 '18 05:02 rrandom

Until May 15, I still cannot run node sample1.js.... Is there any solution for this bug?

DozenCoder avatar May 15 '18 08:05 DozenCoder

This issue still exists. Sample 2 also cannot be run

callmekatootie avatar Jun 24 '18 06:06 callmekatootie