todo-backend: separate TodoItem declaration in API schema

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-05-10 11:40:19 +02:00
parent 1bf5f1e376
commit b61788b0a3
2 changed files with 62 additions and 57 deletions
@@ -42,7 +42,40 @@ export default {
parameters: {},
requestBodies: {},
responses: {},
schemas: {},
schemas: {
TodoItem: {
type: 'object',
properties: {
text: {
type: 'string',
description: 'The contents of the TODO comment',
},
tag: {
type: 'string',
description: 'The tag used, e.g. TODO, FIXME',
},
author: {
type: 'string',
description: 'References author, if any',
},
viewUrl: {
type: 'string',
description: 'URL used to view the file',
},
lineNumber: {
type: 'integer',
description: 'The line number of the file that the TODO occurs at',
},
repoFilePath: {
type: 'string',
description:
'The path of the file containing the TODO within the repo',
},
},
required: ['text', 'tag'],
additionalProperties: false,
},
},
securitySchemes: {
JWT: {
type: 'http',
@@ -66,37 +99,7 @@ export default {
items: {
type: 'array',
items: {
type: 'object',
properties: {
text: {
type: 'string',
description: 'The contents of the TODO comment',
},
tag: {
type: 'string',
description: 'The tag used, e.g. TODO, FIXME',
},
author: {
type: 'string',
description: 'References author, if any',
},
viewUrl: {
type: 'string',
description: 'URL used to view the file',
},
lineNumber: {
type: 'integer',
description:
'The line number of the file that the TODO occurs at',
},
repoFilePath: {
type: 'string',
description:
'The path of the file containing the TODO within the repo',
},
},
required: ['text', 'tag'],
additionalProperties: false,
$ref: '#/components/schemas/TodoItem',
},
},
totalCount: {
+27 -25
View File
@@ -18,7 +18,32 @@ components:
parameters: {}
requestBodies: {}
responses: {}
schemas: {}
schemas:
TodoItem:
type: object
properties:
text:
type: string
description: The contents of the TODO comment
tag:
type: string
description: The tag used, e.g. TODO, FIXME
author:
type: string
description: References author, if any
viewUrl:
type: string
description: URL used to view the file
lineNumber:
type: integer
description: The line number of the file that the TODO occurs at
repoFilePath:
type: string
description: The path of the file containing the TODO within the repo
required:
- text
- tag
additionalProperties: false
securitySchemes:
JWT:
type: http
@@ -39,30 +64,7 @@ paths:
items:
type: array
items:
type: object
properties:
text:
type: string
description: The contents of the TODO comment
tag:
type: string
description: The tag used, e.g. TODO, FIXME
author:
type: string
description: References author, if any
viewUrl:
type: string
description: URL used to view the file
lineNumber:
type: integer
description: The line number of the file that the TODO occurs at
repoFilePath:
type: string
description: The path of the file containing the TODO within the repo
required:
- text
- tag
additionalProperties: false
$ref: '#/components/schemas/TodoItem'
totalCount:
type: integer
offset: