Skip to content

Commit

Permalink
minor change: address review comment #82 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
aramovic79 committed Nov 8, 2024
1 parent 8d9bf18 commit 6cdf905
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
});

Expand All @@ -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
Expand All @@ -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",
Expand Down

0 comments on commit 6cdf905

Please sign in to comment.