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

Commit 470ef75

Browse files
committed
Add schema to record responses
Adds the "schema" type field to record responses. This data exists in the DB but did not get put in the response. It should be there to identify the type of schema that the record is based off of. Signed-off-by: Darian Plumb <[email protected]>
1 parent 486ca1e commit 470ef75

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
@@ -672,6 +672,9 @@ components:
672672
record_id:
673673
type: string
674674
example: 7h15-45537-15-br173
675+
schema:
676+
type: string
677+
example: Lightbulb
675678
owner:
676679
type: string
677680
example: 02cd3181dbd7d1539f470436ce222c53ab5e514f67809dc0095895e6cdfba97612

daemon/src/rest_api/routes/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ mod test {
821821
assert_eq!(body.len(), 1);
822822
let test_record = body.first().unwrap();
823823
assert_eq!(test_record.record_id, "Test Record".to_string());
824+
assert_eq!(test_record.schema, "Test Grid Schema".to_string());
824825
assert_eq!(test_record.owner, KEY1.to_string());
825826
assert_eq!(test_record.custodian, KEY2.to_string());
826827
assert_eq!(test_record.r#final, false);
@@ -866,6 +867,7 @@ mod test {
866867
assert_eq!(body.len(), 1);
867868
let test_record = body.first().unwrap();
868869
assert_eq!(test_record.record_id, "Test Record".to_string());
870+
assert_eq!(test_record.schema, "Test Grid Schema".to_string());
869871
assert_eq!(test_record.r#final, true);
870872
}
871873

@@ -918,6 +920,7 @@ mod test {
918920
let test_record: RecordSlice =
919921
serde_json::from_slice(&*response.body().wait().unwrap()).unwrap();
920922
assert_eq!(test_record.record_id, "Test Record".to_string());
923+
assert_eq!(test_record.schema, "Test Grid Schema".to_string());
921924
assert_eq!(test_record.owner, KEY1.to_string());
922925
assert_eq!(test_record.custodian, KEY2.to_string());
923926
assert_eq!(test_record.r#final, false);
@@ -967,6 +970,7 @@ mod test {
967970
serde_json::from_slice(&*response.body().wait().unwrap()).unwrap();
968971

969972
assert_eq!(test_record.record_id, "Test Record".to_string());
973+
assert_eq!(test_record.schema, "Test Grid Schema".to_string());
970974
assert_eq!(test_record.owner, KEY2.to_string());
971975
assert_eq!(test_record.custodian, KEY1.to_string());
972976
assert_eq!(test_record.r#final, true);

daemon/src/rest_api/routes/records.rs

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ impl ProposalSlice {
6363
#[derive(Debug, Serialize, Deserialize)]
6464
pub struct RecordSlice {
6565
pub record_id: String,
66+
pub schema: String,
6667
pub owner: String,
6768
pub custodian: String,
6869
pub r#final: bool,
@@ -93,6 +94,7 @@ impl RecordSlice {
9394

9495
Self {
9596
record_id: record.record_id.clone(),
97+
schema: record.schema.clone(),
9698
owner: match owner_updates.last() {
9799
Some(owner) => owner.agent_id.clone(),
98100
None => "".to_string(),

0 commit comments

Comments
 (0)