feat(plugin): add PluginMeta model and JSON schema for plugin metadata

This commit is contained in:
MingxuanGame
2025-12-13 18:22:31 +08:00
parent bb181d930a
commit a24302c2df
3 changed files with 60 additions and 5 deletions

10
app/models/plugin.py Normal file
View File

@@ -0,0 +1,10 @@
from pydantic import BaseModel
class PluginMeta(BaseModel):
id: str
name: str
author: str
version: str
description: str | None = None
dependencies: list[str] = []

View File

@@ -1,6 +1,7 @@
# 静态文件
# Static files
- `mods.json`: 包含了游戏中的所有可用mod的详细信息。
- Origin: https://github.com/ppy/osu-web/blob/master/database/mods.json
- Version: 2025/7/30 `ff49b66b27a2850aea4b6b3ba563cfe936cb6082`
- `iso3166.json`: 包含了所有国家和地区的ISO 3166-1代码。
- `mods.json`: Contains detailed information about all available mods in the game, generated using [CustomRulesetMetadataGenerator](https://github.com/GooGuTeam/custom-rulesets/tree/main/CustomRulesetMetadataGenerator).
- `custom_ruleset_version_hash.json`: Contains version hash information for custom rulesets, generated using [CustomRulesetMetadataGenerator](https://github.com/GooGuTeam/custom-rulesets/tree/main/CustomRulesetMetadataGenerator).
- `iso3166.json`: Contains ISO 3166-1 codes for all countries and regions.
- `plugin_schema.json`: Defines the JSON Schema for the plugin metadata file `plugin.json`, used to validate the structure and content of plugin metadata.
- `beatmap_tag.json`: Contains the beatmap tags used by osu!, as described in the [osu! wiki](https://osu.ppy.sh/wiki/Beatmap/Beatmap_tags).

View File

@@ -0,0 +1,44 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/GooGuTeam/g0v0-server/main/static/plugin_meta_schema.json",
"title": "PluginMeta",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The unique identifier of the plugin"
},
"name": {
"type": "string",
"description": "The name of the plugin"
},
"author": {
"type": "string",
"description": "The author of the plugin"
},
"version": {
"type": "string",
"description": "The version of the plugin"
},
"description": {
"type": "string",
"description": "The description of the plugin",
"nullable": true
},
"dependencies": {
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "The list of plugin dependencies"
}
},
"required": [
"id",
"name",
"author",
"version"
],
"additionalProperties": false
}