@@ -249,7 +249,15 @@ class ValidationRun {
249249 await this . requireParentLink ( "../catalog.json" ) ;
250250 await this . requireRootLink ( "../../catalog.json" ) ;
251251
252- await this . checkOscExtension ( "product" ) ;
252+ this . t . equal ( this . data [ "osc:type" ] , "product" , `'osc:type' must be 'product'` ) ;
253+ this . t . equal ( typeof this . data [ "osc:project" ] , 'string' , `'osc:project' must be a string` ) ;
254+ if ( typeof this . data [ "osc:project" ] === 'string' ) {
255+ await this . checkOscCrossRef ( this . data [ "osc:project" ] , "projects" ) ;
256+ }
257+ await this . checkOscCrossRefArray ( this . data , "osc:variables" , "variables" ) ;
258+ await this . checkOscCrossRefArray ( this . data , "osc:missions" , "eo-missions" ) ;
259+
260+ await this . checkThemes ( this . data ) ;
253261 }
254262
255263 async validateProject ( ) {
@@ -263,7 +271,12 @@ class ValidationRun {
263271
264272 this . requireTechnicalOfficer ( ) ;
265273
266- await this . checkOscExtension ( "project" ) ;
274+ this . t . equal ( this . data [ "osc:type" ] , "project" , `'osc:type' must be 'project'` ) ;
275+ this . t . truthy ( typeof data [ 'osc:project' ] === 'undefined' , `'osc:project' must be NOT be present` ) ;
276+ this . t . truthy ( typeof data [ 'osc:variables' ] === 'undefined' , `'osc:variables' must be NOT be present` ) ;
277+ this . t . truthy ( typeof data [ 'osc:missions' ] === 'undefined' , `'osc:missions' must be NOT be present` ) ;
278+
279+ await this . checkThemes ( this . data ) ;
267280 }
268281
269282 async validateTheme ( ) {
@@ -405,20 +418,6 @@ class ValidationRun {
405418 }
406419 }
407420
408- async checkOscExtension ( type ) {
409- this . t . equal ( this . data [ "osc:type" ] , type , `'osc:type' must be '${ type } '` ) ;
410-
411- if ( type === "product" ) {
412- this . t . equal ( typeof this . data [ "osc:project" ] , 'string' , `'osc:project' must be a string` ) ;
413- if ( typeof this . data [ "osc:project" ] === 'string' ) {
414- await this . checkOscCrossRef ( this . data [ "osc:project" ] , "projects" ) ;
415- }
416- await this . checkOscCrossRefArray ( this . data , "osc:variables" , "variables" ) ;
417- }
418- await this . checkOscCrossRefArray ( this . data , "osc:missions" , "eo-missions" ) ;
419- await this . checkThemes ( this . data ) ;
420- }
421-
422421 async checkThemes ( data ) {
423422 this . t . truthy ( Array . isArray ( data . themes ) , `'themes' must be present as an array` ) ;
424423 this . t . truthy ( typeof data [ 'osc:themes' ] === 'undefined' , `'osc:themes' must be NOT be present any longer` ) ;
@@ -433,6 +432,7 @@ class ValidationRun {
433432 const exists = await this . parent . fileExists ( filepath ) ;
434433 this . t . truthy ( exists , `The referenced theme '${ obj . id } ' must exist at ${ filepath } ` ) ;
435434 } ) ) ;
435+ this . t . truthy ( Array . isArray ( data . links ) , `'links' must be present as an array` ) ;
436436 theme . concepts . forEach ( ( obj ) => {
437437 const link = data . links . find ( link => link . rel === "related" && link . href . endsWith ( `/themes/${ obj . id } /catalog.json` ) ) ;
438438 this . t . truthy ( link , `must have a 'related' link to the theme '${ obj . id } '` ) ;
0 commit comments