Skip to content

Commit 138d2b0

Browse files
authored
Merge pull request #125 from open-ephys/issue-76
Filter out properties w/ [Browsable(false)] attribute
2 parents 409a498 + dac44a8 commit 138d2b0

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

template/ManagedReference.extension.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ function processChildProperty(child, sharedModel) {
3333
return {
3434
'name': child.name[0].value,
3535
'type': child.syntax.return.type.specName[0].value,
36-
'propertyDescription': {
36+
'propertyDescription':
37+
{
3738
'text': addCodeTag([child.summary, child.remarks].join('')),
3839
'hasEnum': enumFields.length > 0,
3940
'enum': enumFields,
@@ -43,27 +44,34 @@ function processChildProperty(child, sharedModel) {
4344
}
4445
}
4546

47+
const filterProperties = propertyCandidate => propertyCandidate.type === 'property' && !propertyCandidate?.attributes.some(attribute =>
48+
attribute.type === 'System.ComponentModel.BrowsableAttribute' && attribute.arguments[0].value === false);
49+
4650
function extractPropertiesData(model, sharedModel) {
4751
return model?.children
48-
.filter(child => child.type === 'property' && child.syntax)
52+
.filter(filterProperties)
4953
.map(child => processChildProperty(child, sharedModel));
5054
}
5155

5256
function extractPropertiesFromInheritedMembersData(model, sharedModel) {
5357
return model.inheritedMembers
54-
.filter(inheritedMember => inheritedMember.type === 'property')
55-
.map(inheritedMember => (
56-
processChildProperty(
58+
.filter(filterProperties)
59+
.map(inheritedMember =>
60+
(
61+
processChildProperty
62+
(
5763
sharedModel[`~/api/${inheritedMember.parent}.yml`].children.find(inheritedMemberChild => inheritedMemberChild.uid === inheritedMember.uid),
5864
sharedModel
5965
)
60-
));
66+
)
67+
);
6168
}
6269

6370
function extractConstituentOperatorsData(model) {
6471
return model?.children
6572
.filter(child => child.type === 'property' && model.__global._shared?.[`~/api/${child.syntax.return.type.uid}.yml`].type === 'class')
66-
.map(child => {
73+
.map(child =>
74+
{
6775
const deviceModel = model.__global._shared?.[`~/api/${child.syntax.return.type.uid}.yml`];
6876
const subProperties = sortPropertiesData(extractPropertiesData(deviceModel, model.__global._shared));
6977
return {
@@ -73,7 +81,8 @@ function extractConstituentOperatorsData(model) {
7381
'hasSubProperties': subProperties === undefined || subProperties.length === 0 ? false : true,
7482
'subProperties': subProperties,
7583
};
76-
});
84+
}
85+
);
7786
}
7887

7988
function extractOperatorData(model) {

0 commit comments

Comments
 (0)