/
SvetlanaGit
/
api-doc-example
Обзор
Документация
Войти
/
SvetlanaGit
/
api-doc-example
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
docs/docs.go
266 строк
9 KB
Svetlana
first_commit
06 авг 2026, 20:56
06 авг 2026, 20:56
2efcc5a
Код
Авторство
О чём код?
// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": { "name": "API Support", "email": "support@example.com" }, "license": { "name": "MIT", "url": "https://opensource.org/licenses/MIT" }, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/todos": { "get": { "description": "Возвращает список всех существующих задач", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "todos" ], "summary": "Получить все задачи", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.Todo" } } } } }, "post": { "description": "Добавляет новую задачу в список", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "todos" ], "summary": "Создать новую задачу", "parameters": [ { "description": "Объект задачи", "name": "todo", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.Todo" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/models.Todo" } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/todos/{id}": { "get": { "description": "Возвращает одну задачу по её идентификатору", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "todos" ], "summary": "Получить задачу по ID", "parameters": [ { "type": "integer", "description": "ID задачи", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.Todo" } }, "404": { "description": "Not Found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "put": { "description": "Обновляет существующую задачу по ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "todos" ], "summary": "Обновить задачу", "parameters": [ { "type": "integer", "description": "ID задачи", "name": "id", "in": "path", "required": true }, { "description": "Обновленный объект задачи", "name": "todo", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.Todo" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.Todo" } }, "404": { "description": "Not Found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "delete": { "description": "Удаляет задачу по ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "todos" ], "summary": "Удалить задачу", "parameters": [ { "type": "integer", "description": "ID задачи", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "Not Found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } } }, "definitions": { "models.Todo": { "description": "Модель элемента списка задач (Todo).", "type": "object", "properties": { "completed": { "type": "boolean", "example": false }, "description": { "type": "string", "example": "Молоко, хлеб, яйца" }, "id": { "type": "integer", "example": 1 }, "title": { "type": "string", "example": "Купить продукты" } } } } }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "1.0", Host: "localhost:8080", BasePath: "/", Schemes: []string{}, Title: "Todo API", Description: "Простой REST API для управления списком задач (Todo).", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", RightDelim: "}}", } func init() { swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) }