Files
KF-OnlineJudge/contracts/schemas/judge-result.v1.schema.json

305 lines
6.6 KiB
JSON

{
"$comment": "Structural schema; also run versioned model validation for cross-field budgets, result consistency, UUID canonical form and UTF-8 byte limits.",
"$defs": {
"ArtifactReference": {
"additionalProperties": false,
"properties": {
"bytes": {
"maximum": 67108864,
"minimum": 0,
"title": "Bytes",
"type": "integer"
},
"digest": {
"maxLength": 64,
"minLength": 64,
"pattern": "^[0-9a-f]{64}$",
"title": "Digest",
"type": "string"
}
},
"required": [
"digest",
"bytes"
],
"title": "ArtifactReference",
"type": "object"
},
"CaseReport": {
"additionalProperties": false,
"properties": {
"case_id": {
"format": "uuid",
"title": "Case Id",
"type": "string"
},
"cpu_time_us": {
"anyOf": [
{
"maximum": 9223372036854775807,
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"title": "Cpu Time Us"
},
"memory_peak_bytes": {
"anyOf": [
{
"maximum": 9223372036854775807,
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"title": "Memory Peak Bytes"
},
"verdict": {
"$ref": "#/$defs/Verdict"
}
},
"required": [
"case_id",
"verdict",
"cpu_time_us",
"memory_peak_bytes"
],
"title": "CaseReport",
"type": "object"
},
"CompilationReport": {
"additionalProperties": false,
"properties": {
"cpu_time_us": {
"anyOf": [
{
"maximum": 9223372036854775807,
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"title": "Cpu Time Us"
},
"diagnostics": {
"maxLength": 65536,
"title": "Diagnostics",
"type": "string"
},
"diagnostics_truncated": {
"title": "Diagnostics Truncated",
"type": "boolean"
},
"memory_peak_bytes": {
"anyOf": [
{
"maximum": 9223372036854775807,
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"title": "Memory Peak Bytes"
},
"program": {
"anyOf": [
{
"$ref": "#/$defs/ArtifactReference"
},
{
"type": "null"
}
]
},
"status": {
"$ref": "#/$defs/CompilationStatus"
}
},
"required": [
"status",
"program",
"diagnostics",
"diagnostics_truncated",
"cpu_time_us",
"memory_peak_bytes"
],
"title": "CompilationReport",
"type": "object"
},
"CompilationStatus": {
"enum": [
"succeeded",
"compilation_error",
"compilation_limit",
"cancelled",
"system_error"
],
"title": "CompilationStatus",
"type": "string"
},
"FailureCode": {
"enum": [
"artifact_unavailable",
"sandbox_unavailable",
"cleanup_failed",
"lease_lost",
"job_deadline"
],
"title": "FailureCode",
"type": "string"
},
"LeaseBinding": {
"additionalProperties": false,
"properties": {
"attempt_id": {
"format": "uuid",
"title": "Attempt Id",
"type": "string"
},
"evaluation_id": {
"format": "uuid",
"title": "Evaluation Id",
"type": "string"
},
"fencing_version": {
"maximum": 9223372036854775807,
"minimum": 1,
"title": "Fencing Version",
"type": "integer"
},
"worker_id": {
"format": "uuid",
"title": "Worker Id",
"type": "string"
}
},
"required": [
"evaluation_id",
"attempt_id",
"worker_id",
"fencing_version"
],
"title": "LeaseBinding",
"type": "object"
},
"Verdict": {
"enum": [
"accepted",
"wrong_answer",
"compilation_error",
"runtime_error",
"time_limit_exceeded",
"memory_limit_exceeded",
"output_limit_exceeded",
"cancelled",
"system_error"
],
"title": "Verdict",
"type": "string"
}
},
"$id": "urn:kf-oj:judge-result:v1",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"binding": {
"$ref": "#/$defs/LeaseBinding"
},
"cases": {
"items": {
"$ref": "#/$defs/CaseReport"
},
"maxItems": 256,
"title": "Cases",
"type": "array"
},
"cleanup_complete": {
"title": "Cleanup Complete",
"type": "boolean"
},
"compilation": {
"$ref": "#/$defs/CompilationReport"
},
"failure_code": {
"anyOf": [
{
"$ref": "#/$defs/FailureCode"
},
{
"type": "null"
}
]
},
"kind": {
"const": "judge.result",
"title": "Kind",
"type": "string"
},
"manifest_digest": {
"maxLength": 64,
"minLength": 64,
"pattern": "^[0-9a-f]{64}$",
"title": "Manifest Digest",
"type": "string"
},
"run_cpu_time_us": {
"anyOf": [
{
"maximum": 9223372036854775807,
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"title": "Run Cpu Time Us"
},
"run_memory_peak_bytes": {
"anyOf": [
{
"maximum": 9223372036854775807,
"minimum": 0,
"type": "integer"
},
{
"type": "null"
}
],
"title": "Run Memory Peak Bytes"
},
"schema_version": {
"const": 1,
"title": "Schema Version",
"type": "integer"
},
"verdict": {
"$ref": "#/$defs/Verdict"
}
},
"required": [
"schema_version",
"kind",
"binding",
"manifest_digest",
"compilation",
"cases",
"verdict",
"cleanup_complete",
"failure_code",
"run_cpu_time_us",
"run_memory_peak_bytes"
],
"title": "JudgementReport",
"type": "object"
}