@@ -32,30 +32,30 @@ validator.addValidation(async (tutorials) => {
3232 tutorials . forEach ( tutorial => {
3333 let jsonData = tutorial . metadata ;
3434 if ( ! jsonData ) {
35- const errorMessage = "No metadata file found" ;
36- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . metadataPath ) ) ;
35+ const errorMessage = "No metadata found" ;
36+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
3737 return ;
3838 }
3939
4040 try {
4141 if ( ! jsonData . coverImage ) {
4242 const errorMessage = "No cover image found" ;
43- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . metadataPath ) ) ;
43+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
4444 } else if ( jsonData . coverImage . indexOf ( ".svg" ) == - 1 ) {
4545 const errorMessage = "Cover image is not in SVG format." ;
46- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . metadataPath ) ) ;
46+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
4747 }
4848
4949 let jsonSchema = JSON . parse ( fs . readFileSync ( config . metadataSchema ) ) ;
5050 let validationResult = validate ( jsonData , jsonSchema ) ;
5151 if ( validationResult . errors . length != 0 ) {
5252 const errorMessage = `An error occurred while validating the metadata ${ validationResult } ` ;
53- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . metadataPath ) ) ;
53+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
5454 }
5555
5656 } catch ( error ) {
5757 const errorMessage = "An error occurred while parsing the metadata" ;
58- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . metadataPath ) ) ;
58+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
5959 }
6060 } ) ;
6161 return errorsOccurred ;
@@ -96,8 +96,8 @@ validator.addValidation(async (tutorials) => {
9696 let image = htmlDoc . querySelector ( "image" )
9797 // Detect if there are embedded images that are actually rendered
9898 if ( image . attributes . width || image . attributes . height ) {
99- const errorMessage = path + " containes embedded binary images" ;
100- errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path ) ) ;
99+ const errorMessage = path + " contains embedded binary images. " ;
100+ errorsOccurred . push ( new ValidationError ( errorMessage , tutorial . path , "warning" ) ) ;
101101 }
102102 }
103103 } ) ;
0 commit comments