swagger-suite icon indicating copy to clipboard operation
swagger-suite copied to clipboard

"Try it out" in /docs for petstore returns 404 Not found

Open jasonrig opened this issue 10 years ago • 9 comments

It appears that the request URI is not appended to the basePath. Note how the request does not include the /pets suffix.

Steps to reproduce:

  1. Install swagger-suite via npm / bower
  2. npm run petstore
  3. go to http://localhost:3000/docs/
  4. Attempt to get a list of pets using the /pets method

Request:

http://localhost:3000/api HTTP/1.1
Content-Type:

Response:

HTTP/1.1 404 Not Found
Date: Mon, 26 Jan 2015 23:09:32 GMT
Vary: 127.0.0.1
X-Powered-By: Swagger-Server Mock
Access-Control-Max-Age: 0
Access-Control-Allow-Methods: get, put, post, delete, options, head, patch
Content-Type: application/json; charset=utf-8
Access-Control-Allow-Origin: 127.0.0.1
Access-Control-Allow-Credentials: true
Connection: keep-alive
Access-Control-Allow-Headers: 
Content-Length: 34
ETag: W/"22-918ae4c0"
{
  "code": 404,
  "message": "Not Found"
}

jasonrig avatar Jan 26 '15 23:01 jasonrig

Just confirming shoudnt your request look like

http://localhost:3000/api/pets

JehandadK avatar Feb 03 '15 16:02 JehandadK

Yes that's right. For some reason /pets isn't part of the URL...

jasonrig avatar Feb 04 '15 02:02 jasonrig

hello, i tried the petstore. and click Try it out button to test on GET /pets, only get Response Body [] Response Code 200 Response Headers { "X-Powered-By": "Swagger-Server Mock", "Access-Control-Allow-Origin": "202.138.249.208", "Vary": "202.138.249.208", "Access-Control-Allow-Credentials": "true", "Access-Control-Max-Age": "0", "Access-Control-Allow-Methods": "GET, POST", "Content-Type": "application/json; charset=utf-8", "Content-Length": "2", "Etag": "W/"2-d4cbb29"", "Date": "Wed, 25 Feb 2015 02:35:25 GMT", "Connection": "keep-alive" } where is the pets?

setiawand avatar Feb 25 '15 02:02 setiawand

I'm working feverishly on a new release of Swagger-Suite (and Swagger-Server, and Swagger-Parser, and Swagger-Express-Middleware) that will fix a ton of issues with the current 0.x version. I've written nearly 2000 unit tests, so I'm much more confident in the quality and stability of the new version. Expect it out in the next few weeks...

JamesMessinger avatar Feb 25 '15 23:02 JamesMessinger

Great news! Thanks!

On Thu, Feb 26, 2015 at 4:35 AM, James Messinger [email protected] wrote:

I'm working feverishly on a new release of Swagger-Suite (and Swagger-Server, and Swagger-Parser, and Swagger-Express-Middleware) that will fix a ton of issues with the current 0.x version. I've written nearly 2000 unit tests, so I'm much more confident in the quality and stability of the new version. Expect it out in the next few weeks...

— Reply to this email directly or view it on GitHub https://github.com/BigstickCarpet/swagger-suite/issues/5#issuecomment-76085432 .

JehandadK avatar Feb 27 '15 12:02 JehandadK

Just FYI - the new version is coming along nicely. The entire middleware layer is done now, and I've released it as a separate, standalone project (Swagger Express Middleware), complete with code samples and walkthroughs. Feel free to check it out and let me know what you think.

The goal of Swagger Express Middleware is to be a set of plug-and-play middleware modules that can be used in any Express app. Whereas Swagger Server goes a little further and actually extends Express with extra features that are specific to Swagger APIs.

JamesMessinger avatar Mar 16 '15 14:03 JamesMessinger

awesome!

setiawand avatar Mar 19 '15 04:03 setiawand

any news? :) BTW I think the path problem is part of swagger-ui or swagger-editor last release, I dowloaded it and I get the same behaviour

rLitto avatar Apr 20 '15 13:04 rLitto

I'm making progress, but it's been slow-going for the past couple of weeks because I've been swamped working on other projects. Nonetheless, I've finished refactoring Swagger Server to use the new middleware layer, and I hope to work on it more this coming weekend.

JamesMessinger avatar Apr 20 '15 16:04 JamesMessinger