swagger-api / swagger-play

Apache License 2.0
330 stars 181 forks source link

Paths in the cache are overwritten when filtering by pathPart #91

Open baltendo opened 8 years ago

baltendo commented 8 years ago

Hi! I have a problem when I want to filter my APIs by path.

/swagger.json?path=/rest/api/users /swagger.json?path=/rest/api/persons

After I restart the application I can access the "users" api and I can use it in swagger-ui. When I then use another api like "persons" I don't see anything in swagger-ui. When I switch back to the "users" api I don't see anything in swagger-ui. When I restart the application I can see the first used API again. The problem why I don't see anything in swagger-ui is because the paths field is empty.

I debugged the problem a bit and I think the problem is in ApiHelpController.getApiListing: clone.setPaths(clone.getPaths.filterKeys(_.startsWith(pathPart) ))

Here the existing paths are filtered and set to the clone. When I access the "users" api I see that all 20 paths are filtered and 10 paths are left. When I then access the "persons" api I see that the 10 paths are filtered and 0 paths are left. So instead of changing a clone the cache is changed.