Skip to content
This repository was archived by the owner on Jun 7, 2026. It is now read-only.

Commit fca7cbd

Browse files
committed
Allow specifying project license in metadata
1 parent 7c457ab commit fca7cbd

2 files changed

Lines changed: 130 additions & 57 deletions

File tree

Lines changed: 121 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,129 @@
11
{
2-
"$schema": "https://json-schema.org/draft/2020-12/schema",
3-
"title": "Sinytra Wiki Documentation Metadata",
4-
"description": "Provides documentation project meta information",
5-
"type": "object",
6-
"properties": {
7-
"id": {
8-
"description": "Unique project ID that identifies the project across the wiki. We recommend using your projectid.",
9-
"type": "string",
10-
"minLength": 2,
11-
"maxLength": 126,
12-
"pattern": "^[a-z]+[a-z0-9-]+$"
13-
},
14-
"modid": {
15-
"description": "In-game modid, used to identify mod content data",
16-
"type": "string"
17-
},
18-
"platforms": {
19-
"description": "A map of your project's available distribution platforms to platform project slugs.",
20-
"type": "object",
21-
"additionalProperties": { "type": "string" }
22-
},
23-
"versions": {
24-
"description": "A map of additional minecraft versions to git branch names to make available.",
25-
"type": "object",
26-
"additionalProperties": { "type": "string" }
27-
},
28-
"platform": {
29-
"description": "Your project's distribution platform. Deprecated: use 'platforms' instead",
30-
"enum": ["curseforge", "modrinth"],
31-
"deprecated": true
32-
},
33-
"slug": {
34-
"description": "The host platform's project slug. Deprecated: use 'platforms' instead",
35-
"type": "string",
36-
"deprecated": true
37-
},
38-
"owners": {
39-
"description": "Usernames of wiki accounts authorized to register this project.",
40-
"type": "array",
41-
"items": {
42-
"type": "string"
43-
}
44-
}
45-
},
46-
"allOf": [
47-
{
48-
"required": ["id"]
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Sinytra Wiki Documentation Metadata",
4+
"description": "Provides documentation project meta information",
5+
"type": "object",
6+
"properties": {
7+
"id": {
8+
"description": "Unique project ID that identifies the project across the wiki. We recommend using your projectid.",
9+
"type": "string",
10+
"minLength": 2,
11+
"maxLength": 126,
12+
"pattern": "^[a-z]+[a-z0-9-]+$"
13+
},
14+
"modid": {
15+
"description": "In-game modid, used to identify mod content data",
16+
"type": "string"
17+
},
18+
"platforms": {
19+
"description": "A map of your project's available distribution platforms to platform project slugs.",
20+
"type": "object",
21+
"additionalProperties": {
22+
"type": "string"
23+
}
24+
},
25+
"versions": {
26+
"description": "A map of additional minecraft versions to git branch names to make available.",
27+
"type": "object",
28+
"additionalProperties": {
29+
"type": "string"
30+
}
31+
},
32+
"platform": {
33+
"description": "Your project's distribution platform. Deprecated: use 'platforms' instead",
34+
"enum": [
35+
"curseforge",
36+
"modrinth"
37+
],
38+
"deprecated": true
39+
},
40+
"slug": {
41+
"description": "The host platform's project slug. Deprecated: use 'platforms' instead",
42+
"type": "string",
43+
"deprecated": true
44+
},
45+
"owners": {
46+
"description": "Usernames of wiki accounts authorized to register this project.",
47+
"type": "array",
48+
"items": {
49+
"type": "string"
50+
}
51+
},
52+
"licenses": {
53+
"description": "Contains license information for the project itself and its wiki docs.",
54+
"type": "object",
55+
"properties": {
56+
"project": {
57+
"$ref": "#/definitions/license"
58+
}
59+
},
60+
"additionalProperties": false
61+
}
4962
},
50-
{
51-
"oneOf": [
63+
"allOf": [
5264
{
53-
"required": ["platform", "slug"],
54-
"deprecated": true
65+
"required": [
66+
"id"
67+
]
5568
},
5669
{
57-
"required": ["platforms"]
70+
"oneOf": [
71+
{
72+
"required": [
73+
"platform",
74+
"slug"
75+
],
76+
"deprecated": true
77+
},
78+
{
79+
"required": [
80+
"platforms"
81+
]
82+
}
83+
]
84+
}
85+
],
86+
"definitions": {
87+
"license": {
88+
"description": "Contains license information",
89+
"type": "object",
90+
"properties": {
91+
"id": {
92+
"description": "SPDX License Identifier",
93+
"type": "string"
94+
},
95+
"name": {
96+
"description": "Custom license name",
97+
"type": "string"
98+
},
99+
"url": {
100+
"description": "Link to license text",
101+
"type": "string"
102+
}
103+
},
104+
"additionalProperties": false,
105+
"oneOf": [
106+
{
107+
"required": [
108+
"id"
109+
],
110+
"not": {
111+
"required": [
112+
"name"
113+
]
114+
}
115+
},
116+
{
117+
"required": [
118+
"name"
119+
],
120+
"not": {
121+
"required": [
122+
"id"
123+
]
124+
}
125+
}
126+
]
58127
}
59-
]
60128
}
61-
]
62129
}

src/service/resolved.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,17 @@ namespace service {
151151

152152
Task<Json::Value> ResolvedProject::toJsonVerbose() const {
153153
auto projectJson = co_await toJson();
154+
// TODO Cache
154155
Json::Value infoJson;
155156

156-
if (const auto [meta, err, detail] = validateProjectMetadata(); meta && meta->contains("links")) {
157-
if (const auto links = (*meta)["links"]; links.contains("website")) {
158-
infoJson["website"] = links["website"].get<std::string>();
157+
if (const auto [meta, err, detail] = validateProjectMetadata(); meta) {
158+
if (meta->contains("links")) {
159+
if (const auto links = (*meta)["links"]; links.contains("website")) {
160+
infoJson["website"] = links["website"].get<std::string>();
161+
}
162+
}
163+
if (meta->contains("licenses")) {
164+
infoJson["licenses"] = unparkourJson((*meta)["licenses"]);
159165
}
160166
}
161167

0 commit comments

Comments
 (0)