Files
libretro/schemas/platform.schema.json
T
Abdessamad Derraz 5d417c8229 feat: add data contract validation
JSON Schemas for the database, install and pack manifests, target
manifests, site API envelopes and stats, plus the semantic invariants a
schema cannot express: declared totals matching their lists, no
destination both installed and omitted, database keys matching their
sha1. validate_site.py checks the rendered HTML for metadata, headings,
image alternatives, duplicate ids and unresolved local links.

Pack manifests are read from inside the generated archives, where
generate_pack writes them, rather than from a dist/ glob that matches
nothing.

Emulator and platform schemas gain additionalProperties: false, and
cores[] plus contents[].name must be strings: an unquoted 81 or 01 in
YAML parses as a number and stops matching the upstream name.
2026-08-10 13:35:33 +02:00

210 lines
6.1 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/Abdess/retrobios/schemas/platform.schema.json",
"title": "Platform Configuration",
"description": "Schema for retrogaming platform BIOS configuration files",
"type": "object",
"additionalProperties": false,
"required": ["platform"],
"properties": {
"inherits": {
"type": "string",
"description": "Parent platform config to inherit from (e.g., 'retroarch')"
},
"platform": {
"type": "string",
"description": "Platform display name"
},
"version": {
"type": "string",
"description": "Platform version"
},
"dat_version": { "type": "string" },
"cores": {
"oneOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" }, "uniqueItems": true }
]
},
"standalone_cores": {
"type": "array",
"items": { "type": "string" },
"uniqueItems": true
},
"homepage": {
"type": "string",
"format": "uri",
"description": "Platform homepage URL"
},
"source": {
"type": "string",
"description": "URL to source BIOS requirements list"
},
"base_destination": {
"type": "string",
"description": "Base directory for BIOS files on this platform"
},
"hash_type": {
"type": "string",
"enum": ["sha1", "md5", "crc32", "sha256"],
"description": "Primary hash algorithm used by this platform"
},
"verification_mode": {
"type": "string",
"enum": ["existence", "md5", "sha1"],
"default": "existence",
"description": "How the platform verifies BIOS at runtime: existence (file exists), md5 (checks MD5 hash), sha1 (checks SHA1 hash)"
},
"systems": {
"type": "object",
"description": "Systems/consoles supported by this platform",
"additionalProperties": {
"$ref": "#/$defs/system"
}
},
"overrides": {
"type": "object",
"additionalProperties": false,
"description": "Override inherited system configs",
"properties": {
"systems": {
"type": "object",
"additionalProperties": {
"$ref": "#/$defs/system"
}
}
}
}
},
"$defs": {
"system": {
"type": "object",
"additionalProperties": false,
"properties": {
"core": {
"type": "string",
"description": "Emulator core name"
},
"manufacturer": {
"type": "string",
"description": "Hardware manufacturer"
},
"name": { "type": "string" },
"native_id": { "type": "string" },
"dat_version": {
"type": "string",
"description": "Version of the DAT file used as source for BIOS hashes"
},
"source": {
"type": "string",
"description": "URL or reference to the source of BIOS requirements"
},
"release_year": {
"type": "integer",
"minimum": 1970,
"maximum": 2030,
"description": "Console release year"
},
"docs": {
"type": "string",
"format": "uri",
"description": "Documentation URL"
},
"includes": {
"type": "array",
"items": { "type": "string" },
"description": "Shared BIOS groups to include (from _shared.yml)"
},
"data_directories": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["ref"],
"properties": {
"ref": { "type": "string" },
"destination": { "type": "string" }
}
}
},
"files": {
"type": "array",
"items": {
"$ref": "#/$defs/bios_file"
},
"description": "BIOS files required for this system"
}
}
},
"bios_file": {
"type": "object",
"additionalProperties": false,
"required": ["name", "destination"],
"properties": {
"name": {
"type": "string",
"description": "BIOS filename"
},
"sha1": {
"type": "string",
"pattern": "^[a-f0-9]{40}$",
"description": "SHA1 hash"
},
"md5": {
"type": "string",
"pattern": "^[a-fA-F0-9]{32}(,[a-fA-F0-9]{32})*$",
"description": "MD5 hash (comma-separated for multi-hash)"
},
"sha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$",
"description": "SHA256 hash"
},
"crc32": {
"type": "string",
"pattern": "^[a-f0-9A-F0-9]{8}$",
"description": "CRC32 hash"
},
"size": {
"type": "integer",
"minimum": 0,
"description": "File size in bytes"
},
"destination": {
"type": "string",
"description": "Destination path relative to base_destination"
},
"required": {
"type": "boolean",
"default": true,
"description": "Whether this BIOS is required for the core to function"
},
"extract": {
"type": "boolean",
"default": false,
"description": "Extract ZIP contents instead of copying the ZIP"
},
"storage": {
"type": "string",
"enum": ["embedded", "external", "user_provided", "large_file", "release"],
"default": "embedded",
"description": "Storage tier: embedded (in repo), external (download at build), user_provided (manual)"
},
"source_url": {
"type": "string",
"format": "uri",
"description": "Download URL for external storage tier"
},
"instructions": {
"type": "string",
"description": "Human-readable instructions (for user_provided or context)"
},
"zipped_file": {
"type": "string",
"description": "If set, the MD5 hash refers to this file inside the ZIP, not the ZIP itself"
}
}
}
}
}