Skip to content

Commit f56471c

Browse files
committed
add Payload and Template types
1 parent 5d8a486 commit f56471c

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

rust/catalyst-signed-doc-spec/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ pub mod doc_types;
77
pub mod headers;
88
pub mod is_required;
99
pub mod metadata;
10+
pub mod payload;
1011

1112
use std::{collections::HashMap, fmt::Display};
1213

1314
use build_info as build_info_lib;
1415

15-
use crate::{copyright::Copyright, headers::Headers, metadata::Metadata};
16+
use crate::{copyright::Copyright, headers::Headers, metadata::Metadata, payload::Payload};
1617

1718
build_info_lib::build_info!(pub(crate) fn build_info);
1819

@@ -65,6 +66,7 @@ pub struct DocSpec {
6566
pub doc_type: String,
6667
pub headers: Headers,
6768
pub metadata: Metadata,
69+
pub payload: Payload,
6870
}
6971

7072
impl CatalystSignedDocSpec {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
//! `metadata` field definition
22
33
pub mod doc_ref;
4+
pub mod template;
45

56
/// Document's metadata fields definition
67
#[derive(serde::Deserialize)]
78
#[allow(clippy::missing_docs_in_private_items)]
89
pub struct Metadata {
10+
pub template: template::Template,
911
#[serde(rename = "ref")]
1012
pub doc_ref: doc_ref::Ref,
1113
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//! `signed_doc.json` "template" field JSON definition
2+
3+
use crate::{is_required::IsRequired, DocumentName};
4+
5+
/// `signed_doc.json` "template" field JSON object
6+
#[derive(serde::Deserialize)]
7+
#[allow(clippy::missing_docs_in_private_items, dead_code)]
8+
pub struct Template {
9+
pub required: IsRequired,
10+
#[serde(rename = "type")]
11+
pub doc_type: Option<DocumentName>,
12+
pub multiple: Option<bool>,
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//! `signed_doc.json` "payload" field JSON definition
2+
3+
/// `signed_doc.json` "payload" field JSON object
4+
#[derive(serde::Deserialize)]
5+
#[allow(clippy::missing_docs_in_private_items)]
6+
pub struct Payload {
7+
pub nil: bool,
8+
pub schema: Option<serde_json::Value>,
9+
}

0 commit comments

Comments
 (0)