rswag/test-app/swagger/v1/swagger.json
2017-05-19 11:11:13 -07:00

174 lines
3.6 KiB
JSON

{
"swagger": "2.0",
"info": {
"title": "API V1",
"version": "v1"
},
"paths": {
"/blogs": {
"post": {
"summary": "Creates a blog",
"tags": [
"Blogs"
],
"description": "Creates a new blog from provided data",
"operationId": "createBlog",
"consumes": [
"application/json"
],
"parameters": [
{
"name": "blog",
"in": "body",
"schema": {
"$ref": "#/definitions/blog"
}
}
],
"responses": {
"201": {
"description": "blog created"
},
"422": {
"description": "invalid request",
"schema": {
"$ref": "#/definitions/errors_object"
}
}
}
},
"get": {
"summary": "Searches blogs",
"tags": [
"Blogs"
],
"description": "Searches blogs by keywords",
"operationId": "searchBlogs",
"produces": [
"application/json"
],
"parameters": [
{
"name": "keywords",
"in": "query",
"type": "string"
}
],
"responses": {
"200": {
"description": "success",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/blog"
}
}
}
}
}
},
"/blogs/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"type": "string",
"required": true
}
],
"get": {
"summary": "Retrieves a blog",
"tags": [
"Blogs"
],
"description": "Retrieves a specific blog by id",
"operationId": "getBlog",
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "blog found",
"headers": {
"ETag": {
"type": "string"
},
"Last-Modified": {
"type": "string"
},
"Cache-Control": {
"type": "string"
}
},
"schema": {
"$ref": "#/definitions/blog"
},
"examples": {
"application/json": {
"id": 1,
"title": "Hello world!",
"content": "Hello world and hello universe. Thank you all very much!!!"
}
}
},
"404": {
"description": "blog not found"
}
}
}
}
},
"definitions": {
"errors_object": {
"type": "object",
"properties": {
"errors": {
"$ref": "#/definitions/errors_map"
}
}
},
"errors_map": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
"blog": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"title": {
"type": "string"
},
"content": {
"type": "string",
"x-nullable": true
}
},
"required": [
"id",
"title",
"content"
]
}
},
"securityDefinitions": {
"api_key": {
"type": "apiKey",
"name": "api_key",
"in": "query"
}
},
"security": [
{
"api_key": [
]
}
]
}