Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit 2c56a0d

Browse files
authored
Merge pull request #95 from Cargill/DarianPlumb-add-schema-to-record
Add schema to record responses
2 parents dff1493 + 470ef75 commit 2c56a0d

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

daemon/openapi.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,9 @@ components:
710710
record_id:
711711
type: string
712712
example: 7h15-45537-15-br173
713+
schema:
714+
type: string
715+
example: Lightbulb
713716
owner:
714717
type: string
715718
example: 02cd3181dbd7d1539f470436ce222c53ab5e514f67809dc0095895e6cdfba97612

daemon/src/rest_api/routes/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ mod test {
834834
assert_eq!(body.len(), 1);
835835
let test_record = body.first().unwrap();
836836
assert_eq!(test_record.record_id, "Test Record".to_string());
837+
assert_eq!(test_record.schema, "Test Grid Schema".to_string());
837838
assert_eq!(test_record.owner, KEY1.to_string());
838839
assert_eq!(test_record.custodian, KEY2.to_string());
839840
assert_eq!(test_record.properties.len(), 2);
@@ -925,6 +926,7 @@ mod test {
925926
assert_eq!(body.len(), 1);
926927
let test_record = body.first().unwrap();
927928
assert_eq!(test_record.record_id, "Test Record".to_string());
929+
assert_eq!(test_record.schema, "Test Grid Schema".to_string());
928930
assert_eq!(test_record.r#final, true);
929931
}
930932

@@ -994,6 +996,7 @@ mod test {
994996
let test_record: RecordSlice =
995997
serde_json::from_slice(&*response.body().wait().unwrap()).unwrap();
996998
assert_eq!(test_record.record_id, "Test Record".to_string());
999+
assert_eq!(test_record.schema, "Test Grid Schema".to_string());
9971000
assert_eq!(test_record.owner, KEY1.to_string());
9981001
assert_eq!(test_record.custodian, KEY2.to_string());
9991002

@@ -1096,6 +1099,7 @@ mod test {
10961099
serde_json::from_slice(&*response.body().wait().unwrap()).unwrap();
10971100

10981101
assert_eq!(test_record.record_id, "Test Record".to_string());
1102+
assert_eq!(test_record.schema, "Test Grid Schema".to_string());
10991103
assert_eq!(test_record.owner, KEY2.to_string());
11001104
assert_eq!(test_record.custodian, KEY1.to_string());
11011105

daemon/src/rest_api/routes/records.rs

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ impl ProposalSlice {
7272
#[derive(Debug, Serialize, Deserialize)]
7373
pub struct RecordSlice {
7474
pub record_id: String,
75+
pub schema: String,
7576
pub owner: String,
7677
pub custodian: String,
7778
pub properties: Vec<PropertySlice>,
@@ -104,6 +105,7 @@ impl RecordSlice {
104105

105106
Self {
106107
record_id: record.record_id.clone(),
108+
schema: record.schema.clone(),
107109
owner: match owner_updates.last() {
108110
Some(owner) => owner.agent_id.clone(),
109111
None => "".to_string(),

0 commit comments

Comments
 (0)