Skip to content

Commit

Permalink
Merge pull request #143 from sohosai/feature/schema
Browse files Browse the repository at this point in the history
スキーマにエラー時のレスポンスを追加した
  • Loading branch information
arata-nvm authored Apr 5, 2024
2 parents dc39cda + c326080 commit 26d6482
Show file tree
Hide file tree
Showing 10 changed files with 628 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
- name: Run `openapi` command 🚀
uses: readmeio/rdme@v8
with:
rdme: openapi schema/api.yml --key=${{ secrets.README_API_KEY }} --id=${{ vars.README_ID }}
rdme: openapi api.yml --workingDirectory=schema --key=${{ secrets.README_API_KEY }} --id=${{ vars.README_ID }}
36 changes: 18 additions & 18 deletions schema/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,47 @@ tags:

paths:
/projects:
$ref: "./schema/project.yml#/paths/~1projects"
$ref: "./project.yml#/paths/~1projects"
/projects/export:
$ref: "./schema/project.yml#/paths/~1projects~1export"
$ref: "./project.yml#/paths/~1projects~1export"
/projects/me:
$ref: "./schema/project.yml#/paths/~1projects~1me"
$ref: "./project.yml#/paths/~1projects~1me"
/projects/{project_id}:
$ref: "./schema/project.yml#/paths/~1projects~1{project_id}"
$ref: "./project.yml#/paths/~1projects~1{project_id}"

/users:
$ref: "./schema/user.yml#/paths/~1users"
$ref: "./user.yml#/paths/~1users"
/users/export:
$ref: "./schema/user.yml#/paths/~1users~1export"
$ref: "./user.yml#/paths/~1users~1export"
/users/me:
$ref: "./schema/user.yml#/paths/~1users~1me"
$ref: "./user.yml#/paths/~1users~1me"
/users/{user_id}:
$ref: "./schema/user.yml#/paths/~1users~1{user_id}"
$ref: "./user.yml#/paths/~1users~1{user_id}"

/news:
$ref: "./schema/news.yml#/paths/~1news"
$ref: "./news.yml#/paths/~1news"
/news/{news_id}:
$ref: "./schema/news.yml#/paths/~1news~1{news_id}"
$ref: "./news.yml#/paths/~1news~1{news_id}"

/files:
$ref: "./schema/file.yml#/paths/~1files"
$ref: "./file.yml#/paths/~1files"
/files/{file_id}:
$ref: "./schema/file.yml#/paths/~1files~1{file_id}"
$ref: "./file.yml#/paths/~1files~1{file_id}"

/invitations:
$ref: "./schema/invitation.yml#/paths/~1invitations"
$ref: "./invitation.yml#/paths/~1invitations"
/invitations/{invitation_id}:
$ref: "./schema/invitation.yml#/paths/~1invitations~1{invitation_id}"
$ref: "./invitation.yml#/paths/~1invitations~1{invitation_id}"

/forms:
$ref: "./schema/form.yml#/paths/~1forms"
$ref: "./form.yml#/paths/~1forms"
/forms/{form_id}:
$ref: "./schema/form.yml#/paths/~1forms~1{form_id}"
$ref: "./form.yml#/paths/~1forms~1{form_id}"

/form-answers:
$ref: "./schema/form-answer.yml#/paths/~1form-answers"
$ref: "./form-answer.yml#/paths/~1form-answers"
/form-answers/{form_answer_id}:
$ref: "./schema/form-answer.yml#/paths/~1form-answers~1{form_answer_id}"
$ref: "./form-answer.yml#/paths/~1form-answers~1{form_answer_id}"

security:
- Bearer: [ ]
Expand Down
8 changes: 8 additions & 0 deletions schema/error.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
schemas:
Error:
type: object
properties:
code:
type: string
message:
type: string
56 changes: 56 additions & 0 deletions schema/file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,22 @@ paths:
$ref: "#/schemas/FileInfo"
401:
description: Unauthorized
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
403:
description: Forbidden
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
500:
description: Internal Server Error
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
post:
summary: ファイルの作成
tags:
Expand All @@ -46,14 +58,34 @@ paths:
$ref: "#/schemas/CreatedFile"
400:
description: Bad Request
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
401:
description: Unauthorized
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
403:
description: Forbidden
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
422:
description: Unprocessable Entity
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
500:
description: Internal Server Error
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"

/files/{file_id}:
get:
Expand All @@ -75,10 +107,22 @@ paths:
$ref: "#/schemas/File"
401:
description: Unauthorized
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
403:
description: Forbidden
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
500:
description: Internal Server Error
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
delete:
summary: 特定のIDのファイルの削除
tags:
Expand All @@ -95,10 +139,22 @@ paths:
description: OK
401:
description: Unauthorized
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
403:
description: Forbidden
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
500:
description: Internal Server Error
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"

schemas:
CreateFile:
Expand Down
82 changes: 81 additions & 1 deletion schema/form-answer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,28 @@ paths:
$ref: "#/schemas/FormAnswerSummary"
401:
description: Unauthorized
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
403:
description: Forbidden
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
404:
description: Not Found
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
500:
description: Internal Server Error
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
post:
summary: 申請の回答を作成
tags:
Expand All @@ -49,16 +65,40 @@ paths:
$ref: "#/schemas/CreatedFormAnswer"
400:
description: Bad Request
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
401:
description: Unauthorized
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
403:
description: Forbidden
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
404:
description: Not Found
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
422:
description: Unprocessable Entity
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
500:
description: Internal Server Error
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"

/form-answers/{form_answer_id}:
get:
Expand All @@ -81,12 +121,28 @@ paths:
$ref: "#/schemas/FormAnswer"
401:
description: Unauthorized
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
403:
description: Forbidden
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
404:
description: Not Found
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
500:
description: Internal Server Error
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
put:
summary: 申請の回答を更新
tags:
Expand All @@ -107,17 +163,41 @@ paths:
description: OK
400:
description: Bad Request
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
401:
description: Unauthorized
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
403:
description: Forbidden
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
404:
description: Not Found
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
422:
description: Unprocessable Entity
content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"
500:
description: Internal Server Error

content:
application/json:
schema:
$ref: "./error.yml#/schemas/Error"

schemas:
FormAnswerItem:
type: object
Expand Down
Loading

0 comments on commit 26d6482

Please sign in to comment.