mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-22 22:06:43 +00:00
Adds to swagger_Formatter to remove injected body parameters since those are 2.0 and ont 3.0 compliant Adds to example_group_helpers to only automatically save request examples in the swagger output on 2xx response, since otherwise it was getting clobbered
166 lines
3.5 KiB
JSON
166 lines
3.5 KiB
JSON
{
|
|
"openapi": "3.0.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"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"examples": {
|
|
"blog": {
|
|
"value": {
|
|
"blog": {
|
|
"title": "foo",
|
|
"content": "bar"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
|
|
],
|
|
"responses": {
|
|
"201": {
|
|
"description": "blog created",
|
|
"content": {
|
|
"application/json": {
|
|
"example": {
|
|
"id": 1,
|
|
"title": "foo",
|
|
"content": "bar",
|
|
"thumbnail": null
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "invalid request",
|
|
"schema": {
|
|
"$ref": "#/components/schemas/errors_object"
|
|
},
|
|
"content": {
|
|
"application/json": {
|
|
"example": {
|
|
"errors": {
|
|
"content": [
|
|
"can't be blank"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"get": {
|
|
"summary": "Searches blogs",
|
|
"tags": [
|
|
"Blogs"
|
|
],
|
|
"description": "Searches blogs by keywords",
|
|
"operationId": "searchBlogs",
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"parameters": [
|
|
{
|
|
"name": "keywords",
|
|
"in": "query",
|
|
"type": "string"
|
|
}
|
|
],
|
|
"responses": {
|
|
"406": {
|
|
"description": "unsupported accept header"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "https://{defaultHost}",
|
|
"variables": {
|
|
"defaultHost": {
|
|
"default": "www.example.com"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"components": {
|
|
"schemas": {
|
|
"errors_object": {
|
|
"type": "object",
|
|
"properties": {
|
|
"errors": {
|
|
"$ref": "#/components/schemas/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",
|
|
"nullable": true
|
|
},
|
|
"thumbnail": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"id",
|
|
"title",
|
|
"content",
|
|
"thumbnail"
|
|
]
|
|
}
|
|
},
|
|
"securitySchemes": {
|
|
"basic_auth": {
|
|
"type": "http",
|
|
"scheme": "basic"
|
|
},
|
|
"api_key": {
|
|
"type": "apiKey",
|
|
"name": "api_key",
|
|
"in": "query"
|
|
}
|
|
}
|
|
}
|
|
} |