File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const Joi = require ( 'joi' ) ;
22
3+ const { SuperBlocks } = require ( '../../shared/config/curriculum' ) ;
4+
35const slugRE = new RegExp ( '^[a-z0-9-]+$' ) ;
46const slugWithSlashRE = new RegExp ( '^[a-z0-9-/]+$' ) ;
57
@@ -25,7 +27,10 @@ const schema = Joi.object()
2527 ) ,
2628 isUpcomingChange : Joi . boolean ( ) . required ( ) ,
2729 dashedName : Joi . string ( ) . regex ( slugRE ) . required ( ) ,
28- superBlock : Joi . string ( ) . regex ( slugWithSlashRE ) . required ( ) ,
30+ superBlock : Joi . string ( )
31+ . regex ( slugWithSlashRE )
32+ . valid ( ...Object . values ( SuperBlocks ) )
33+ . required ( ) ,
2934 order : Joi . number ( ) . when ( 'superBlock' , {
3035 is : 'full-stack-developer' ,
3136 then : Joi . forbidden ( ) ,
@@ -73,5 +78,5 @@ const schema = Joi.object()
7378 . unknown ( false ) ;
7479
7580exports . metaSchemaValidator = meta => {
76- return schema . validate ( meta ) ;
81+ return schema . validate ( meta , { abortEarly : false } ) ;
7782} ;
You can’t perform that action at this time.
0 commit comments