1
- use std:: collections:: HashMap ;
2
-
3
1
use serde:: { Deserialize , Serialize } ;
2
+ use serde_valid:: Validate ;
3
+ use serde_with:: skip_serializing_none;
4
+ use std:: collections:: HashMap ;
4
5
5
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
6
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
6
7
pub struct ForgeMavenMetadata {
7
8
#[ serde( flatten) ]
8
9
pub versions : HashMap < String , Vec < String > > ,
9
10
}
10
11
11
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
12
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
12
13
pub struct ForgeMavenPromotions {
13
14
pub homepage : String ,
14
15
pub promos : HashMap < String , String > ,
15
16
}
16
17
17
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
18
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
18
19
pub struct ForgeVersionMeta {
19
20
pub classifiers : ForgeVersionClassifiers ,
20
21
}
21
22
22
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
23
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
24
+ #[ skip_serializing_none]
23
25
#[ serde( deny_unknown_fields) ]
24
26
pub struct ForgeVersionClassifier {
25
27
pub txt : Option < String > ,
@@ -28,7 +30,8 @@ pub struct ForgeVersionClassifier {
28
30
pub stash : Option < String > ,
29
31
}
30
32
31
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
33
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
34
+ #[ skip_serializing_none]
32
35
#[ serde( deny_unknown_fields) ]
33
36
pub struct ForgeVersionClassifiers {
34
37
pub changelog : Option < ForgeVersionClassifier > ,
@@ -47,14 +50,15 @@ pub struct ForgeVersionClassifiers {
47
50
pub src_zip : Option < ForgeVersionClassifier > ,
48
51
}
49
52
50
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
53
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
54
+ #[ skip_serializing_none]
51
55
#[ serde( deny_unknown_fields) ]
52
56
pub struct ForgeVersionArguments {
53
57
pub game : Vec < String > ,
54
58
pub jvm : Option < Vec < String > > ,
55
59
}
56
60
57
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
61
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
58
62
#[ serde( deny_unknown_fields) ]
59
63
pub struct ForgeVersionLibraryArtifact {
60
64
pub path : String ,
@@ -63,20 +67,20 @@ pub struct ForgeVersionLibraryArtifact {
63
67
pub size : u64 ,
64
68
}
65
69
66
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
70
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
67
71
#[ serde( deny_unknown_fields) ]
68
72
pub struct ForgeVersionLibraryDownloads {
69
73
pub artifact : ForgeVersionLibraryArtifact ,
70
74
}
71
75
72
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
76
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
73
77
#[ serde( deny_unknown_fields) ]
74
78
pub struct ForgeVersionLibrary {
75
79
pub name : String ,
76
80
pub downloads : ForgeVersionLibraryDownloads ,
77
81
}
78
82
79
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
83
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
80
84
#[ serde( deny_unknown_fields) ]
81
85
pub struct ForgeVersionLoggingFile {
82
86
pub id : String ,
@@ -85,7 +89,7 @@ pub struct ForgeVersionLoggingFile {
85
89
pub url : String ,
86
90
}
87
91
88
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
92
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
89
93
#[ serde( deny_unknown_fields) ]
90
94
pub struct ForgeVersionLoggingClient {
91
95
pub argument : String ,
@@ -94,13 +98,14 @@ pub struct ForgeVersionLoggingClient {
94
98
pub client_type : String ,
95
99
}
96
100
97
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
101
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
98
102
#[ serde( deny_unknown_fields) ]
99
103
pub struct ForgeVersionLogging {
100
104
pub client : Option < ForgeVersionLoggingClient > ,
101
105
}
102
106
103
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
107
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
108
+ #[ skip_serializing_none]
104
109
#[ serde( rename_all = "camelCase" , deny_unknown_fields) ]
105
110
pub struct ForgeVersion {
106
111
#[ serde( rename = "_comment_" ) ]
@@ -118,14 +123,15 @@ pub struct ForgeVersion {
118
123
pub minecraft_arguments : Option < String > ,
119
124
}
120
125
121
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
126
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
122
127
#[ serde( deny_unknown_fields) ]
123
128
pub struct ForgeInstallerDataInfo {
124
129
pub client : String ,
125
130
pub server : String ,
126
131
}
127
132
128
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
133
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
134
+ #[ skip_serializing_none]
129
135
#[ serde( deny_unknown_fields, rename_all = "SCREAMING_SNAKE_CASE" ) ]
130
136
pub struct ForgeInstallerData {
131
137
pub mappings : Option < ForgeInstallerDataInfo > ,
@@ -145,7 +151,8 @@ pub struct ForgeInstallerData {
145
151
pub mc_data_sha : Option < ForgeInstallerDataInfo > ,
146
152
}
147
153
148
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
154
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
155
+ #[ skip_serializing_none]
149
156
#[ serde( deny_unknown_fields) ]
150
157
pub struct ForgeInstallerProcessor {
151
158
pub sides : Option < Vec < String > > ,
@@ -155,11 +162,11 @@ pub struct ForgeInstallerProcessor {
155
162
pub outputs : Option < HashMap < String , String > > ,
156
163
}
157
164
158
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
165
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
159
166
#[ serde( deny_unknown_fields) ]
160
167
pub struct ForgeLegacyLogging { }
161
168
162
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
169
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
163
170
#[ serde( deny_unknown_fields, rename_all = "camelCase" ) ]
164
171
pub struct ForgeLegacyInstall {
165
172
pub profile_name : String ,
@@ -174,36 +181,40 @@ pub struct ForgeLegacyInstall {
174
181
pub mod_list : Option < String > ,
175
182
}
176
183
177
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
184
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
185
+ #[ skip_serializing_none]
178
186
#[ serde( deny_unknown_fields, rename_all = "camelCase" ) ]
179
187
pub struct ForgeLegacyLibraryNatives {
180
188
pub linux : Option < String > ,
181
189
pub osx : Option < String > ,
182
190
pub windows : Option < String > ,
183
191
}
184
192
185
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
193
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
186
194
#[ serde( deny_unknown_fields, rename_all = "camelCase" ) ]
187
195
pub struct ForgeLegacyLibraryExtract {
188
196
pub exclude : Vec < String > ,
189
197
}
190
198
191
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
199
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
200
+ #[ skip_serializing_none]
192
201
#[ serde( rename_all = "camelCase" , deny_unknown_fields) ]
193
202
pub struct ManifestRule {
194
203
pub action : String ,
195
204
pub os : Option < ManifestRuleOS > ,
196
205
}
197
206
198
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
207
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
208
+ #[ skip_serializing_none]
199
209
#[ serde( rename_all = "camelCase" , deny_unknown_fields) ]
200
210
pub struct ManifestRuleOS {
201
211
pub name : Option < String > ,
202
212
pub version : Option < String > ,
203
213
pub arch : Option < String > ,
204
214
}
205
215
206
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
216
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
217
+ #[ skip_serializing_none]
207
218
#[ serde( deny_unknown_fields, rename_all = "camelCase" ) ]
208
219
pub struct ForgeLegacyLibrary {
209
220
pub name : String ,
@@ -217,7 +228,8 @@ pub struct ForgeLegacyLibrary {
217
228
pub comment : Option < String > ,
218
229
}
219
230
220
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
231
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
232
+ #[ skip_serializing_none]
221
233
#[ serde( deny_unknown_fields, rename_all = "camelCase" ) ]
222
234
pub struct ForgeLegacyVersionInfo {
223
235
pub id : String ,
@@ -236,7 +248,7 @@ pub struct ForgeLegacyVersionInfo {
236
248
pub logging : Option < ForgeLegacyLogging > ,
237
249
}
238
250
239
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
251
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
240
252
#[ serde( deny_unknown_fields) ]
241
253
pub struct ForgeLegacyOptional {
242
254
pub name : String ,
@@ -250,7 +262,8 @@ pub struct ForgeLegacyOptional {
250
262
pub maven : String ,
251
263
}
252
264
253
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
265
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
266
+ #[ skip_serializing_none]
254
267
#[ serde( deny_unknown_fields, rename_all = "camelCase" ) ]
255
268
pub struct ForgeLegacyInstallerManifest {
256
269
#[ serde( rename = "_comment_" ) ]
@@ -260,7 +273,8 @@ pub struct ForgeLegacyInstallerManifest {
260
273
pub optionals : Option < Vec < ForgeLegacyOptional > > ,
261
274
}
262
275
263
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
276
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
277
+ #[ skip_serializing_none]
264
278
#[ serde( deny_unknown_fields, rename_all = "camelCase" ) ]
265
279
pub struct ForgeInstallerManifest {
266
280
#[ serde( rename = "_comment_" ) ]
@@ -281,7 +295,7 @@ pub struct ForgeInstallerManifest {
281
295
pub libraries : Vec < ForgeVersionLibrary > ,
282
296
}
283
297
284
- #[ derive( Deserialize , Serialize , Clone , Debug ) ]
298
+ #[ derive( Deserialize , Serialize , Clone , Debug , Validate ) ]
285
299
#[ serde( untagged) ]
286
300
pub enum ForgeInstallerManifestVersion {
287
301
Legacy ( Box < ForgeLegacyInstallerManifest > ) ,
0 commit comments