martypitt/swagger-springmvc-example

Project doesn't work as expected

archislav opened this issue · 9 comments

404 HTTP status for http://localhost:8080/swagger-springmvc-test/apidoc

According to DocumentationController main API info here: http://localhost:8080/swagger-springmvc-test/resources

and pets API info: http://localhost:8080/swagger-springmvc-test/resources/pets
and users API info: http://localhost:8080/swagger-springmvc-test/resources/users

index.html - does handle these urls correctly.
It waits for description on URLS:
http://localhost:8080/swagger-springmvc-test/pets
http://localhost:8080/swagger-springmvc-test/users

Maybe its a bug of swagger-springmvc module.

@archislav I'm getting the same results as you with respect to the 404 and http://localhost:8080/swagger-springmvc-test/apidoc.
The "resources/pets" says "Fetching _pets_findByTags..." indefinitely and "resources/users" says "Fetching users{petId}...". Is this what you mean by "waits on description"?

I mean that accoring to index.html and js scripts - API description must be on URLS:
http://localhost:8080/swagger-springmvc-test/pets
http://localhost:8080/swagger-springmvc-test/users

And you see "Fetching _users{petId}...", beacouse js script crashes.

basePath property in spring-servlet.xml file has to be changed to:
http://localhost:8080/swagger-springmvc-test/resources
After this change everything works for me.

@iturcino
Can you please explain what urls are you trying and what results you are
receiving after you make the change you mentioned.
I made the change but am not seeing any results (I think I'm not looking
for the correct things).
Thanks

On Sat, Nov 24, 2012 at 11:54 PM, iturcino notifications@github.com wrote:

basePath property in spring-servlet.xml file has to be changed to:
http://localhost:8080/swagger-springmvc-test/resources
After this change everything works for me.


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-10684228.

Hi,
after updating basePath property as I said above, I run jetty and go to following URL (as explained in README.md file):
http://localhost:8080/swagger-springmvc-test/index.html

In textfield on that page I enter:
http://localhost:8080/swagger-springmvc-test/resources

hit "Explore" button and I get description of /pets and /users services.

Hope this helps.

@iturcino Thanks! After changing the "spring-servlet.xml" and entering "http://localhost:8080/swagger-springmvc-test/resources" in the text-field it does work.
The thing I don't understand is why the only commit to this project was to update this very property (but to a different unusable value). Maybe @martypitt can help shed some light.

Looking into swagger-springmvc I can see that in commit '7502de961a809e02c2acda2464ecae5c805fb02f' the resource listing was moved from 'apidoc' to 'resources'.
I guess the example project wasn't kept up to date.
I'll send in a pull request for the README.md and the spring-servlet.xml file

I am using this in combination with swagger ui, after some testing i came to the same conclusion as you did here that in order for the documentation to be retreived correctly you need to add /resources to your basePath. In this case all the documentation is retreived correctly. However a problem occurs if you then want to run the API. It now tries to call the /resources. To clarify an example:

Rest location: localhost/api/example
Documentation: localhost/api/resources/example

So what i would like is my basepath to be localhost/api.

Any idea's on this / experiences?

This isssue should now be fixed using the 0.3.1 Release