@@ -63,7 +63,7 @@ exports.get = function() {
63
63
return {
64
64
defs : {
65
65
valObjects : valObjectMeta ,
66
- metaKeys : UNDERSCORE_ATTRS . concat ( [ 'description' , 'editType' , 'impliedEdits' ] ) ,
66
+ metaKeys : UNDERSCORE_ATTRS . concat ( [ 'description' , 'role' , ' editType', 'impliedEdits' ] ) ,
67
67
editType : {
68
68
traces : editTypes . traces ,
69
69
layout : editTypes . layout
@@ -600,14 +600,14 @@ function getFramesAttributes() {
600
600
}
601
601
602
602
function formatAttributes ( attrs ) {
603
- mergeValType ( attrs ) ;
603
+ mergeValTypeAndRole ( attrs ) ;
604
604
formatArrayContainers ( attrs ) ;
605
605
stringify ( attrs ) ;
606
606
607
607
return attrs ;
608
608
}
609
609
610
- function mergeValType ( attrs ) {
610
+ function mergeValTypeAndRole ( attrs ) {
611
611
function makeSrcAttr ( attrName ) {
612
612
return {
613
613
valType : 'string' ,
@@ -622,12 +622,17 @@ function mergeValType(attrs) {
622
622
function callback ( attr , attrName , attrs ) {
623
623
if ( exports . isValObject ( attr ) ) {
624
624
if ( attr . valType === 'data_array' ) {
625
+ // all 'data_array' attrs have role 'data'
626
+ attr . role = 'data' ;
625
627
// all 'data_array' attrs have a corresponding 'src' attr
626
628
attrs [ attrName + 'src' ] = makeSrcAttr ( attrName ) ;
627
629
} else if ( attr . arrayOk === true ) {
628
630
// all 'arrayOk' attrs have a corresponding 'src' attr
629
631
attrs [ attrName + 'src' ] = makeSrcAttr ( attrName ) ;
630
632
}
633
+ } else if ( isPlainObject ( attr ) ) {
634
+ // all attrs container objects get role 'object'
635
+ attr . role = 'object' ;
631
636
}
632
637
}
633
638
@@ -646,6 +651,7 @@ function formatArrayContainers(attrs) {
646
651
647
652
attrs [ attrName ] = { items : { } } ;
648
653
attrs [ attrName ] . items [ itemName ] = attr ;
654
+ attrs [ attrName ] . role = 'object' ;
649
655
}
650
656
651
657
exports . crawl ( attrs , callback ) ;
0 commit comments