@@ -96,6 +96,17 @@ fn apply_config(
9696 for ( key, value) in value. as_table ( ) . ok_or_else ( || {
9797 ParserError :: InvalidValueType ( key. clone ( ) , ConfigPropertyType :: Object ( Default :: default ( ) ) )
9898 } ) ? {
99+ if key == "cfg::Config" {
100+ let table = schema. get_root_table ( ) ;
101+ let Some ( toml_table) = value. as_table ( ) else {
102+ return Err ( ParserError :: ExpectedTableOrArray ( key. clone ( ) ) ) ;
103+ } ;
104+ let properties = parse_properties ( toml_table, table) ?;
105+ for ( _, property) in properties {
106+ ops. set . push ( property) ;
107+ }
108+ continue ;
109+ }
99110 let tables = schema. get_tables_by_path_or_name ( key) ;
100111 if ( value. is_array ( ) || value. is_table ( ) ) && !tables. is_empty ( ) {
101112 if value. is_array ( ) && !tables[ 0 ] . multi {
@@ -242,26 +253,30 @@ pub fn parse_property(
242253 let ( property_type, value, object_type) = match ( value, & property. property_type ) {
243254 ( toml:: Value :: String ( value) , ConfigPropertyType :: Primitive ( primitive_type) ) => (
244255 primitive_type. to_schema_type ( ) . name ,
245- SchemaValue :: Unitary ( value. clone ( ) ) ,
256+ SchemaValue :: Unitary ( ops :: SchemaPrimitive :: String ( value. clone ( ) ) ) ,
246257 None ,
247258 ) ,
248259 ( toml:: Value :: String ( value) , ConfigPropertyType :: Enum ( name, _) ) => {
249260 // TODO: check enum values
250- ( name. clone ( ) , SchemaValue :: Unitary ( value. clone ( ) ) , None )
261+ (
262+ name. clone ( ) ,
263+ SchemaValue :: Unitary ( ops:: SchemaPrimitive :: String ( value. clone ( ) ) ) ,
264+ None ,
265+ )
251266 }
252267 ( toml:: Value :: Integer ( value) , ConfigPropertyType :: Primitive ( primitive_type) ) => (
253268 primitive_type. to_schema_type ( ) . name ,
254- SchemaValue :: Unitary ( value . to_string ( ) ) ,
269+ SchemaValue :: Unitary ( ops :: SchemaPrimitive :: Integer ( * value as isize ) ) ,
255270 None ,
256271 ) ,
257272 ( toml:: Value :: Float ( value) , ConfigPropertyType :: Primitive ( primitive_type) ) => (
258273 primitive_type. to_schema_type ( ) . name ,
259- SchemaValue :: Unitary ( value. to_string ( ) ) ,
274+ SchemaValue :: Unitary ( ops :: SchemaPrimitive :: String ( value. to_string ( ) ) ) ,
260275 None ,
261276 ) ,
262277 ( toml:: Value :: Boolean ( value) , ConfigPropertyType :: Primitive ( primitive_type) ) => (
263278 primitive_type. to_schema_type ( ) . name ,
264- SchemaValue :: Unitary ( value . to_string ( ) ) ,
279+ SchemaValue :: Unitary ( ops :: SchemaPrimitive :: Bool ( * value ) ) ,
265280 None ,
266281 ) ,
267282 ( toml:: Value :: Array ( value) , ConfigPropertyType :: Array ( array_type) ) => (
@@ -274,7 +289,7 @@ pub fn parse_property(
274289 . ok_or_else ( || {
275290 ParserError :: InvalidValueType ( key. to_string ( ) , * array_type. clone ( ) )
276291 } )
277- . map ( |s| s. to_owned ( ) )
292+ . map ( |s| ops :: SchemaPrimitive :: String ( s. to_owned ( ) ) )
278293 } )
279294 . collect :: < Result < Vec < _ > , _ > > ( ) ?,
280295 ) ,
0 commit comments