rswag/test-app/swagger/v1/swagger.json
2017-07-04 09:45:33 +04:30

251 lines
5.3 KiB
JSON

{
"swagger": "2.0",
"info": {
"title": "API V1",
"version": "v1"
},
"paths": {
"/auth-tests/basic": {
"post": {
"summary": "Authenticates with basic auth",
"tags": [
"Auth Test"
],
"operationId": "testBasicAuth",
"security": [
{
"basic_auth": [
]
}
],
"responses": {
"204": {
"description": "Valid credentials"
},
"401": {
"description": "Invalid credentials"
}
}
}
},
"/blogs": {
"post": {
"summary": "Creates a blog",
"tags": [
"Blogs"
],
"description": "Creates a new blog from provided data",
"operationId": "createBlog",
"consumes": [
"application/x-www-form-urlencoded"
],
"parameters": [
{
"name": "blog[title]",
"in": "formData",
"type": "string"
},
{
"name": "blog[content]",
"in": "formData",
"type": "string"
},
{
"name": "blog[thumbnail]",
"in": "formData",
"type": "file"
}
],
"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!!!",
"thumbnail": "thumbnail.png"
}
}
},
"404": {
"description": "blog not found"
}
}
}
},
"/blogs/{id}/upload": {
"parameters": [
{
"name": "id",
"in": "path",
"type": "string",
"required": true
}
],
"put": {
"summary": "upload a blog thumbnail",
"tags": [
"Blogs"
],
"description": "Upload a thumbnail for specific blog by id",
"operationId": "uploadThumbnailBlog",
"consumes": [
"application/x-www-form-urlencoded"
],
"parameters": [
{
"name": "file",
"in": "formData",
"type": "file",
"required": true
}
],
"responses": {
"200": {
"description": "blog updated"
},
"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
},
"thumbnail": {
"type": "string"
}
},
"required": [
"id",
"title",
"content",
"thumbnail"
]
}
},
"securityDefinitions": {
"basic_auth": {
"type": "basic"
},
"api_key": {
"type": "apiKey",
"name": "api_key",
"in": "query"
}
},
"security": [
{
"api_key": [
]
}
]
}