2022-06-04 10:18:48 +00:00
swagger : "2.0"
info :
2022-06-04 10:47:22 +00:00
description : "This is a template for the KeyValue repositories from [microutils](https://github.com/InsanusMokrassar/MicroUtils/tree/master/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/key_value)"
2022-06-04 10:18:48 +00:00
version : "0.11.0"
2022-06-04 10:47:22 +00:00
title : "KeyValue Repo"
2022-06-04 10:18:48 +00:00
contact :
email : "ovsyannikov.alexey95@gmail.com"
tags :
- name : "Read"
description : "Operations with `get` request in most cases"
- name : "Write"
description : "Operations with `post` request in most cases"
parameters :
2022-06-04 10:47:22 +00:00
KeyInQuery :
2022-06-04 10:18:48 +00:00
in : "query"
2022-06-04 10:47:22 +00:00
name : "key"
2022-06-04 10:18:48 +00:00
allOf :
- $ref : "#/definitions/Key"
2022-06-04 10:47:22 +00:00
KeysInBody :
2022-06-04 10:18:48 +00:00
in : "body"
name : "body"
type : array
items :
$ref : "#/definitions/Key"
2022-06-04 10:47:22 +00:00
ValuesInBody :
2022-06-04 10:18:48 +00:00
in : "body"
name : "body"
type : array
items :
2022-06-04 10:47:22 +00:00
$ref : "#/definitions/Value"
2022-06-04 10:18:48 +00:00
PaginationInQueryPage :
in : "query"
type : integer
name : "ppage"
description : "Page of pagination"
required : false
PaginationInQuerySize :
in : "query"
type : integer
name : "psize"
description : "Size of each page in pagination"
required : false
2022-06-04 10:47:22 +00:00
ReversedInQuery :
in : "query"
type : boolean
name : "reversed"
description : "If passed, will tell to reverse the result pages"
required : false
ValueInQuery :
in : "query"
name : "value"
allOf :
- $ref : "#/definitions/Value"
MapInBody :
in : "body"
name : "body"
allOf :
- $ref : "#/definitions/Map"
2022-06-04 10:18:48 +00:00
definitions :
Key :
type : integer
description : "REWRITE THIS TYPE AS KEY IN SWAGGER FILE"
Value :
type : integer
description : "REWRITE THIS TYPE AS VALUE IN SWAGGER FILE"
2022-06-04 10:47:22 +00:00
Map :
2022-06-04 10:18:48 +00:00
type : object
2022-06-04 10:47:22 +00:00
description : "Map of objects"
2022-06-04 10:18:48 +00:00
PaginationResult :
type : object
properties :
page :
type : integer
description : "Page of pagination"
pagesNumber :
type : integer
description : "Count of pages with the size from this pagination"
size :
type : integer
description : "Size of each page in pagination"
results :
type : array
description : "Array of all elements on that page. Size of pagination and size of array can be different and it can be interpreted like current page is the last one"
items :
type : object
paths :
2022-06-04 10:47:22 +00:00
/get :
get :
tags :
- "Read"
parameters :
- $ref : "#/parameters/KeyInQuery"
required : true
responses :
"200" :
description : "Element by key"
schema :
$ref : "#/definitions/Value"
"204" :
description : "No value by id"
/values :
2022-06-04 10:18:48 +00:00
get :
tags :
- "Read"
parameters :
- $ref : "#/parameters/PaginationInQueryPage"
- $ref : "#/parameters/PaginationInQuerySize"
2022-06-04 10:47:22 +00:00
- $ref : "#/parameters/ReversedInQuery"
2022-06-04 10:18:48 +00:00
responses :
"200" :
2022-06-04 10:47:22 +00:00
description : "Pagination with elements"
2022-06-04 10:18:48 +00:00
schema :
allOf :
- $ref : "#/definitions/PaginationResult"
- properties :
results :
items :
$ref : "#/definitions/Value"
2022-06-04 10:47:22 +00:00
/keys :
2022-06-04 10:18:48 +00:00
get :
tags :
- "Read"
parameters :
2022-06-04 10:47:22 +00:00
- $ref : "#/parameters/PaginationInQueryPage"
- $ref : "#/parameters/PaginationInQuerySize"
- $ref : "#/parameters/ReversedInQuery"
- $ref : "#/parameters/ValueInQuery"
required : false
2022-06-04 10:18:48 +00:00
responses :
"200" :
2022-06-04 10:47:22 +00:00
description : "Pagination with elements"
2022-06-04 10:18:48 +00:00
schema :
2022-06-04 10:47:22 +00:00
allOf :
- $ref : "#/definitions/PaginationResult"
- properties :
results :
items :
$ref : "#/definitions/Key"
2022-06-04 10:18:48 +00:00
/contains :
get :
tags :
- "Read"
parameters :
2022-06-04 10:47:22 +00:00
- $ref : "#/parameters/KeyInQuery"
2022-06-04 10:18:48 +00:00
required : true
responses :
"200" :
description : "Object with id availability in repo"
schema :
type : boolean
/count :
get :
tags :
- "Read"
responses :
"200" :
description : "Amount of objects in repo"
schema :
type : integer
2022-06-04 10:47:22 +00:00
/set :
2022-06-04 10:18:48 +00:00
post :
tags :
- "Write"
parameters :
2022-06-04 10:47:22 +00:00
- allOf :
- $ref : "#/parameters/MapInBody"
- additionalProperties :
$ref : "#/definitions/Value"
description : "Map with new elements to set. Use keys as a keys of this map"
2022-06-04 10:18:48 +00:00
responses :
"200" :
2022-06-04 10:47:22 +00:00
description : "Will return 200 if everything has been completed ok"
/unset :
2022-06-04 10:18:48 +00:00
post :
tags :
- "Write"
parameters :
2022-06-04 10:47:22 +00:00
- $ref : "#/parameters/KeysInBody"
2022-06-04 10:18:48 +00:00
responses :
"200" :
2022-06-04 10:47:22 +00:00
description : "Objects with keys from body has been unset"
/unsetWithValues :
2022-06-04 10:18:48 +00:00
post :
tags :
- "Write"
parameters :
2022-06-04 10:47:22 +00:00
- $ref : "#/parameters/ValuesInBody"
2022-06-04 10:18:48 +00:00
responses :
"200" :
2022-06-04 10:47:22 +00:00
description : "Objects with values from body has been unset"