Skip to content

Commit

Permalink
Merge pull request #104 from GiganticMinecraft/feat/questionOperations
Browse files Browse the repository at this point in the history
フォームの質問を追加・削除するためのエントリポイントを定義
  • Loading branch information
Lucky3028 authored Aug 18, 2023
2 parents 01e0a28 + 3f556fb commit 0b5656c
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
2 changes: 2 additions & 0 deletions schema/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
50 changes: 50 additions & 0 deletions schema/paths/forms/questions/index.yml
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 3 additions & 1 deletion schema/types/forms/components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions schema/types/forms/definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 0b5656c

Please sign in to comment.