Rewrite crud.yml

This commit is contained in:
InsanusMokrassar 2022-06-16 15:51:22 +06:00 committed by GitHub
parent 1c52e04cdb
commit 9fb8626d8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
swagger: "2.0" openapi: "3.0.0"
info: info:
description: "This is a template for the CRUD repositories from [microutils](https://github.com/InsanusMokrassar/MicroUtils/tree/master/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud)" description: "This is a template for the CRUD repositories from [microutils](https://github.com/InsanusMokrassar/MicroUtils/tree/master/repos/ktor/server/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/ktor/server/crud)"
version: "0.11.0" version: "0.11.3"
title: "CRUD Repo" title: "CRUD Repo"
contact: contact:
email: "ovsyannikov.alexey95@gmail.com" email: "ovsyannikov.alexey95@gmail.com"
@ -11,91 +11,61 @@ tags:
- name: "Write" - name: "Write"
description: "Operations with `post` request in most cases" description: "Operations with `post` request in most cases"
parameters: components:
IdInQuery: parameters:
in: "query" IdInQuery:
name: "id" in: "query"
allOf: name: "id"
- $ref: "#/definitions/Key" schema:
IdsInBody: $ref: "#/components/schemas/Key"
in: "body" PaginationInQueryPage:
name: "body" in: "query"
type: array name: "ppage"
items: description: "Page of pagination"
$ref: "#/definitions/Key" schema:
NewValuesInBody: type: integer
in: "body" required: false
name: "body" PaginationInQuerySize:
type: array in: "query"
allOf: name: "psize"
- $ref: "#/definitions/NewValues" description: "Size of each page in pagination"
NewValuesWithIdsInBody: schema:
in: "body" type: integer
name: "body" required: false
type: array schemas:
items:
allOf:
- $ref: "#/definitions/Pair"
- properties:
first:
$ref: "#/definitions/Key"
second:
$ref: "#/definitions/NewValue"
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
Key:
definitions: type: integer
Key: description: "REWRITE THIS TYPE AS KEY IN SWAGGER FILE"
type: integer Value:
description: "REWRITE THIS TYPE AS KEY IN SWAGGER FILE" type: integer
Value: description: "REWRITE THIS TYPE AS VALUE IN SWAGGER FILE"
type: integer NewValue:
description: "REWRITE THIS TYPE AS VALUE IN SWAGGER FILE" type: integer
Values: description: "REWRITE THIS TYPE AS NEW VALUE IN SWAGGER FILE"
type: array Pair:
items: type: object
$ref: "#/definitions/Value" description: "Pair of objects"
NewValue: properties:
type: integer first:
description: "REWRITE THIS TYPE AS NEW VALUE IN SWAGGER FILE" second:
Pair: PaginationResult:
type: object type: object
description: "Pair of objects" properties:
properties: page:
first: type: integer
second: description: "Page of pagination"
NewValues: pagesNumber:
type: array type: integer
items: description: "Count of pages with the size from this pagination"
$ref: "#/definitions/NewValue" size:
PaginationResult: type: integer
type: object description: "Size of each page in pagination"
properties: results:
page: type: array
type: integer 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"
description: "Page of pagination" items:
pagesNumber: type: object
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:
/getByPagination: /getByPagination:
@ -103,30 +73,34 @@ paths:
tags: tags:
- "Read" - "Read"
parameters: parameters:
- $ref: "#/parameters/PaginationInQueryPage" - $ref: "#/components/parameters/PaginationInQueryPage"
- $ref: "#/parameters/PaginationInQuerySize" - $ref: "#/components/parameters/PaginationInQuerySize"
responses: responses:
"200": "200":
description: "Pagination with elements" description: "Pagination with elements"
schema: content:
allOf: application/json:
- $ref: "#/definitions/PaginationResult" schema:
- properties: allOf:
results: - $ref: "#/components/schemas/PaginationResult"
items: - properties:
$ref: "#/definitions/Value" results:
items:
$ref: "#/components/schemas/Value"
/getById: /getById:
get: get:
tags: tags:
- "Read" - "Read"
parameters: parameters:
- $ref: "#/parameters/IdInQuery" - $ref: "#/components/parameters/IdInQuery"
required: true required: true
responses: responses:
"200": "200":
description: "Result object" description: "Result object"
schema: content:
$ref: "#/definitions/Value" application/json:
schema:
$ref: "#/components/schemas/Value"
"204": "204":
description: "No value by id" description: "No value by id"
/contains: /contains:
@ -134,13 +108,15 @@ paths:
tags: tags:
- "Read" - "Read"
parameters: parameters:
- $ref: "#/parameters/IdInQuery" - $ref: "#/components/parameters/IdInQuery"
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 application/json:
schema:
type: boolean
/count: /count:
get: get:
tags: tags:
@ -148,40 +124,75 @@ paths:
responses: responses:
"200": "200":
description: "Amount of objects in repo" description: "Amount of objects in repo"
schema: content:
type: integer application/json:
schema:
type: integer
/create: /create:
post: post:
tags: tags:
- "Write" - "Write"
parameters: requestBody:
- $ref: "#/parameters/NewValuesInBody" content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/NewValue"
responses: responses:
"200": "200":
description: "Objects has been created and saved" description: "Objects has been created and saved"
schema: content:
$ref: "#/definitions/Values" application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Value"
/update: /update:
post: post:
tags: tags:
- "Write" - "Write"
parameters: requestBody:
- $ref: "#/parameters/NewValuesWithIdsInBody" content:
application/json:
schema:
type: array
items:
allOf:
- $ref: "#/components/schemas/Pair"
- properties:
first:
$ref: "#/components/schemas/Key"
second:
$ref: "#/components/schemas/NewValue"
responses: responses:
"200": "200":
description: "Objects has been updated" description: "Objects has been updated"
schema: content:
$ref: "#/definitions/Values" application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Value"
/deleteById: /deleteById:
post: post:
tags: tags:
- "Write" - "Write"
parameters: requestBody:
- $ref: "#/parameters/IdsInBody" content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Key"
responses: responses:
"200": "200":
description: "Objects has been updated" description: "Objects has been updated"
schema: content:
$ref: "#/definitions/Values" application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Value"