Skip to content

Instantly share code, notes, and snippets.

@MrLeebo
Last active August 29, 2015 14:15
Show Gist options
  • Save MrLeebo/a905ef2c2aaae203cc57 to your computer and use it in GitHub Desktop.
Save MrLeebo/a905ef2c2aaae203cc57 to your computer and use it in GitHub Desktop.
module.exports =
swagger: "2.0"
info:
title: "API"
description: "This is my API"
version: "1.0.0"
produces: ["application/json"]
consumes: ["application/json"]
basePath: "/api/v1"
paths:
"/pets/{pid}":
"x-alternate-paths": ["/pets/", "/mascotas/{pid}", "/mascotas/"] # mascotas is pets in spanish
get:
operationId: "getPet"
summary: "Get a pet"
description: "Returns a JSON object about a pet"
parameters: [
{ name: 'pid', in: 'path', type: 'string' }
]
responses:
200:
description: "Success"
module.exports = (req, res, next) ->
return next() if req.swagger
res.send 400,
status: "validation failed"
errors: [
code: "INVALID"
message: "Invalid path or path parameter"
]
next(false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment