mirror of
https://gitea.tendokyu.moe/beerpsi/icf-reader.git
synced 2025-02-17 15:48:32 +01:00
fix: give unneeded fields default values
convenient when composing an json:icf file by hand
This commit is contained in:
parent
0dff839654
commit
f34b5ac07f
@ -39,15 +39,12 @@ interface IcfInnerData {
|
||||
|
||||
interface IcfOptionData {
|
||||
type: "Option",
|
||||
app_id: string, // Does not go into the ICF, so can be anything, but must be specified
|
||||
option_id: string, // Must be 4 characters
|
||||
required_system_version: Version, // Can be zeroed out, e.g. { major: 0, minor: 0, build: 0 }
|
||||
datetime: string, // ISO8601 string yyyy-MM-dd'T'HH:mm:ss
|
||||
}
|
||||
|
||||
interface IcfPatchData {
|
||||
type: "Patch",
|
||||
id: string, // Does not go into the ICF, so can be anything, but must be specified
|
||||
|
||||
sequence_number: number, // Incremented for every patch, starting from 1
|
||||
|
||||
|
@ -26,14 +26,20 @@ pub struct IcfInnerData {
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct IcfOptionData {
|
||||
#[serde(default = "empty_string")]
|
||||
pub app_id: String,
|
||||
|
||||
pub option_id: String,
|
||||
|
||||
#[serde(default = "empty_version")]
|
||||
pub required_system_version: Version,
|
||||
|
||||
pub datetime: NaiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct IcfPatchData {
|
||||
#[serde(default = "empty_string")]
|
||||
pub id: String,
|
||||
|
||||
pub sequence_number: u8,
|
||||
@ -90,3 +96,11 @@ impl IcfData {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn empty_string() -> String {
|
||||
String::new()
|
||||
}
|
||||
|
||||
fn empty_version() -> Version {
|
||||
Version { major: 0, minor: 0, build: 0 }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user