diff --git a/lib/templates.js b/lib/templates.js index 9f8dee4..a244152 100644 --- a/lib/templates.js +++ b/lib/templates.js @@ -120,7 +120,8 @@ const createGroupsTemplateForService = (serviceName, serviceDefinition, appConfi /** * This is a template function to create API Resource object for API Resource Array. - * + * Properties of an API resource can be overwritten by the ORD extensions. Example: visibility. + * @param {string} serviceName The name of the service. * @param {object} serviceDefinition The definition of the service * @returns {Array} An array of objects for the API Resources. @@ -174,10 +175,9 @@ const createAPIResourceTemplate = (serviceName, serviceDefinition, appConfig, pa supported: "no", }, entityTypeMappings: [{ entityTypeTargets: appConfig.odmEntity }], - ...ordExtensions, }; - // visibility can also be set as an ORD extension; in this case, it overwrites the default visibility + if (obj.visibility === RESOURCE_VISIBILITY.public) apiResources.push(obj); }); @@ -187,6 +187,7 @@ const createAPIResourceTemplate = (serviceName, serviceDefinition, appConfig, pa /** * This is a template function to create Event Resource object for Event Resource Array. * There can be only one event resource per service because all events are using the same protocol, they are always Cloud Events. + * Properties of an event resource can be overwritten by the ORD extensions. Example: visibility. * * @param {string} serviceName The name of the service. * @param {object} serviceDefinition The definition of the service @@ -210,7 +211,7 @@ const createEventResourceTemplate = (serviceName, serviceDefinition, appConfig, releaseStatus: "active", partOfPackage: _getPackageID(appConfig.ordNamespace, packageIds, ORD_RESOURCE_TYPE.event), partOfGroups: [_getGroupID(serviceName, defaults.groupTypeId, appConfig)], - visibility: RESOURCE_VISIBILITY.public,//default value that can be overwritten by ORD extension + visibility: RESOURCE_VISIBILITY.public, resourceDefinitions: [ { type: "asyncapi-v2",