swagger docs added

This commit is contained in:
nquidox 2026-03-01 22:15:10 +03:00
parent 2d965d53ac
commit f962cd8cd9
5 changed files with 585 additions and 0 deletions

136
docs/swagger.yaml Normal file
View file

@ -0,0 +1,136 @@
basePath: /api/v2
definitions:
merch.deleteOriginDTO:
properties:
name:
type: string
type: object
merch.newOriginDTO:
properties:
name:
type: string
type: object
merch.originItem:
properties:
id:
type: integer
name:
type: string
type: object
merch.originsDTO:
properties:
origins:
items:
$ref: '#/definitions/merch.originItem'
type: array
type: object
responses.BadRequest:
properties:
error:
example: error
type: string
type: object
responses.InternalServerError:
properties:
error:
example: error
type: string
type: object
responses.Unauthorized:
properties:
error:
example: error
type: string
type: object
info:
contact: {}
description: Stores data about merch and prices
title: Merch API
version: "2.3"
paths:
/merch/origins:
delete:
consumes:
- application/json
description: Marks origin as deleted by name.
parameters:
- description: origin body
in: body
name: origin
required: true
schema:
$ref: '#/definitions/merch.deleteOriginDTO'
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Delete origin
tags:
- Origins
get:
description: Get all origins
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/merch.originsDTO'
"204":
description: No Content
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Get all origins
tags:
- Origins
post:
consumes:
- application/json
description: Create new origin with name
parameters:
- description: origin body
in: body
name: origin
required: true
schema:
$ref: '#/definitions/merch.newOriginDTO'
responses:
"201":
description: Created
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.BadRequest'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/responses.Unauthorized'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/responses.InternalServerError'
summary: Create new origin
tags:
- Origins
swagger: "2.0"