Skip to content

Commit 0655b44

Browse files
committed
change to fallback to validate instead of trying it first
1 parent e00cba3 commit 0655b44

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/dsc-lib/src/dscresources/command_resource.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,11 @@ fn verify_with_export_schema(input: &str, resource: &DscResource, target_resourc
621621
return Err(DscError::MissingManifest(resource.type_name.to_string()));
622622
};
623623

624-
if manifest.validate.is_some() {
624+
let Some(export) = manifest.export.as_ref() else {
625+
return Err(DscError::SchemaNotAvailable(resource.type_name.to_string()));
626+
};
627+
628+
if export.schema.is_none() && manifest.validate.is_some() {
625629
let result = invoke_validate(resource, input, target_resource)?;
626630
if result.valid {
627631
return Ok(());
@@ -635,10 +639,6 @@ fn verify_with_export_schema(input: &str, resource: &DscResource, target_resourc
635639
return Err(DscError::Validation(reason));
636640
}
637641

638-
let Some(export) = manifest.export.as_ref() else {
639-
return Err(DscError::SchemaNotAvailable(resource.type_name.to_string()));
640-
};
641-
642642
let schema = match export.schema {
643643
Some(ExportSchemaKind::Command(ref command)) => {
644644
let resource_type = match target_resource {

0 commit comments

Comments
 (0)