@@ -57,15 +57,31 @@ pub use oca_bundle_semantics::{
57
57
controller:: load_oca as load,
58
58
state:: {
59
59
attribute:: { Attribute , AttributeType } ,
60
- oca:: { OCABox as StructuralBox , OCABundle as StructuralBundle } ,
60
+ oca:: { OCABox , OCABundle } ,
61
61
validator:: { SemanticValidationStatus , Validator as OCAValidator } ,
62
62
} ,
63
63
} ;
64
64
pub use oca_rs:: facade:: build:: build_from_ocafile;
65
- use oca_rs:: facade:: bundle:: Bundle ;
65
+ use oca_rs:: {
66
+ facade:: bundle:: Bundle , EncodeBundle , HashFunctionCode ,
67
+ SerializationFormats ,
68
+ } ;
66
69
use std:: collections:: HashMap ;
67
70
pub use transformation_file:: state:: Transformation ;
68
71
72
+ pub trait ToJSON {
73
+ fn get_json_bundle ( & self ) -> String ;
74
+ }
75
+
76
+ impl ToJSON for OCABundle {
77
+ fn get_json_bundle ( & self ) -> String {
78
+ let code = HashFunctionCode :: Blake3_256 ;
79
+ let format = SerializationFormats :: JSON ;
80
+
81
+ String :: from_utf8 ( self . encode ( & code, & format) . unwrap ( ) ) . unwrap ( )
82
+ }
83
+ }
84
+
69
85
pub trait WithInfo {
70
86
fn info ( & self ) -> BundleInfo ;
71
87
}
@@ -88,7 +104,7 @@ impl BundleInfo {
88
104
let mut attributes = HashMap :: new ( ) ;
89
105
let mut meta = HashMap :: new ( ) ;
90
106
if let Some ( structural_bundle) = bundle. structural {
91
- let structural_box = StructuralBox :: from ( structural_bundle. clone ( ) ) ;
107
+ let structural_box = OCABox :: from ( structural_bundle. clone ( ) ) ;
92
108
if let Some ( m) = structural_box. meta {
93
109
m. iter ( ) . for_each ( |( k, v) | {
94
110
meta. insert ( k. to_639_3 ( ) . to_string ( ) , v. to_owned ( ) ) ;
0 commit comments