@@ -63,7 +63,7 @@ exports.get = function() {
6363 return {
6464 defs : {
6565 valObjects : valObjectMeta ,
66- metaKeys : UNDERSCORE_ATTRS . concat ( [ 'description' , 'editType' , 'impliedEdits' ] ) ,
66+ metaKeys : UNDERSCORE_ATTRS . concat ( [ 'description' , 'role' , ' editType', 'impliedEdits' ] ) ,
6767 editType : {
6868 traces : editTypes . traces ,
6969 layout : editTypes . layout
@@ -600,14 +600,14 @@ function getFramesAttributes() {
600600}
601601
602602function formatAttributes ( attrs ) {
603- mergeValType ( attrs ) ;
603+ mergeValTypeAndRole ( attrs ) ;
604604 formatArrayContainers ( attrs ) ;
605605 stringify ( attrs ) ;
606606
607607 return attrs ;
608608}
609609
610- function mergeValType ( attrs ) {
610+ function mergeValTypeAndRole ( attrs ) {
611611 function makeSrcAttr ( attrName ) {
612612 return {
613613 valType : 'string' ,
@@ -622,12 +622,17 @@ function mergeValType(attrs) {
622622 function callback ( attr , attrName , attrs ) {
623623 if ( exports . isValObject ( attr ) ) {
624624 if ( attr . valType === 'data_array' ) {
625+ // all 'data_array' attrs have role 'data'
626+ attr . role = 'data' ;
625627 // all 'data_array' attrs have a corresponding 'src' attr
626628 attrs [ attrName + 'src' ] = makeSrcAttr ( attrName ) ;
627629 } else if ( attr . arrayOk === true ) {
628630 // all 'arrayOk' attrs have a corresponding 'src' attr
629631 attrs [ attrName + 'src' ] = makeSrcAttr ( attrName ) ;
630632 }
633+ } else if ( isPlainObject ( attr ) ) {
634+ // all attrs container objects get role 'object'
635+ attr . role = 'object' ;
631636 }
632637 }
633638
@@ -646,6 +651,7 @@ function formatArrayContainers(attrs) {
646651
647652 attrs [ attrName ] = { items : { } } ;
648653 attrs [ attrName ] . items [ itemName ] = attr ;
654+ attrs [ attrName ] . role = 'object' ;
649655 }
650656
651657 exports . crawl ( attrs , callback ) ;
0 commit comments