diff --git a/schema/openapi.yml b/schema/openapi.yml index 42d99c9..0600493 100644 --- a/schema/openapi.yml +++ b/schema/openapi.yml @@ -27,6 +27,8 @@ paths: $ref: "./paths/forms/index.yml" /forms/{formId}: $ref: "./paths/forms/[formId]/index.yml" + /forms/questions: + $ref: "./paths/forms/questions/index.yml" /forms/answers: $ref: "./paths/forms/answers/index.yml" /forms/answers/comment: diff --git a/schema/paths/forms/questions/index.yml b/schema/paths/forms/questions/index.yml new file mode 100644 index 0000000..90410a6 --- /dev/null +++ b/schema/paths/forms/questions/index.yml @@ -0,0 +1,50 @@ +post: + operationId: createQuestion + summary: 質問の新規作成 + description: | + 質問を新しく作ります。 + requestBody: + description: 作成する質問の内容 + required: true + content: + application/json: + schema: + $ref: "../../../types/forms/definitions.yml#/definitions/questions" + responses: + "201": + description: 質問の作成に成功 + content: + application/json: + schema: + $ref: "../../../types/forms/definitions.yml#/definitions/id" + "400": + $ref: "../../../errors/errorResponses.yml#/components/responses/syntaxError" + "401": + $ref: "../../../errors/errorResponses.yml#/components/responses/unauthorized" + "403": + $ref: "../../../errors/errorResponses.yml#/components/responses/forbidden" + "500": + $ref: "../../../errors/errorResponses.yml#/components/responses/internalServerError" + +delete: + operationId: deleteQuestion + summary: 質問を削除する + description: 作成済みの質問を削除する + requestBody: + description: 削除するフォーム質問ID + required: true + content: + application/json: + schema: + $ref: "../../../types/forms/definitions.yml#/definitions/question_id" + responses: + "200": + description: "質問の削除に成功" + "400": + $ref: "../../../errors/errorResponses.yml#/components/responses/syntaxError" + "401": + $ref: "../../../errors/errorResponses.yml#/components/responses/unauthorized" + "404": + $ref: "../../../errors/errorResponses.yml#/components/responses/notFound" + "500": + $ref: "../../../errors/errorResponses.yml#/components/responses/internalServerError" diff --git a/schema/types/forms/components.yml b/schema/types/forms/components.yml index 1f5c84d..fe6c926 100644 --- a/schema/types/forms/components.yml +++ b/schema/types/forms/components.yml @@ -98,7 +98,9 @@ components: type: object properties: question_id: - $ref: "#/components/schemas/question_id" + readOnly: true + allOf: + - $ref: "#/components/schemas/question_id" question_title: $ref: "#/components/schemas/question_title" question_description: diff --git a/schema/types/forms/definitions.yml b/schema/types/forms/definitions.yml index f205141..996c6a7 100644 --- a/schema/types/forms/definitions.yml +++ b/schema/types/forms/definitions.yml @@ -26,6 +26,18 @@ definitions: required: - id - title + questions: + description: 質問の配列 + type: object + properties: + questions: + $ref: "./components.yml#/components/schemas/questions" + question_id: + description: 質問のID + type: object + properties: + question_id: + $ref: "./components.yml#/components/schemas/question_id" id: type: object properties: