From b61788b0a32aafb0b71eed54c8bcfb3359dfdf51 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 10 May 2023 11:40:19 +0200 Subject: [PATCH] todo-backend: separate TodoItem declaration in API schema Signed-off-by: Patrik Oldsberg --- .../src/schema/openapi.generated.ts | 67 ++++++++++--------- plugins/todo-backend/src/schema/openapi.yaml | 52 +++++++------- 2 files changed, 62 insertions(+), 57 deletions(-) diff --git a/plugins/todo-backend/src/schema/openapi.generated.ts b/plugins/todo-backend/src/schema/openapi.generated.ts index 0ef39a4054..54486a5615 100644 --- a/plugins/todo-backend/src/schema/openapi.generated.ts +++ b/plugins/todo-backend/src/schema/openapi.generated.ts @@ -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: { diff --git a/plugins/todo-backend/src/schema/openapi.yaml b/plugins/todo-backend/src/schema/openapi.yaml index b16b0bbf2a..3fba129644 100644 --- a/plugins/todo-backend/src/schema/openapi.yaml +++ b/plugins/todo-backend/src/schema/openapi.yaml @@ -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: