Skip to content

Commit

Permalink
add TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
aramovic79 committed Sep 18, 2024
1 parent e9d6538 commit a95bf81
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ord.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ const fInitializeGlobal = (csn) => {
const aEvents = [];
const aServices = [];
const aODMEntity = [];

const capNamespace = csn.namespace;
// namespace variable value if present in cdsrc.json take it there or else from package.json
//if cdsrc.json does not have applicationNamespace, then use just the namespace
const namespace = cds.env["ord"]?.namespace || packageName.replace(/[^\w/]/g, "").replace(/\//, ".");
const applicationNamespace = cds.env?.export?.asyncapi?.applicationNamespace;

if (applicationNamespace && fGetNamespaceComponents(namespace) !== fGetNamespaceComponents(applicationNamespace)) {
console.warn('ORD and AsyncAPI namespaces should be the same.');
}
Expand Down Expand Up @@ -105,7 +105,7 @@ const fGetProducts = (global) => global.env?.products || defaults.products(globa
/**
* Retrieves the groups that services belongs to.
* Gets list of groups from CDS runtime object.
* @param {Object} csn object
* @param {Object} csn object
* @returns {Array<object>} The groups array.
*/
const fGetGroups = (csn, global) => {
Expand All @@ -116,7 +116,7 @@ const fGetGroups = (csn, global) => {

/**
* Retrieves the packages.
* Hierarchy to check data: cdsrc.json > defaults
* Hierarchy to check data: cdsrc.json > defaults. TODO: Check if this is still valid.
* @returns {Array<object>} The packages array.
*/
const fGetPackages = (policyLevel,global) => global.env?.packages || (global.aEvents.length) ? defaults.packages(global.namespace,policyLevel,global.capNamespace) : defaults.packages(global.namespace,policyLevel,global.capNamespace).slice(0, 1)
Expand Down

0 comments on commit a95bf81

Please sign in to comment.