Skip to content

Commit b6ae242

Browse files
committed
fix(gitea-client): improve optional field handling in Repository struct
1 parent cb45df8 commit b6ae242

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resolver = "2"
77
[package]
88
name = "backend"
99
description = "Backend API and services for StackClass"
10-
version = "0.32.0"
10+
version = "0.32.1"
1111
edition = "2024"
1212

1313
default-run = "stackclass-server"

crates/gitea-client/src/types/repository.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ pub struct Repository {
114114
pub empty: bool,
115115

116116
/// External tracker configuration.
117-
pub external_tracker: ExternalTracker,
117+
#[serde(skip_serializing_if = "Option::is_none")]
118+
pub external_tracker: Option<ExternalTracker>,
118119

119120
/// External wiki configuration.
120-
pub external_wiki: ExternalWiki,
121+
#[serde(skip_serializing_if = "Option::is_none")]
122+
pub external_wiki: Option<ExternalWiki>,
121123

122124
/// Whether the repository is a fork.
123125
pub fork: bool,
@@ -129,13 +131,15 @@ pub struct Repository {
129131
pub full_name: String,
130132

131133
/// Whether the repository has GitHub Actions enabled.
132-
pub has_actions: bool,
134+
#[serde(skip_serializing_if = "Option::is_none")]
135+
pub has_actions: Option<bool>,
133136

134137
/// Whether the repository has issues enabled.
135138
pub has_issues: bool,
136139

137140
/// Whether the repository has packages enabled.
138-
pub has_packages: bool,
141+
#[serde(skip_serializing_if = "Option::is_none")]
142+
pub has_packages: Option<bool>,
139143

140144
/// Whether the repository has projects enabled.
141145
pub has_projects: bool,
@@ -144,7 +148,8 @@ pub struct Repository {
144148
pub has_pull_requests: bool,
145149

146150
/// Whether the repository has releases enabled.
147-
pub has_releases: bool,
151+
#[serde(skip_serializing_if = "Option::is_none")]
152+
pub has_releases: Option<bool>,
148153

149154
/// Whether the repository has a wiki enabled.
150155
pub has_wiki: bool,
@@ -162,7 +167,8 @@ pub struct Repository {
162167
pub internal: bool,
163168

164169
/// Internal tracker configuration.
165-
pub internal_tracker: InternalTracker,
170+
#[serde(skip_serializing_if = "Option::is_none")]
171+
pub internal_tracker: Option<InternalTracker>,
166172

167173
/// Primary language of the repository.
168174
pub language: String,
@@ -183,7 +189,8 @@ pub struct Repository {
183189
pub mirror_interval: String,
184190

185191
/// Timestamp when the mirror was last updated.
186-
pub mirror_updated: String,
192+
#[serde(skip_serializing_if = "Option::is_none")]
193+
pub mirror_updated: Option<DateTime<Utc>>,
187194

188195
/// Name of the repository.
189196
pub name: String,
@@ -207,7 +214,8 @@ pub struct Repository {
207214
pub parent: Option<Box<Repository>>,
208215

209216
/// Permissions for the repository.
210-
pub permissions: Permissions,
217+
#[serde(skip_serializing_if = "Option::is_none")]
218+
pub permissions: Option<Permissions>,
211219

212220
/// Whether the repository is private.
213221
pub private: bool,

openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": {
77
"name": ""
88
},
9-
"version": "0.32.0"
9+
"version": "0.32.1"
1010
},
1111
"paths": {
1212
"/v1/courses": {

0 commit comments

Comments
 (0)