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
|
||||
|
||||
* `Repos`
|
||||
* `Ktor`
|
||||
* In `configureReadKeyValueRepoRoutes` and `configureReadKeyValuesRepoRoutes` configurators fixed requiring of `reversed` property
|
||||
|
||||
## 0.11.0
|
||||
|
||||
* `Versions`
|
||||
|
@ -1,7 +1,7 @@
|
||||
swagger: "2.0"
|
||||
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.0"
|
||||
version: "0.11.1"
|
||||
title: "KeyValue Repo"
|
||||
contact:
|
||||
email: "ovsyannikov.alexey95@gmail.com"
|
||||
@ -11,64 +11,46 @@ tags:
|
||||
- name: "Write"
|
||||
description: "Operations with `post` request in most cases"
|
||||
|
||||
components:
|
||||
parameters:
|
||||
KeyInQuery:
|
||||
in: "query"
|
||||
name: "key"
|
||||
allOf:
|
||||
- $ref: "#/definitions/Key"
|
||||
KeysInBody:
|
||||
in: "body"
|
||||
name: "body"
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Key"
|
||||
ValuesInBody:
|
||||
in: "body"
|
||||
name: "body"
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Value"
|
||||
schema:
|
||||
$ref: "#/components/schemas/Key"
|
||||
PaginationInQueryPage:
|
||||
in: "query"
|
||||
type: integer
|
||||
name: "ppage"
|
||||
description: "Page of pagination"
|
||||
schema:
|
||||
type: integer
|
||||
required: false
|
||||
PaginationInQuerySize:
|
||||
in: "query"
|
||||
type: integer
|
||||
name: "psize"
|
||||
description: "Size of each page in pagination"
|
||||
schema:
|
||||
type: integer
|
||||
required: false
|
||||
ReversedInQuery:
|
||||
in: "query"
|
||||
type: boolean
|
||||
name: "reversed"
|
||||
description: "If passed, will tell to reverse the result pages"
|
||||
schema:
|
||||
type: boolean
|
||||
required: false
|
||||
ValueInQuery:
|
||||
in: "query"
|
||||
name: "value"
|
||||
allOf:
|
||||
- $ref: "#/definitions/Value"
|
||||
MapInBody:
|
||||
in: "body"
|
||||
name: "body"
|
||||
allOf:
|
||||
- $ref: "#/definitions/Map"
|
||||
|
||||
|
||||
definitions:
|
||||
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"
|
||||
Map:
|
||||
type: object
|
||||
description: "Map of objects"
|
||||
PaginationResult:
|
||||
type: object
|
||||
properties:
|
||||
@ -93,13 +75,16 @@ paths:
|
||||
tags:
|
||||
- "Read"
|
||||
parameters:
|
||||
- $ref: "#/parameters/KeyInQuery"
|
||||
required: true
|
||||
- allOf:
|
||||
- $ref: "#/components/parameters/KeyInQuery"
|
||||
- required: true
|
||||
responses:
|
||||
"200":
|
||||
description: "Element by key"
|
||||
content:
|
||||
"*/*":
|
||||
schema:
|
||||
$ref: "#/definitions/Value"
|
||||
$ref: "#/components/schemas/Value"
|
||||
"204":
|
||||
description: "No value by id"
|
||||
/values:
|
||||
@ -107,49 +92,55 @@ paths:
|
||||
tags:
|
||||
- "Read"
|
||||
parameters:
|
||||
- $ref: "#/parameters/PaginationInQueryPage"
|
||||
- $ref: "#/parameters/PaginationInQuerySize"
|
||||
- $ref: "#/parameters/ReversedInQuery"
|
||||
- $ref: "#/components/parameters/PaginationInQueryPage"
|
||||
- $ref: "#/components/parameters/PaginationInQuerySize"
|
||||
- $ref: "#/components/parameters/ReversedInQuery"
|
||||
responses:
|
||||
"200":
|
||||
description: "Pagination with elements"
|
||||
content:
|
||||
"*/*":
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: "#/definitions/PaginationResult"
|
||||
- $ref: "#/components/schemas/PaginationResult"
|
||||
- properties:
|
||||
results:
|
||||
items:
|
||||
$ref: "#/definitions/Value"
|
||||
$ref: "#/components/schemas/Value"
|
||||
/keys:
|
||||
get:
|
||||
tags:
|
||||
- "Read"
|
||||
parameters:
|
||||
- $ref: "#/parameters/PaginationInQueryPage"
|
||||
- $ref: "#/parameters/PaginationInQuerySize"
|
||||
- $ref: "#/parameters/ReversedInQuery"
|
||||
- $ref: "#/parameters/ValueInQuery"
|
||||
- $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: "#/definitions/PaginationResult"
|
||||
- $ref: "#/components/schemas/PaginationResult"
|
||||
- properties:
|
||||
results:
|
||||
items:
|
||||
$ref: "#/definitions/Key"
|
||||
$ref: "#/components/schemas/Key"
|
||||
/contains:
|
||||
get:
|
||||
tags:
|
||||
- "Read"
|
||||
parameters:
|
||||
- $ref: "#/parameters/KeyInQuery"
|
||||
- $ref: "#/components/parameters/KeyInQuery"
|
||||
required: true
|
||||
responses:
|
||||
"200":
|
||||
description: "Object with id availability in repo"
|
||||
content:
|
||||
"*/*":
|
||||
schema:
|
||||
type: boolean
|
||||
/count:
|
||||
@ -159,6 +150,8 @@ paths:
|
||||
responses:
|
||||
"200":
|
||||
description: "Amount of objects in repo"
|
||||
content:
|
||||
"*/*":
|
||||
schema:
|
||||
type: integer
|
||||
|
||||
@ -167,11 +160,13 @@ paths:
|
||||
post:
|
||||
tags:
|
||||
- "Write"
|
||||
parameters:
|
||||
- allOf:
|
||||
- $ref: "#/parameters/MapInBody"
|
||||
- additionalProperties:
|
||||
$ref: "#/definitions/Value"
|
||||
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":
|
||||
@ -180,8 +175,13 @@ paths:
|
||||
post:
|
||||
tags:
|
||||
- "Write"
|
||||
parameters:
|
||||
- $ref: "#/parameters/KeysInBody"
|
||||
requestBody:
|
||||
content:
|
||||
"*/*":
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/Key"
|
||||
responses:
|
||||
"200":
|
||||
description: "Objects with keys from body has been unset"
|
||||
@ -189,8 +189,13 @@ paths:
|
||||
post:
|
||||
tags:
|
||||
- "Write"
|
||||
parameters:
|
||||
- $ref: "#/parameters/ValuesInBody"
|
||||
requestBody:
|
||||
content:
|
||||
"*/*":
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/Value"
|
||||
responses:
|
||||
"200":
|
||||
description: "Objects with values from body has been unset"
|
||||
|
@ -51,7 +51,7 @@ inline fun <reified Key, reified Value> Route.configureReadKeyValueRepoRoutes (
|
||||
|
||||
get(keysRoute) {
|
||||
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 {
|
||||
valueDeserializer(it)
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ inline fun <reified Key, reified Value> Route.configureReadKeyValuesRepoRoutes (
|
||||
|
||||
get(keysRoute) {
|
||||
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 {
|
||||
valueDeserializer(it)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user