Skip to content

Instantly share code, notes, and snippets.

@christianklotz
Created June 6, 2016 14:13
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 christianklotz/24b8c5caea19cbd84ab7b37adad054af to your computer and use it in GitHub Desktop.
Save christianklotz/24b8c5caea19cbd84ab7b37adad054af to your computer and use it in GitHub Desktop.
{
"swagger": "2.0",
"info": {
"title": "Swagger Sample",
"description": "Sample API Playground.",
"version": "1.0.0"
},
"basePath": "/v1",
"schemes": [
"http"
],
"consumes": [
"application/vdn.sample.v1+json"
],
"produces": [
"application/vdn.sample.v1+json"
],
"paths": {
"/books": {
"get": {
"summary": "List all books",
"operationId": "listBooks",
"tags": [
"books"
],
"responses": {
"200": {
"headers": {
"Link": {
"type": "string"
}
},
"description": "An array of books",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Book"
}
}
},
"default": {
"description": "generic error response",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"definitions": {
"Store": {
"type": "object",
"properties": {
"title": {
"type": "string",
"example": "Book Shop"
},
"categories": {
"type": "array",
"items": {
"$ref": "#/definitions/Category"
}
}
}
},
"Category": {
"type": "object",
"properties": {
"title": {
"type": "string",
"example": "Drama"
},
"books": {
"type": "array",
"items": {
"$ref": "#/definitions/Book"
}
}
}
},
"Book": {
"type": "object",
"required": [
"title",
"summary"
],
"properties": {
"title": {
"type": "string",
"example": "Winnie the Pooh"
},
"summary": {
"type": "string",
"example": "Famous children's book"
},
"related_books": {
"type": "array",
"items": {
"$ref": "#/definitions/Book"
}
}
}
},
"Error": {
"type": "object",
"readOnly": true,
"properties": {
"code": {
"type": "integer",
"format": "int64",
"example": 400
},
"message": {
"type": "string",
"example": "Unexpected error"
}
},
"required": [
"message"
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment