Skip to content

Instantly share code, notes, and snippets.

@Arathi
Last active June 25, 2025 04:13
Show Gist options
  • Select an option

  • Save Arathi/0fc4cf89687f1b3ab7320f36665d539d to your computer and use it in GitHub Desktop.

Select an option

Save Arathi/0fc4cf89687f1b3ab7320f36665d539d to your computer and use it in GitHub Desktop.
用来验证 Minecraft 的版本信息的 JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Version",
"description": "用来验证Minecraft的版本信息",
"type": "object",
"$defs": {
"argumentArray": {
"type": "array",
"items": {
"$ref": "#/$defs/argument"
}
},
"argument": {
"description": "启动参数",
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/$defs/dynamicArgument"
}
]
},
"dynamicArgument": {
"description": "动态参数",
"type": "object",
"properties": {
"rules": {
"type": "array",
"items": {
"$ref": "#/$defs/rule"
}
},
"value": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"additionalProperties": false
},
"rule": {
"type": "object",
"properties": {
"action": {
"enum": [
"allow",
"disallow"
]
},
"features": {
"type": "object",
"properties": {
"is_demo_user": {
"type": "boolean"
},
"has_custom_resolution": {
"type": "boolean"
},
"has_quick_plays_support": {
"type": "boolean"
},
"is_quick_play_singleplayer": {
"type": "boolean"
},
"is_quick_play_multiplayer": {
"type": "boolean"
},
"is_quick_play_realms": {
"type": "boolean"
}
},
"minProperties": 1
},
"os": {
"description": "操作系统信息",
"type": "object",
"properties": {
"name": {
"enum": [
"windows",
"linux",
"osx"
]
},
"version": {
"type": "string"
},
"arch": {
"enum": [
"x86"
]
}
},
"minProperties": 1
}
},
"required": [
"action"
],
"additionalProperties": false
},
"asset": {
"description": "资源文件",
"type": "object",
"properties": {
"sha1": {
"type": "string"
},
"size": {
"type": "integer"
},
"url": {
"type": "string"
}
},
"required": [
"sha1",
"size",
"url"
]
},
"namedAsset": {
"description": "命名资源文件",
"allOf": [
{
"$ref": "#/$defs/asset"
},
{
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
}
]
},
"artifact": {
"allOf": [
{
"$ref": "#/$defs/asset"
},
{
"type": "object",
"properties": {
"path": {
"type": "string"
}
},
"required": [
"path"
]
}
]
},
"assetIndex": {
"description": "资源文件索引",
"allOf": [
{
"$ref": "#/$defs/asset"
},
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"totalSize": {
"type": "integer"
}
},
"required": [
"id",
"totalSize"
]
}
]
},
"library": {
"description": "java类库",
"type": "object",
"properties": {
"downloads": {
"type": "object",
"properties": {
"artifact": {
"$ref": "#/$defs/artifact"
},
"classifiers": {
"type": "object",
"properties": {
"natives-linux": {
"$ref": "#/$defs/artifact"
},
"natives-macos": {
"$ref": "#/$defs/artifact"
},
"natives-osx": {
"$ref": "#/$defs/artifact"
},
"natives-windows": {
"$ref": "#/$defs/artifact"
},
"javadoc": {
"$ref": "#/$defs/artifact"
},
"sources": {
"$ref": "#/$defs/artifact"
}
}
}
}
},
"name": {
"type": "string",
"pattern": "([a-z][0-9a-z\\.]+):([a-z][0-9a-z\\-]+):([\\S]+)"
},
"natives": {
"type": "object",
"properties": {
"windows": {
"type": "string"
},
"linux": {
"type": "string"
},
"osx": {
"type": "string"
}
}
},
"extract": {},
"rules": {
"type": "array",
"items": {
"$ref": "#/$defs/rule"
}
}
},
"required": [
"downloads",
"name"
],
"additionalProperties": false
}
},
"properties": {
"arguments": {
"description": "用于构建启动参数,分为jvm参数和game参数两部分",
"type": "object",
"properties": {
"game": {
"description": "游戏相关的参数,加在mainClass后面",
"$ref": "#/$defs/argumentArray"
},
"jvm": {
"description": "JVM相关的参数,加在cp前面",
"$ref": "#/$defs/argumentArray"
}
},
"required": [
"game",
"jvm"
],
"additionalProperties": false
},
"assetIndex": {
"description": "资源文件索引",
"$ref": "#/$defs/assetIndex"
},
"assets": {
"description": "资源文件索引名称(数字编号)",
"type": "string",
"pattern": "[\\d]+"
},
"complianceLevel": {
"description": "兼容级别",
"type": "integer",
"minimum": 0
},
"downloads": {
"description": "下载地址",
"type": "object",
"properties": {
"client": {
"description": "客户端jar包",
"$ref": "#/$defs/asset"
},
"client_mappings": {
"description": "客户端jar包混淆映射文件",
"$ref": "#/$defs/asset"
},
"server": {
"description": "服务器jar包",
"$ref": "#/$defs/asset"
},
"server_mappings": {
"description": "服务端jar包混淆映射文件",
"$ref": "#/$defs/asset"
}
},
"required": [
"client",
"server"
],
"additionalProperties": false
},
"id": {
"description": "版本标识",
"type": "string"
},
"javaVersion": {
"description": "Java版本信息",
"type": "object",
"properties": {
"component": {
"description": "组件",
"type": "string"
},
"majorVersion": {
"description": "主版本",
"type": "integer"
}
}
},
"libraries": {
"description": "使用的java库,添加在cp",
"type": "array",
"items": {
"$ref": "#/$defs/library"
}
},
"logging": {
"description": "日志参数",
"type": "object",
"properties": {
"client": {
"type": "object",
"properties": {
"argument": {
"type": "string"
},
"file": {
"$ref": "#/$defs/namedAsset"
},
"type": {
"type": "string"
}
}
}
}
},
"mainClass": {
"description": "主类名称",
"type": "string"
},
"minimumLauncherVersion": {
"description": "官方启动器最低版本",
"type": "integer"
},
"releaseTime": {
"description": "发布时间",
"type": "string"
},
"time": {
"description": "更新时间",
"type": "string"
},
"type": {
"description": "版本类型",
"enum": [
"release",
"snapshot",
"old-beta",
"old-alpha"
]
}
},
"required": [
"arguments",
"assetIndex",
"assets",
"downloads",
"id",
"libraries",
"logging",
"mainClass",
"minimumLauncherVersion",
"releaseTime",
"time",
"type"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment