Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openapi fixes/enhancements #2102

Merged
merged 6 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions webapp/config/packages/nelmio_api_doc.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
nelmio_api_doc:
documentation:
servers:
- url: "%domjudge.baseurl%api"
description: API used at this contest
- url: https://www.domjudge.org/demoweb/api
description: New API in development
info:
title: DOMjudge
description: DOMjudge API v4
version: "%domjudge.version%"
license:
name: GPL2
url: https://raw.githubusercontent.com/DOMjudge/domjudge/main/COPYING
contact:
name: DOMjudge development team (not the administrator of this instance)
email: [email protected]
url: https://github.com/DOMjudge/domjudge/issues/new/choose
security:
- basicAuth: []
components:
Expand Down Expand Up @@ -113,15 +125,6 @@ nelmio_api_doc:
schema:
type: string
schemas:
FileList:
type: array
items:
type: object
properties:
href:
type: string
mime:
type: string
ImageList:
type: array
nullable: true
Expand Down
23 changes: 22 additions & 1 deletion webapp/src/Controller/API/JudgehostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,6 @@ public function getFilesAction(
response: 200,
description: 'Returns optionally compiler and runner version commands.',
content: new OA\JsonContent(
required: [],
properties: [
new OA\Property(property: 'compiler_version_command', type: 'string', nullable: true),
new OA\Property(property: 'runner_version_command', type: 'string', nullable: true),
Expand Down Expand Up @@ -1406,6 +1405,28 @@ private function getTestcaseFiles(string $id): array
*/
#[IsGranted(new Expression("is_granted('ROLE_JUDGEHOST')"))]
#[Rest\Post('/fetch-work')]
#[OA\Response(
response: 200,
description: 'Returns the workarray.',
content: new OA\JsonContent(
type: 'array',
items: new OA\Items(
new OA\Schema(ref: new Model(type: JudgeTask::class)),
)
)
)]
#[OA\Parameter(
name: 'hostname',
description: 'Hostname of the judgehost requesting work.',
in: 'query',
schema: new OA\Schema(type: 'string')
)]
#[OA\Parameter(
name: 'max_batchsize',
description: 'Maximum number of tasks to return.',
in: 'query',
schema: new OA\Schema(type: 'integer')
)]
public function getJudgeTasksAction(Request $request): array
{
if (!$request->request->has('hostname')) {
Expand Down
Loading