Skip to content

Commit

Permalink
Merge pull request #24 from jiahao6635/master
Browse files Browse the repository at this point in the history
content and Tree add ToSchema
  • Loading branch information
wangeguo authored Jan 16, 2024
2 parents 75fd879 + 2d0f5b4 commit 67587a2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/scm/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
// limitations under the License.

use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

/// represents a git repository.
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, ToSchema)]
pub struct Content {
pub path: String,
pub data: Vec<u8>,
Expand Down
25 changes: 13 additions & 12 deletions src/scm/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use super::client::ListOptions;
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

/// Represents a git reference.
#[derive(Debug, PartialEq)]
Expand Down Expand Up @@ -44,24 +45,24 @@ pub struct Signature {
pub avatar: Option<String>,
}

#[derive(Debug, Default, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Default, PartialEq, Serialize, Deserialize, ToSchema)]
pub struct Tree {
sha: String,
url: String,
tree: Vec<TreeEntry>,
truncated: bool,
pub sha: String,
pub url: String,
pub tree: Vec<TreeEntry>,
pub truncated: bool,
}

#[derive(Debug, Default, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Default, PartialEq, Serialize, Deserialize, ToSchema)]
pub struct TreeEntry {
path: String,
mode: String,
pub path: String,
pub mode: String,
#[serde(rename = "type")]
entry_type: String,
size: Option<u64>,
pub entry_type: String,
pub size: Option<u64>,
// Some entries have a "size" field, but it might be absent
sha: String,
url: String,
pub sha: String,
pub url: String,
}
/// Provides access to git resources.
pub trait GitService {
Expand Down

0 comments on commit 67587a2

Please sign in to comment.