2022-06-10 16:25:16 +00:00
openapi : "3.0.0"
2022-06-04 10:18:48 +00:00
info :
2022-06-04 11:12:05 +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-10 16:25:16 +00:00
version : "0.11.1"
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"
2022-06-10 16:25:16 +00:00
components :
parameters :
KeyInQuery :
in : "query"
name : "key"
schema :
$ref : "#/components/schemas/Key"
PaginationInQueryPage :
in : "query"
name : "ppage"
description : "Page of pagination"
schema :
2022-06-04 10:18:48 +00:00
type : integer
2022-06-10 16:25:16 +00:00
required : false
PaginationInQuerySize :
in : "query"
name : "psize"
description : "Size of each page in pagination"
schema :
2022-06-04 10:18:48 +00:00
type : integer
2022-06-10 16:25:16 +00:00
required : false
ReversedInQuery :
in : "query"
name : "reversed"
description : "If passed, will tell to reverse the result pages"
schema :
type : boolean
required : false
ValueInQuery :
in : "query"
name : "value"
schema :
$ref : "#/components/schemas/Value"
schemas :
Key :
type : integer
description : "REWRITE THIS TYPE AS KEY IN SWAGGER FILE"
Value :
type : integer
description : "REWRITE THIS TYPE AS VALUE IN SWAGGER FILE"
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
2022-06-04 10:18:48 +00:00
paths :
2022-06-04 10:47:22 +00:00
/get :
get :
tags :
- "Read"
parameters :
2022-06-10 16:25:16 +00:00
- allOf :
- $ref : "#/components/parameters/KeyInQuery"
- required : true
2022-06-04 10:47:22 +00:00
responses :
"200" :
description : "Element by key"
2022-06-10 16:25:16 +00:00
content :
"*/*" :
schema :
$ref : "#/components/schemas/Value"
2022-06-04 10:47:22 +00:00
"204" :
description : "No value by id"
/values :
2022-06-04 10:18:48 +00:00
get :
tags :
- "Read"
parameters :
2022-06-10 16:25:16 +00:00
- $ref : "#/components/parameters/PaginationInQueryPage"
- $ref : "#/components/parameters/PaginationInQuerySize"
- $ref : "#/components/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-10 16:25:16 +00:00
content :
"*/*" :
schema :
allOf :
- $ref : "#/components/schemas/PaginationResult"
- properties :
results :
items :
$ref : "#/components/schemas/Value"
2022-06-04 10:47:22 +00:00
/keys :
2022-06-04 10:18:48 +00:00
get :
tags :
- "Read"
parameters :
2022-06-10 16:25:16 +00:00
- $ref : "#/components/parameters/PaginationInQueryPage"
- $ref : "#/components/parameters/PaginationInQuerySize"
- $ref : "#/components/parameters/ReversedInQuery"
- $ref : "#/components/parameters/ValueInQuery"
2022-06-04 10:47:22 +00:00
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-10 16:25:16 +00:00
content :
"*/*" :
schema :
allOf :
- $ref : "#/components/schemas/PaginationResult"
- properties :
results :
items :
$ref : "#/components/schemas/Key"
2022-06-04 10:18:48 +00:00
/contains :
get :
tags :
- "Read"
parameters :
2022-06-10 16:25:16 +00:00
- $ref : "#/components/parameters/KeyInQuery"
2022-06-04 10:18:48 +00:00
required : true
responses :
"200" :
description : "Object with id availability in repo"
2022-06-10 16:25:16 +00:00
content :
"*/*" :
schema :
type : boolean
2022-06-04 10:18:48 +00:00
/count :
get :
tags :
- "Read"
responses :
"200" :
description : "Amount of objects in repo"
2022-06-10 16:25:16 +00:00
content :
"*/*" :
schema :
type : integer
2022-06-04 10:18:48 +00:00
2022-06-04 10:47:22 +00:00
/set :
2022-06-04 10:18:48 +00:00
post :
tags :
- "Write"
2022-06-10 16:25:16 +00:00
requestBody :
content :
"*/*" :
schema :
type : object
additionalProperties :
$ref : "#/components/schemas/Value"
2022-06-04 10:47:22 +00:00
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"
2022-06-10 16:25:16 +00:00
requestBody :
content :
"*/*" :
schema :
type : array
items :
$ref : "#/components/schemas/Key"
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"
2022-06-10 16:25:16 +00:00
requestBody :
content :
"*/*" :
schema :
type : array
items :
$ref : "#/components/schemas/Value"
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"