@@ -588,24 +588,24 @@ pub fn validate_properties(resource: &DscResource, properties: &Value) -> Result
588
588
// convert to resource_manifest``
589
589
let manifest: ResourceManifest = serde_json:: from_value ( manifest) ?;
590
590
if manifest. validate . is_some ( ) {
591
- debug ! ( "{}: {type_name} " , t!( "subcommand .resourceImplementsValidate" ) ) ;
591
+ debug ! ( "{}: {type_name} " , t!( "dscresources.dscresource .resourceImplementsValidate" ) ) ;
592
592
let resource_config = properties. to_string ( ) ;
593
593
let result = resource. validate ( & resource_config) ?;
594
594
if !result. valid {
595
- let reason = result. reason . unwrap_or ( t ! ( "subcommand .noReason" ) . to_string ( ) ) ;
596
- return Err ( DscError :: Validation ( format ! ( "{}: {type_name} {reason}" , t!( "subcommand .resourceValidationFailed" ) ) ) ) ;
595
+ let reason = result. reason . unwrap_or ( t ! ( "dscresources.dscresource .noReason" ) . to_string ( ) ) ;
596
+ return Err ( DscError :: Validation ( format ! ( "{}: {type_name} {reason}" , t!( "dscresources.dscresource .resourceValidationFailed" ) ) ) ) ;
597
597
}
598
598
return Ok ( ( ) )
599
599
}
600
600
// use schema validation
601
- trace ! ( "{}: {type_name}" , t!( "subcommand .resourceDoesNotImplementValidate" ) ) ;
601
+ trace ! ( "{}: {type_name}" , t!( "dscresources.dscresource .resourceDoesNotImplementValidate" ) ) ;
602
602
let Ok ( schema) = resource. schema ( ) else {
603
- return Err ( DscError :: Validation ( format ! ( "{}: {type_name}" , t!( "subcommand .noSchemaOrValidate" ) ) ) ) ;
603
+ return Err ( DscError :: Validation ( format ! ( "{}: {type_name}" , t!( "dscresources.dscresource .noSchemaOrValidate" ) ) ) ) ;
604
604
} ;
605
605
let schema = serde_json:: from_str ( & schema) ?;
606
606
return validate_json ( & resource. type_name , & schema, properties)
607
607
}
608
- Err ( DscError :: Validation ( format ! ( "{}: {type_name}" , t!( "subcommand .noManifest" ) ) ) )
608
+ Err ( DscError :: Validation ( format ! ( "{}: {type_name}" , t!( "dscresources.dscresource .noManifest" ) ) ) )
609
609
}
610
610
611
611
/// Validate the JSON against the schema.
@@ -624,18 +624,18 @@ pub fn validate_properties(resource: &DscResource, properties: &Value) -> Result
624
624
///
625
625
/// * `DscError` - The JSON is invalid
626
626
pub fn validate_json ( source : & str , schema : & Value , json : & Value ) -> Result < ( ) , DscError > {
627
- debug ! ( "{}: {source}" , t!( "util .validatingSchema" ) ) ;
627
+ debug ! ( "{}: {source}" , t!( "dscresources.dscresource .validatingSchema" ) ) ;
628
628
trace ! ( "JSON: {json}" ) ;
629
629
trace ! ( "Schema: {schema}" ) ;
630
630
let compiled_schema = match Validator :: new ( schema) {
631
631
Ok ( compiled_schema) => compiled_schema,
632
632
Err ( err) => {
633
- return Err ( DscError :: Validation ( format ! ( "{}: {err}" , t!( "util .failedToCompileSchema" ) ) ) ) ;
633
+ return Err ( DscError :: Validation ( format ! ( "{}: {err}" , t!( "dscresources.dscresource .failedToCompileSchema" ) ) ) ) ;
634
634
}
635
635
} ;
636
636
637
637
if let Err ( err) = compiled_schema. validate ( json) {
638
- return Err ( DscError :: Validation ( format ! ( "{}: '{source}' {err}" , t!( "util .validationFailed" ) ) ) ) ;
638
+ return Err ( DscError :: Validation ( format ! ( "{}: '{source}' {err}" , t!( "dscresources.dscresource .validationFailed" ) ) ) ) ;
639
639
}
640
640
641
641
Ok ( ( ) )
0 commit comments