@@ -795,6 +795,19 @@ const cubeSchema = inherit(baseSchema, {
795795 'object.xor' : 'You must use either sql or sqlTable within a model, but not both'
796796} ) ;
797797
798+ const folderSchema = Joi . object ( ) . keys ( {
799+ name : Joi . string ( ) . required ( ) ,
800+ includes : Joi . alternatives ( [
801+ Joi . string ( ) . valid ( '*' ) ,
802+ Joi . array ( ) . items (
803+ Joi . alternatives ( [
804+ Joi . string ( ) . required ( ) ,
805+ Joi . link ( '#folderSchema' ) , // Can contain nested folders
806+ ] ) ,
807+ ) ,
808+ ] ) . required ( ) ,
809+ } ) . id ( 'folderSchema' ) ;
810+
798811const viewSchema = inherit ( baseSchema , {
799812 isView : Joi . boolean ( ) . strict ( ) ,
800813 cubes : Joi . array ( ) . items (
@@ -822,13 +835,7 @@ const viewSchema = inherit(baseSchema, {
822835 'object.oxor' : 'Using split together with prefix is not supported'
823836 } )
824837 ) ,
825- folders : Joi . array ( ) . items ( Joi . object ( ) . keys ( {
826- name : Joi . string ( ) . required ( ) ,
827- includes : Joi . alternatives ( [
828- Joi . string ( ) . valid ( '*' ) ,
829- Joi . array ( ) . items ( Joi . string ( ) . required ( ) )
830- ] ) . required ( ) ,
831- } ) ) ,
838+ folders : Joi . array ( ) . items ( folderSchema ) ,
832839} ) ;
833840
834841function formatErrorMessageFromDetails ( explain , d ) {
0 commit comments