Backend/docs/swagger.yaml
2025-09-20 19:34:17 +04:00

244 lines
5.5 KiB
YAML

basePath: /api/v1
definitions:
requests.CreatePostRequest:
properties:
content:
minLength: 36
type: string
description:
maxLength: 255
minLength: 8
type: string
title:
maxLength: 255
minLength: 8
type: string
userId:
type: string
required:
- content
- description
- title
- userId
type: object
requests.PutPostRequest:
properties:
content:
type: string
description:
type: string
title:
type: string
type: object
responses.ErrorResponse:
properties:
error_code:
type: integer
message:
type: string
type: object
responses.GetListPostResponseItem:
properties:
description:
type: string
id:
type: string
title:
type: string
type: object
responses.PostResponse:
properties:
content:
type: string
createdAt:
type: string
description:
type: string
id:
type: string
title:
type: string
updatedAt:
type: string
userId:
type: string
type: object
host: localhost:8080
info:
contact:
email: support@swagger.io
name: API Support
url: http://www.swagger.io/support
description: 58team blog's backend
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: 58team blog backend
version: "1.0"
paths:
/images/{path}:
get:
description: Creates new user in system
parameters:
- description: Path to image
in: query
name: path
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
summary: Create new user
/post:
get:
description: Return first 5 posts
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/responses.GetListPostResponseItem'
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Get all posts
tags:
- post
post:
consumes:
- application/json
description: Create new post in blog
parameters:
- description: Post data
in: body
name: request
required: true
schema:
$ref: '#/definitions/requests.CreatePostRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/responses.PostResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Create new post
tags:
- post
/post/{id}:
delete:
description: Delete post by id
parameters:
- description: Id of post
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Delete post
tags:
- post
get:
description: get post by id
parameters:
- description: Id of post
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/responses.PostResponse'
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Get post by id
tags:
- post
put:
description: update post content
parameters:
- description: Id of post
in: path
name: id
required: true
type: string
- description: Post data
in: body
name: request
required: true
schema:
$ref: '#/definitions/requests.PutPostRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/responses.PostResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Update post content
tags:
- post
/post/offset/{offset}:
get:
description: return 5 posts after first offset posts
parameters:
- description: Offset of posts
in: path
name: offset
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/responses.GetListPostResponseItem'
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Get posts after offset
tags:
- post
securityDefinitions:
BasicAuth:
type: basic
swagger: "2.0"