Files

190 lines
5.6 KiB
YAML

schemas:
PracticeRunTest:
type: object
description: >-
One test of the candidate for a debug run: an input and the output the
candidate expects. It is compared with the checker of the task.
additionalProperties: false
required:
- input
- expected_output
properties:
input:
type: string
maxLength: 10000
expected_output:
type: string
maxLength: 10000
PracticeRunCreate:
type: object
description: >-
Debug run of a practice solution against the public examples of the task
and up to ten tests of the candidate. It never runs a hidden check and
never changes the practice state, the verdict, or the attempt version.
Unknown fields are rejected.
additionalProperties: false
required:
- item_id
- language
- source_code
properties:
item_id:
$ref: "./assessment_schemas.yml#/schemas/AssessmentItemId"
language:
description: One of the `languages` of the practice item, or null when the item offers none.
oneOf:
- $ref: "./catalog_schemas.yml#/schemas/TaskLanguage"
- type: "null"
source_code:
type: string
minLength: 1
maxLength: 65536
tests:
type: array
maxItems: 10
description: Tests of the candidate, run after the public examples.
items:
$ref: "#/schemas/PracticeRunTest"
PracticeRunState:
type: string
description: |-
State of a debug run.
- queued: the run waits in the sandbox queue.
- running: the sandbox runs it.
- finished: `result` holds the outcome of the public examples and the tests of the candidate.
- failed: the sandbox infrastructure could not run it, independently of the solution; `failure_reason` is `sandbox_error`. Start a new run.
Adding a value is a contract change.
enum:
- queued
- running
- finished
- failed
PracticeRunOutcome:
type: string
description: >-
Outcome of a run or one of its tests. Every outcome caused by the
solution, such as a compilation error, a crash, or a limit, is a
finished run with this outcome; an infrastructure failure is a failed
run instead.
enum:
- accepted
- wrong_answer
- compile_error
- time_limit_exceeded
- memory_limit_exceeded
- output_limit_exceeded
- runtime_error
PracticeRunTestSource:
type: string
description: >-
Where a test of a debug run comes from: a public example of the task or
a test of the candidate.
enum:
- example
- candidate
PracticeRunTestResult:
type: object
description: >-
Outcome of one evaluated test. The tests of a source stop at the first
failed one, so later tests of that source are not listed.
additionalProperties: false
required:
- source
- index
- outcome
- time_ms
- memory_kb
- diagnostic
properties:
source:
$ref: "#/schemas/PracticeRunTestSource"
index:
type: integer
format: int32
minimum: 1
maximum: 10
description: Position of the test in its source, from 1.
outcome:
$ref: "#/schemas/PracticeRunOutcome"
time_ms:
type: integer
format: int64
minimum: 0
memory_kb:
type: integer
format: int64
minimum: 0
diagnostic:
description: Truncated error output of a failed test, or null.
oneOf:
- type: string
maxLength: 2048
- type: "null"
PracticeRunResult:
type: object
description: >-
Result of a debug run on the public examples and the tests of the
candidate. It never contains a hidden check, its outcome, or the score.
additionalProperties: false
required:
- outcome
- compile_diagnostic
- tests
properties:
outcome:
$ref: "#/schemas/PracticeRunOutcome"
compile_diagnostic:
description: The compiler message when `outcome` is `compile_error`, otherwise null.
oneOf:
- type: string
maxLength: 4096
- type: "null"
tests:
type: array
maxItems: 20
items:
$ref: "#/schemas/PracticeRunTestResult"
PracticeRun:
type: object
description: >-
Debug run of a practice solution. It shows only the public examples and
the tests of the candidate; hidden checks are never run, listed, or
scored by a debug run.
additionalProperties: false
required:
- id
- item_id
- state
- created_at
- finished_at
- failure_reason
- result
properties:
id:
type: string
format: uuid
description: Identifier of the run.
item_id:
$ref: "./assessment_schemas.yml#/schemas/AssessmentItemId"
state:
$ref: "#/schemas/PracticeRunState"
created_at:
$ref: "./common_schemas.yml#/schemas/Timestamp"
finished_at:
description: Time the run reached `finished` or `failed`, or null.
oneOf:
- $ref: "./common_schemas.yml#/schemas/Timestamp"
- type: "null"
failure_reason:
description: "`sandbox_error` when `state` is `failed`, otherwise null."
oneOf:
- $ref: "./assessment_schemas.yml#/schemas/PracticeFailureReason"
- type: "null"
result:
description: The result when `state` is `finished`, otherwise null.
oneOf:
- $ref: "#/schemas/PracticeRunResult"
- type: "null"