MicroUtils/repos/ktor/kv.yml

202 lines
5.4 KiB
YAML
Raw Permalink Normal View History

2022-06-10 16:25:16 +00:00
openapi: "3.0.0"
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"
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:
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:
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
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:
get:
tags:
- "Read"
parameters:
2022-06-10 16:25:16 +00:00
- $ref: "#/components/parameters/PaginationInQueryPage"
- $ref: "#/components/parameters/PaginationInQuerySize"
- $ref: "#/components/parameters/ReversedInQuery"
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:
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
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"
/contains:
get:
tags:
- "Read"
parameters:
2022-06-10 16:25:16 +00:00
- $ref: "#/components/parameters/KeyInQuery"
required: true
responses:
"200":
description: "Object with id availability in repo"
2022-06-10 16:25:16 +00:00
content:
"*/*":
schema:
type: boolean
/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:47:22 +00:00
/set:
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"
responses:
"200":
2022-06-04 10:47:22 +00:00
description: "Will return 200 if everything has been completed ok"
/unset:
post:
tags:
- "Write"
2022-06-10 16:25:16 +00:00
requestBody:
content:
"*/*":
schema:
type: array
items:
$ref: "#/components/schemas/Key"
responses:
"200":
2022-06-04 10:47:22 +00:00
description: "Objects with keys from body has been unset"
/unsetWithValues:
post:
tags:
- "Write"
2022-06-10 16:25:16 +00:00
requestBody:
content:
"*/*":
schema:
type: array
items:
$ref: "#/components/schemas/Value"
responses:
"200":
2022-06-04 10:47:22 +00:00
description: "Objects with values from body has been unset"