mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-27 12:38:46 +00:00
202 lines
5.4 KiB
YAML
202 lines
5.4 KiB
YAML
openapi: "3.0.0"
|
|
info:
|
|
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)"
|
|
version: "0.11.1"
|
|
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"
|
|
|
|
components:
|
|
parameters:
|
|
KeyInQuery:
|
|
in: "query"
|
|
name: "key"
|
|
schema:
|
|
$ref: "#/components/schemas/Key"
|
|
PaginationInQueryPage:
|
|
in: "query"
|
|
name: "ppage"
|
|
description: "Page of pagination"
|
|
schema:
|
|
type: integer
|
|
required: false
|
|
PaginationInQuerySize:
|
|
in: "query"
|
|
name: "psize"
|
|
description: "Size of each page in pagination"
|
|
schema:
|
|
type: integer
|
|
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:
|
|
/get:
|
|
get:
|
|
tags:
|
|
- "Read"
|
|
parameters:
|
|
- allOf:
|
|
- $ref: "#/components/parameters/KeyInQuery"
|
|
- required: true
|
|
responses:
|
|
"200":
|
|
description: "Element by key"
|
|
content:
|
|
"*/*":
|
|
schema:
|
|
$ref: "#/components/schemas/Value"
|
|
"204":
|
|
description: "No value by id"
|
|
/values:
|
|
get:
|
|
tags:
|
|
- "Read"
|
|
parameters:
|
|
- $ref: "#/components/parameters/PaginationInQueryPage"
|
|
- $ref: "#/components/parameters/PaginationInQuerySize"
|
|
- $ref: "#/components/parameters/ReversedInQuery"
|
|
responses:
|
|
"200":
|
|
description: "Pagination with elements"
|
|
content:
|
|
"*/*":
|
|
schema:
|
|
allOf:
|
|
- $ref: "#/components/schemas/PaginationResult"
|
|
- properties:
|
|
results:
|
|
items:
|
|
$ref: "#/components/schemas/Value"
|
|
/keys:
|
|
get:
|
|
tags:
|
|
- "Read"
|
|
parameters:
|
|
- $ref: "#/components/parameters/PaginationInQueryPage"
|
|
- $ref: "#/components/parameters/PaginationInQuerySize"
|
|
- $ref: "#/components/parameters/ReversedInQuery"
|
|
- $ref: "#/components/parameters/ValueInQuery"
|
|
required: false
|
|
responses:
|
|
"200":
|
|
description: "Pagination with elements"
|
|
content:
|
|
"*/*":
|
|
schema:
|
|
allOf:
|
|
- $ref: "#/components/schemas/PaginationResult"
|
|
- properties:
|
|
results:
|
|
items:
|
|
$ref: "#/components/schemas/Key"
|
|
/contains:
|
|
get:
|
|
tags:
|
|
- "Read"
|
|
parameters:
|
|
- $ref: "#/components/parameters/KeyInQuery"
|
|
required: true
|
|
responses:
|
|
"200":
|
|
description: "Object with id availability in repo"
|
|
content:
|
|
"*/*":
|
|
schema:
|
|
type: boolean
|
|
/count:
|
|
get:
|
|
tags:
|
|
- "Read"
|
|
responses:
|
|
"200":
|
|
description: "Amount of objects in repo"
|
|
content:
|
|
"*/*":
|
|
schema:
|
|
type: integer
|
|
|
|
|
|
/set:
|
|
post:
|
|
tags:
|
|
- "Write"
|
|
requestBody:
|
|
content:
|
|
"*/*":
|
|
schema:
|
|
type: object
|
|
additionalProperties:
|
|
$ref: "#/components/schemas/Value"
|
|
description: "Map with new elements to set. Use keys as a keys of this map"
|
|
responses:
|
|
"200":
|
|
description: "Will return 200 if everything has been completed ok"
|
|
/unset:
|
|
post:
|
|
tags:
|
|
- "Write"
|
|
requestBody:
|
|
content:
|
|
"*/*":
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/Key"
|
|
responses:
|
|
"200":
|
|
description: "Objects with keys from body has been unset"
|
|
/unsetWithValues:
|
|
post:
|
|
tags:
|
|
- "Write"
|
|
requestBody:
|
|
content:
|
|
"*/*":
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: "#/components/schemas/Value"
|
|
responses:
|
|
"200":
|
|
description: "Objects with values from body has been unset"
|