Skip to content

Commit

Permalink
feat: OpenAPI のスキーマの部分を書いた
Browse files Browse the repository at this point in the history
  • Loading branch information
hayatroid committed Jan 23, 2025
1 parent 6a397bd commit 973d62b
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 7 deletions.
71 changes: 67 additions & 4 deletions api/judge/control/to_exec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Sample"
$ref: "#/components/schemas/JudgeResultMessage"
required: true
summary: ジャッジ結果
responses:
Expand All @@ -38,7 +38,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Sample"
$ref: "#/components/schemas/ContainerCreatedMessage"
required: true
summary: コンテナ
responses:
Expand All @@ -55,5 +55,68 @@ components:
scheme: bearer
bearerFormat: JWT
schemas:
Sample:
title: Sample
File:
title: File
type: object
description: ファイル
properties:
fileId:
title: fileId
type: string
description: ファイルの UUID
format: uuid
example: 01234567-89ab-cdef-0123-456789abcdef
filePath:
title: filePath
type: string
description: ファイルのパス
example: "/path/to/file"
required:
- fileId
- filePath
ContainerCreatedMessage:
title: ContainerCreatedMessage
type: object
description: 新たに起動したコンテナから受け取るメッセージ
properties:
containerId:
title: containerId
type: string
description: コンテナの UUID
format: uuid
example: 01234567-89ab-cdef-0123-456789abcdef
containerUrl:
title: containerUrl
type: string
description: |-
コンテナの URL
これを用いて exec container の API を叩く
example: 01234567-89ab-cdef-0123-456789abcdef.default.svc.cluster.local
required:
- containerId
- containerUrl
JudgeResultMessage:
title: JudgeResultMessage
type: object
description: ジャッジの実行を終了したコンテナから受け取るメッセージ
properties:
exitCode:
title: exitCode
type: integer
description: 終了コード
example: 0
stdout:
$ref: "#/components/schemas/File"
stderr:
$ref: "#/components/schemas/File"
readonlyFiles:
title: readonlyFiles
type: array
description: ジャッジに使用したファイル(読み取り専用)
items:
$ref: "#/components/schemas/File"
required:
- exitCode
- stdout
- stderr
- readonlyFiles
71 changes: 68 additions & 3 deletions api/judge/exec/to_control.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Sample"
$ref: "#/components/schemas/FilePlacedMessage"
required: true
summary: ジャッジの実行を開始
responses:
Expand All @@ -37,5 +37,70 @@ components:
scheme: bearer
bearerFormat: JWT
schemas:
Sample:
title: Sample
File:
title: File
type: object
description: ファイル
properties:
fileId:
title: fileId
type: string
description: ファイルの UUID
format: uuid
example: 01234567-89ab-cdef-0123-456789abcdef
filePath:
title: filePath
type: string
description: ファイルのパス
example: "/path/to/file"
required:
- fileId
- filePath
FilePlacedMessage:
title: FilePlacedMessage
type: object
description: ジャッジの実行を開始するトリガーとなるメッセージ
properties:
cmd:
title: cmd
type: string
description: コマンド
example: cmd
envs:
title: envs
type: object
description: 環境たち
additionalProperties:
title: env
type: string
description: 環境
example: env
connectionTimeLimit:
title: connectionTimeLimit
type: integer
description: 接続時間制限
example: 20000
executionTimeLimit:
title: executionTimeLimit
type: integer
description: 実行時間制限
example: 2000
readonlyFiles:
title: readonlyFiles
type: array
description: ジャッジに使用するファイル(読み取り専用)
items:
$ref: "#/components/schemas/File"
writableFiles:
title: writableFiles
type: array
description: ジャッジに使用するファイル(書き込み可能)
items:
$ref: "#/components/schemas/File"
required:
- cmd
- envs
- connectionTimeLimit
- executionTimeLimit
- readonlyFiles
- writableFiles

0 comments on commit 973d62b

Please sign in to comment.