scalatra-sample-app
scalatra-sample-app copied to clipboard
applying .{format} to paths
Swagger defines the request/response format at the api level--it's typically shown in the resource listing like this:
http://petstore.swagger.wordnik.com/api/resources.json
That means, you can get api listings by following the paths with the specified format:
http://petstore.swagger.wordnik.com/api/pet.json
Inside the api, you can then access the resource by concatenating the basePath
in the api listing with the operation path, which by convention has the .{format} in it, if used.
With this example, the http://localhost:8080/api/pet.json
shows the .{format}
correctly, but the servlet listens to the the path without the format:
http://localhost:8080/api/pet/3
Note the missing .json
in the path