mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-25 19:48:45 +00:00
fixes in kv and kvs of ktor repos
This commit is contained in:
parent
8965752055
commit
b187043ee1
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## 0.11.1
|
## 0.11.1
|
||||||
|
|
||||||
|
* `Repos`
|
||||||
|
* `Ktor`
|
||||||
|
* In `configureReadKeyValueRepoRoutes` and `configureReadKeyValuesRepoRoutes` configurators fixed requiring of `reversed` property
|
||||||
|
|
||||||
## 0.11.0
|
## 0.11.0
|
||||||
|
|
||||||
* `Versions`
|
* `Versions`
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
swagger: "2.0"
|
openapi: "3.0.0"
|
||||||
info:
|
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)"
|
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.0"
|
version: "0.11.1"
|
||||||
title: "KeyValue Repo"
|
title: "KeyValue Repo"
|
||||||
contact:
|
contact:
|
||||||
email: "ovsyannikov.alexey95@gmail.com"
|
email: "ovsyannikov.alexey95@gmail.com"
|
||||||
@ -11,81 +11,63 @@ tags:
|
|||||||
- name: "Write"
|
- name: "Write"
|
||||||
description: "Operations with `post` request in most cases"
|
description: "Operations with `post` request in most cases"
|
||||||
|
|
||||||
parameters:
|
components:
|
||||||
KeyInQuery:
|
parameters:
|
||||||
in: "query"
|
KeyInQuery:
|
||||||
name: "key"
|
in: "query"
|
||||||
allOf:
|
name: "key"
|
||||||
- $ref: "#/definitions/Key"
|
schema:
|
||||||
KeysInBody:
|
$ref: "#/components/schemas/Key"
|
||||||
in: "body"
|
PaginationInQueryPage:
|
||||||
name: "body"
|
in: "query"
|
||||||
type: array
|
name: "ppage"
|
||||||
items:
|
description: "Page of pagination"
|
||||||
$ref: "#/definitions/Key"
|
schema:
|
||||||
ValuesInBody:
|
|
||||||
in: "body"
|
|
||||||
name: "body"
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/definitions/Value"
|
|
||||||
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
|
|
||||||
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"
|
|
||||||
|
|
||||||
|
|
||||||
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"
|
|
||||||
Map:
|
|
||||||
type: object
|
|
||||||
description: "Map of objects"
|
|
||||||
PaginationResult:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
page:
|
|
||||||
type: integer
|
type: integer
|
||||||
description: "Page of pagination"
|
required: false
|
||||||
pagesNumber:
|
PaginationInQuerySize:
|
||||||
|
in: "query"
|
||||||
|
name: "psize"
|
||||||
|
description: "Size of each page in pagination"
|
||||||
|
schema:
|
||||||
type: integer
|
type: integer
|
||||||
description: "Count of pages with the size from this pagination"
|
required: false
|
||||||
size:
|
ReversedInQuery:
|
||||||
type: integer
|
in: "query"
|
||||||
description: "Size of each page in pagination"
|
name: "reversed"
|
||||||
results:
|
description: "If passed, will tell to reverse the result pages"
|
||||||
type: array
|
schema:
|
||||||
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"
|
type: boolean
|
||||||
items:
|
required: false
|
||||||
type: object
|
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:
|
paths:
|
||||||
/get:
|
/get:
|
||||||
@ -93,13 +75,16 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- "Read"
|
- "Read"
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: "#/parameters/KeyInQuery"
|
- allOf:
|
||||||
required: true
|
- $ref: "#/components/parameters/KeyInQuery"
|
||||||
|
- required: true
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: "Element by key"
|
description: "Element by key"
|
||||||
schema:
|
content:
|
||||||
$ref: "#/definitions/Value"
|
"*/*":
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Value"
|
||||||
"204":
|
"204":
|
||||||
description: "No value by id"
|
description: "No value by id"
|
||||||
/values:
|
/values:
|
||||||
@ -107,51 +92,57 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- "Read"
|
- "Read"
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: "#/parameters/PaginationInQueryPage"
|
- $ref: "#/components/parameters/PaginationInQueryPage"
|
||||||
- $ref: "#/parameters/PaginationInQuerySize"
|
- $ref: "#/components/parameters/PaginationInQuerySize"
|
||||||
- $ref: "#/parameters/ReversedInQuery"
|
- $ref: "#/components/parameters/ReversedInQuery"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: "Pagination with elements"
|
description: "Pagination with elements"
|
||||||
schema:
|
content:
|
||||||
allOf:
|
"*/*":
|
||||||
- $ref: "#/definitions/PaginationResult"
|
schema:
|
||||||
- properties:
|
allOf:
|
||||||
results:
|
- $ref: "#/components/schemas/PaginationResult"
|
||||||
items:
|
- properties:
|
||||||
$ref: "#/definitions/Value"
|
results:
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Value"
|
||||||
/keys:
|
/keys:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "Read"
|
- "Read"
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: "#/parameters/PaginationInQueryPage"
|
- $ref: "#/components/parameters/PaginationInQueryPage"
|
||||||
- $ref: "#/parameters/PaginationInQuerySize"
|
- $ref: "#/components/parameters/PaginationInQuerySize"
|
||||||
- $ref: "#/parameters/ReversedInQuery"
|
- $ref: "#/components/parameters/ReversedInQuery"
|
||||||
- $ref: "#/parameters/ValueInQuery"
|
- $ref: "#/components/parameters/ValueInQuery"
|
||||||
required: false
|
required: false
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: "Pagination with elements"
|
description: "Pagination with elements"
|
||||||
schema:
|
content:
|
||||||
allOf:
|
"*/*":
|
||||||
- $ref: "#/definitions/PaginationResult"
|
schema:
|
||||||
- properties:
|
allOf:
|
||||||
results:
|
- $ref: "#/components/schemas/PaginationResult"
|
||||||
items:
|
- properties:
|
||||||
$ref: "#/definitions/Key"
|
results:
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Key"
|
||||||
/contains:
|
/contains:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- "Read"
|
- "Read"
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: "#/parameters/KeyInQuery"
|
- $ref: "#/components/parameters/KeyInQuery"
|
||||||
required: true
|
required: true
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: "Object with id availability in repo"
|
description: "Object with id availability in repo"
|
||||||
schema:
|
content:
|
||||||
type: boolean
|
"*/*":
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
/count:
|
/count:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@ -159,19 +150,23 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: "Amount of objects in repo"
|
description: "Amount of objects in repo"
|
||||||
schema:
|
content:
|
||||||
type: integer
|
"*/*":
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
|
||||||
|
|
||||||
/set:
|
/set:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "Write"
|
- "Write"
|
||||||
parameters:
|
requestBody:
|
||||||
- allOf:
|
content:
|
||||||
- $ref: "#/parameters/MapInBody"
|
"*/*":
|
||||||
- additionalProperties:
|
schema:
|
||||||
$ref: "#/definitions/Value"
|
type: object
|
||||||
|
additionalProperties:
|
||||||
|
$ref: "#/components/schemas/Value"
|
||||||
description: "Map with new elements to set. Use keys as a keys of this map"
|
description: "Map with new elements to set. Use keys as a keys of this map"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
@ -180,8 +175,13 @@ paths:
|
|||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "Write"
|
- "Write"
|
||||||
parameters:
|
requestBody:
|
||||||
- $ref: "#/parameters/KeysInBody"
|
content:
|
||||||
|
"*/*":
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Key"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: "Objects with keys from body has been unset"
|
description: "Objects with keys from body has been unset"
|
||||||
@ -189,8 +189,13 @@ paths:
|
|||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- "Write"
|
- "Write"
|
||||||
parameters:
|
requestBody:
|
||||||
- $ref: "#/parameters/ValuesInBody"
|
content:
|
||||||
|
"*/*":
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Value"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: "Objects with values from body has been unset"
|
description: "Objects with values from body has been unset"
|
||||||
|
@ -51,7 +51,7 @@ inline fun <reified Key, reified Value> Route.configureReadKeyValueRepoRoutes (
|
|||||||
|
|
||||||
get(keysRoute) {
|
get(keysRoute) {
|
||||||
val pagination = call.request.queryParameters.extractPagination
|
val pagination = call.request.queryParameters.extractPagination
|
||||||
val reversed = call.getQueryParameterOrSendError(reversedParameterName) ?.toBoolean() ?: false
|
val reversed = call.getQueryParameter(reversedParameterName) ?.toBoolean() ?: false
|
||||||
val value = call.getQueryParameter(valueParameterName) ?.let {
|
val value = call.getQueryParameter(valueParameterName) ?.let {
|
||||||
valueDeserializer(it)
|
valueDeserializer(it)
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ inline fun <reified Key, reified Value> Route.configureReadKeyValuesRepoRoutes (
|
|||||||
|
|
||||||
get(keysRoute) {
|
get(keysRoute) {
|
||||||
val pagination = call.request.queryParameters.extractPagination
|
val pagination = call.request.queryParameters.extractPagination
|
||||||
val reversed = call.getQueryParameterOrSendError(reversedParameterName) ?.toBoolean() ?: false
|
val reversed = call.getQueryParameter(reversedParameterName) ?.toBoolean() ?: false
|
||||||
val value = call.getQueryParameter(valueParameterName) ?.let {
|
val value = call.getQueryParameter(valueParameterName) ?.let {
|
||||||
valueDeserializer(it)
|
valueDeserializer(it)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user