openapi: "3.0.0" 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)" version: "0.11.3" title: "CRUD 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: IdInQuery: in: "query" name: "id" 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 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" NewValue: type: integer description: "REWRITE THIS TYPE AS NEW VALUE IN SWAGGER FILE" Pair: type: object description: "Pair of objects" properties: first: second: 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: /getByPagination: get: tags: - "Read" parameters: - $ref: "#/components/parameters/PaginationInQueryPage" - $ref: "#/components/parameters/PaginationInQuerySize" responses: "200": description: "Pagination with elements" content: application/json: schema: allOf: - $ref: "#/components/schemas/PaginationResult" - properties: results: items: $ref: "#/components/schemas/Value" /getById: get: tags: - "Read" parameters: - $ref: "#/components/parameters/IdInQuery" required: true responses: "200": description: "Result object" content: application/json: schema: $ref: "#/components/schemas/Value" "204": description: "No value by id" /contains: get: tags: - "Read" parameters: - $ref: "#/components/parameters/IdInQuery" required: true responses: "200": description: "Object with id availability in repo" content: application/json: schema: type: boolean /count: get: tags: - "Read" responses: "200": description: "Amount of objects in repo" content: application/json: schema: type: integer /create: post: tags: - "Write" requestBody: content: application/json: schema: type: array items: $ref: "#/components/schemas/NewValue" responses: "200": description: "Objects has been created and saved" content: application/json: schema: type: array items: $ref: "#/components/schemas/Value" /update: post: tags: - "Write" requestBody: content: application/json: schema: type: array items: allOf: - $ref: "#/components/schemas/Pair" - properties: first: $ref: "#/components/schemas/Key" second: $ref: "#/components/schemas/NewValue" responses: "200": description: "Objects has been updated" content: application/json: schema: type: array items: $ref: "#/components/schemas/Value" /deleteById: post: tags: - "Write" requestBody: content: application/json: schema: type: array items: $ref: "#/components/schemas/Key" responses: "200": description: "Objects has been updated" content: application/json: schema: type: array items: $ref: "#/components/schemas/Value"