@@ -110,6 +110,14 @@ const GranularityInterval = Joi.string().pattern(/^\d+\s+(second|minute|hour|day
110110// Do not allow negative intervals for granularities, while offsets could be negative
111111const GranularityOffset = Joi . string ( ) . pattern ( / ^ - ? ( \d + \s + ) ( s e c o n d | m i n u t e | h o u r | d a y | w e e k | m o n t h | q u a r t e r | y e a r ) s ? ( \s - ? \d + \s + ( s e c o n d | m i n u t e | h o u r | d a y | w e e k | m o n t h | q u a r t e r | y e a r ) s ? ) { 0 , 7 } $ / , 'granularity offset' ) ;
112112
113+ const formatSchema = Joi . alternatives ( [
114+ Joi . string ( ) . valid ( 'imageUrl' , 'link' , 'currency' , 'percent' , 'number' , 'id' ) ,
115+ Joi . object ( ) . keys ( {
116+ type : Joi . string ( ) . valid ( 'link' ) ,
117+ label : Joi . string ( ) . required ( )
118+ } )
119+ ] ) ;
120+
113121const BaseDimensionWithoutSubQuery = {
114122 aliases : Joi . array ( ) . items ( Joi . string ( ) ) ,
115123 type : Joi . any ( ) . valid ( 'string' , 'number' , 'boolean' , 'time' , 'geo' ) . required ( ) ,
@@ -122,13 +130,7 @@ const BaseDimensionWithoutSubQuery = {
122130 description : Joi . string ( ) ,
123131 suggestFilterValues : Joi . boolean ( ) . strict ( ) ,
124132 enableSuggestions : Joi . boolean ( ) . strict ( ) ,
125- format : Joi . alternatives ( [
126- Joi . string ( ) . valid ( 'imageUrl' , 'link' , 'currency' , 'percent' , 'number' , 'id' ) ,
127- Joi . object ( ) . keys ( {
128- type : Joi . string ( ) . valid ( 'link' ) ,
129- label : Joi . string ( ) . required ( )
130- } )
131- ] ) ,
133+ format : formatSchema ,
132134 meta : Joi . any ( ) ,
133135 granularities : Joi . when ( 'type' , {
134136 is : 'time' ,
@@ -796,7 +798,11 @@ const viewSchema = inherit(baseSchema, {
796798 Joi . string ( ) . required ( ) ,
797799 Joi . object ( ) . keys ( {
798800 name : identifier . required ( ) ,
799- alias : identifier
801+ alias : identifier ,
802+ title : Joi . string ( ) ,
803+ description : Joi . string ( ) ,
804+ format : formatSchema ,
805+ meta : Joi . any ( ) ,
800806 } )
801807 ] ) )
802808 ] ) . required ( ) ,
0 commit comments