scalatra/scalatra — pull request #402 by cb372 (2014-06-17 06:57:04+00:00)
Title: Fix swagger api lookup

Currently (Scalatra 2.3.0), you have to set the name of each API servlet to be equal to the path (minus the leading slash). e.g. if you mount your servlet at `/api/foo`, you have to give it a name of `api/foo`.

You do this either by naming the servlet handler when you mount it in ScalatraBootstrap:

```scala
context.mount(new FooApiCtlr(swagger), "/api/foo/*", "api/foo")
```

or by overriding the `applicationName` field in `SwaggerSupportSyntax`:

```scala
class FooApiCtlr(implicit swagger: Swagger) extends ... {
override protected val applicationName = Some(swaggerAppName)
// ...
}
```

The reason the name has to be the same as the path is that the key used to _insert_ the API listing into `SwaggerEngine#_docs` is the name, while the key used to _lookup_ the listing is the resource path.

Since this restriction is undocumented and quite unintuitive, I just got rid of the idea of an API 'name' and fixed the code to use the resource path to generate the listing path (i.e. the map key).

If the above doesn't make sense, please take a look at the spec.