Skip to content

Commit

Permalink
Merge pull request #125 from open-ephys/issue-76
Browse files Browse the repository at this point in the history
Filter out properties w/ [Browsable(false)] attribute
  • Loading branch information
cjsha authored Oct 31, 2024
2 parents 409a498 + dac44a8 commit 138d2b0
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions template/ManagedReference.extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function processChildProperty(child, sharedModel) {
return {
'name': child.name[0].value,
'type': child.syntax.return.type.specName[0].value,
'propertyDescription': {
'propertyDescription':
{
'text': addCodeTag([child.summary, child.remarks].join('')),
'hasEnum': enumFields.length > 0,
'enum': enumFields,
Expand All @@ -43,27 +44,34 @@ function processChildProperty(child, sharedModel) {
}
}

const filterProperties = propertyCandidate => propertyCandidate.type === 'property' && !propertyCandidate?.attributes.some(attribute =>
attribute.type === 'System.ComponentModel.BrowsableAttribute' && attribute.arguments[0].value === false);

function extractPropertiesData(model, sharedModel) {
return model?.children
.filter(child => child.type === 'property' && child.syntax)
.filter(filterProperties)
.map(child => processChildProperty(child, sharedModel));
}

function extractPropertiesFromInheritedMembersData(model, sharedModel) {
return model.inheritedMembers
.filter(inheritedMember => inheritedMember.type === 'property')
.map(inheritedMember => (
processChildProperty(
.filter(filterProperties)
.map(inheritedMember =>
(
processChildProperty
(
sharedModel[`~/api/${inheritedMember.parent}.yml`].children.find(inheritedMemberChild => inheritedMemberChild.uid === inheritedMember.uid),
sharedModel
)
));
)
);
}

function extractConstituentOperatorsData(model) {
return model?.children
.filter(child => child.type === 'property' && model.__global._shared?.[`~/api/${child.syntax.return.type.uid}.yml`].type === 'class')
.map(child => {
.map(child =>
{
const deviceModel = model.__global._shared?.[`~/api/${child.syntax.return.type.uid}.yml`];
const subProperties = sortPropertiesData(extractPropertiesData(deviceModel, model.__global._shared));
return {
Expand All @@ -73,7 +81,8 @@ function extractConstituentOperatorsData(model) {
'hasSubProperties': subProperties === undefined || subProperties.length === 0 ? false : true,
'subProperties': subProperties,
};
});
}
);
}

function extractOperatorData(model) {
Expand Down

0 comments on commit 138d2b0

Please sign in to comment.