Skip to content

Instantly share code, notes, and snippets.

@zeke
Created August 10, 2011 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeke/1135706 to your computer and use it in GitHub Desktop.
Save zeke/1135706 to your computer and use it in GitHub Desktop.
// Sample resource annotation
@Path("/photo.json")
@Api("/photo")
@Produces(Array("application/json"))
class PhotoResourceJSON extends Help
with PhotoResource
// Sample method annotation
@GET
@Path("/{userId}")
@ApiOperation(
value = "Fetches photos by UserId",
responseClass = "com.wordnik.swagr.sandbox.data.Photo",
mutiValueResponse = true,
tags = "DM,PD"
)
@ApiErrors(Array(
new ApiError(code = 400, reason = "Invalid ID supplied"),
new ApiError(code = 403, reason = "Not Authorized to access User"),
new ApiError(code = 404, reason = "User not found")))
def getPhotosById(
@ApiParam(
value="ID of User whose photos need to be fetched",
required=true,
allowMultiple=false,
allowableValues="allowedId1,allowedId2,allowedId3")
@PathParam("userId") userId: String) = {
Response.ok.entity(PhotoApi.getPhotos(userId)).build
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment