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,61 +11,35 @@ tags:
- name: "Write" - name: "Write"
description: "Operations with `post` request in most cases" description: "Operations with `post` request in most cases"
components:
parameters: parameters:
IdInQuery: IdInQuery:
in: "query" in: "query"
name: "id" name: "id"
allOf: schema:
- $ref: "#/definitions/Key" $ref: "#/components/schemas/Key"
IdsInBody:
in: "body"
name: "body"
type: array
items:
$ref: "#/definitions/Key"
NewValuesInBody:
in: "body"
name: "body"
type: array
allOf:
- $ref: "#/definitions/NewValues"
NewValuesWithIdsInBody:
in: "body"
name: "body"
type: array
items:
allOf:
- $ref: "#/definitions/Pair"
- properties:
first:
$ref: "#/definitions/Key"
second:
$ref: "#/definitions/NewValue"
PaginationInQueryPage: PaginationInQueryPage:
in: "query" in: "query"
type: integer
name: "ppage" name: "ppage"
description: "Page of pagination" description: "Page of pagination"
schema:
type: integer
required: false required: false
PaginationInQuerySize: PaginationInQuerySize:
in: "query" in: "query"
type: integer
name: "psize" name: "psize"
description: "Size of each page in pagination" description: "Size of each page in pagination"
schema:
type: integer
required: false required: false
schemas:
definitions:
Key: Key:
type: integer type: integer
description: "REWRITE THIS TYPE AS KEY IN SWAGGER FILE" description: "REWRITE THIS TYPE AS KEY IN SWAGGER FILE"
Value: Value:
type: integer type: integer
description: "REWRITE THIS TYPE AS VALUE IN SWAGGER FILE" description: "REWRITE THIS TYPE AS VALUE IN SWAGGER FILE"
Values:
type: array
items:
$ref: "#/definitions/Value"
NewValue: NewValue:
type: integer type: integer
description: "REWRITE THIS TYPE AS NEW VALUE IN SWAGGER FILE" description: "REWRITE THIS TYPE AS NEW VALUE IN SWAGGER FILE"
@ -75,10 +49,6 @@ definitions:
properties: properties:
first: first:
second: second:
NewValues:
type: array
items:
$ref: "#/definitions/NewValue"
PaginationResult: PaginationResult:
type: object type: object
properties: properties:
@ -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"
content:
application/json:
schema: schema:
allOf: allOf:
- $ref: "#/definitions/PaginationResult" - $ref: "#/components/schemas/PaginationResult"
- properties: - properties:
results: results:
items: items:
$ref: "#/definitions/Value" $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"
content:
application/json:
schema: schema:
$ref: "#/definitions/Value" $ref: "#/components/schemas/Value"
"204": "204":
description: "No value by id" description: "No value by id"
/contains: /contains:
@ -134,11 +108,13 @@ 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"
content:
application/json:
schema: schema:
type: boolean type: boolean
/count: /count:
@ -148,6 +124,8 @@ paths:
responses: responses:
"200": "200":
description: "Amount of objects in repo" description: "Amount of objects in repo"
content:
application/json:
schema: schema:
type: integer type: integer
@ -156,32 +134,65 @@ paths:
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"
content:
application/json:
schema: schema:
$ref: "#/definitions/Values" 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"
content:
application/json:
schema: schema:
$ref: "#/definitions/Values" 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"
content:
application/json:
schema: schema:
$ref: "#/definitions/Values" type: array
items:
$ref: "#/components/schemas/Value"