From ae24d3952ff1aa1439da636910d00e45864d5974 Mon Sep 17 00:00:00 2001 From: undefined Date: Sun, 9 Feb 2025 20:18:50 +0800 Subject: [PATCH] ui: problemconfig: add compilableFile schema --- .../components/monaco/schema/problemconfig.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/ui-default/components/monaco/schema/problemconfig.ts b/packages/ui-default/components/monaco/schema/problemconfig.ts index cc5466de2..663ef621b 100644 --- a/packages/ui-default/components/monaco/schema/problemconfig.ts +++ b/packages/ui-default/components/monaco/schema/problemconfig.ts @@ -48,6 +48,20 @@ const problemConfigSchema: JSONSchema7 = { }, }, }, + compilableFile: { + oneOf: [ + { type: 'string', pattern: '\\.' }, + { + type: 'object', + properties: { + file: { type: 'string', pattern: '\\.' }, + lang: { type: 'string' }, + }, + required: ['file', 'lang'], + additionalProperties: false, + }, + ], + }, }, properties: { redirect: { type: 'string', pattern: '[0-9a-zA-Z_-]+\\/[0-9]+' }, @@ -59,14 +73,14 @@ const problemConfigSchema: JSONSchema7 = { checker_type: { enum: ['default', 'lemon', 'syzoj', 'hustoj', 'testlib', 'strict', 'qduoj'] }, checker: { oneOf: [ - { type: 'string', pattern: '\\.' }, { type: 'string', enum: testlibCheckers }, + { $ref: '#/definitions/compilableFile' }, ], }, - interactor: { type: 'string', pattern: '\\.' }, - manager: { type: 'string', pattern: '\\.' }, + interactor: { $ref: '#/definitions/compilableFile' }, + manager: { $ref: '#/definitions/compilableFile' }, num_processes: { type: 'number', minimum: 1, maximum: 5 }, - validator: { type: 'string', pattern: '\\.' }, + validator: { $ref: '#/definitions/compilableFile' }, user_extra_files: { type: 'array', items: { type: 'string' } }, judge_extra_files: { type: 'array', items: { type: 'string' } }, cases: { $ref: '#/definitions/cases' },