diff --git a/schema/openapi.yml b/schema/openapi.yml index 0fa3133..3d7501e 100644 --- a/schema/openapi.yml +++ b/schema/openapi.yml @@ -25,6 +25,8 @@ security: tags: - name: forms description: フォーム操作に関連するAPI + - name: users + description: ユーザー操作に関連するAPI paths: /forms: @@ -43,3 +45,9 @@ paths: $ref: "./paths/forms/answers/comment/index.yml" /forms/labels: $ref: "./paths/forms/labels/index.yml" + /users: + $ref: "./paths/users/index.yml" + /users/{uuid}: + $ref: "./paths/users/[uuid]/index.yml" + /users/list: + $ref: "./paths/users/list/index.yml" diff --git a/schema/paths/users/[uuid]/index.yml b/schema/paths/users/[uuid]/index.yml new file mode 100644 index 0000000..2327b2a --- /dev/null +++ b/schema/paths/users/[uuid]/index.yml @@ -0,0 +1,21 @@ +patch: + tags: + - users + operationId: updateUser + summary: ユーザー情報を変更する + parameters: + - $ref: "../../../types/users/parameters.yml#/parameters/uuid" + - $ref: "../../../types/users/parameters.yml#/parameters/role" + responses: + "200": + description: ユーザー情報の変更に成功 + "400": + $ref: "../../../errors/errorResponses.yml#/components/responses/syntaxError" + "401": + $ref: "../../../errors/errorResponses.yml#/components/responses/unauthorized" + "403": + $ref: "../../../errors/errorResponses.yml#/components/responses/forbidden" + "404": + $ref: "../../../errors/errorResponses.yml#/components/responses/notFound" + "500": + $ref: "../../../errors/errorResponses.yml#/components/responses/internalServerError" diff --git a/schema/paths/users/index.yml b/schema/paths/users/index.yml new file mode 100644 index 0000000..51f49be --- /dev/null +++ b/schema/paths/users/index.yml @@ -0,0 +1,19 @@ +get: + tags: + - users + operationId: getUserInfo + summary: 自身のユーザー情報の取得 + description: | + Bearer TokenにMicrosoftから取得したトークンを含めて実行すると + 自身のユーザー情報が帰ってきます + responses: + "200": + description: 自身のユーザー情報の取得成功 + content: + application/json: + schema: + $ref: "../../types/users/definitions.yml#/definitions/user" + "401": + $ref: "../../errors/errorResponses.yml#/components/responses/unauthorized" + "500": + $ref: "../../errors/errorResponses.yml#/components/responses/internalServerError" diff --git a/schema/paths/users/list/index.yml b/schema/paths/users/list/index.yml new file mode 100644 index 0000000..4ba95e7 --- /dev/null +++ b/schema/paths/users/list/index.yml @@ -0,0 +1,23 @@ +get: + tags: + - users + operationId: getUsersList + summary: すべてのユーザーの取得 + description: ユーザーリストを返します + responses: + "200": + description: 自身のユーザー情報の取得成功 + content: + application/json: + schema: + $ref: "../../../types/users/definitions.yml#/definitions/users" + "400": + $ref: "../../../errors/errorResponses.yml#/components/responses/syntaxError" + "401": + $ref: "../../../errors/errorResponses.yml#/components/responses/unauthorized" + "403": + $ref: "../../../errors/errorResponses.yml#/components/responses/forbidden" + "404": + $ref: "../../../errors/errorResponses.yml#/components/responses/notFound" + "500": + $ref: "../../../errors/errorResponses.yml#/components/responses/internalServerError" diff --git a/schema/types/users/components.yml b/schema/types/users/components.yml index 4c51f09..0616105 100644 --- a/schema/types/users/components.yml +++ b/schema/types/users/components.yml @@ -4,3 +4,12 @@ components: description: Minecraftプレイヤーに紐づくUUID type: string format: uuid + name: + description: Minecraftプレイヤー名 + type: string + role: + description: ユーザー権限 + type: string + enum: + - ADMINISTRATOR + - STANDARD_USER diff --git a/schema/types/users/definitions.yml b/schema/types/users/definitions.yml new file mode 100644 index 0000000..b09eaef --- /dev/null +++ b/schema/types/users/definitions.yml @@ -0,0 +1,18 @@ +definitions: + user: + description: ユーザー + type: object + properties: + uuid: + $ref: "./components.yml#/components/schemas/uuid" + name: + $ref: "./components.yml#/components/schemas/name" + role: + $ref: "./components.yml#/components/schemas/role" + users: + description: ユーザーの配列 + type: array + uniqueItems: true + minItems: 0 + items: + $ref: "#/definitions/user" diff --git a/schema/types/users/parameters.yml b/schema/types/users/parameters.yml new file mode 100644 index 0000000..c9b2dc0 --- /dev/null +++ b/schema/types/users/parameters.yml @@ -0,0 +1,15 @@ +parameters: + uuid: + name: uuid + in: path + description: プレイヤーUUID + required: true + schema: + $ref: "./components.yml#/components/schemas/uuid" + role: + name: role + in: query + description: ユーザー権限 + required: false + schema: + $ref: "./components.yml#/components/schemas/role"