Skip to content

Commit

Permalink
Merge pull request #26 from cap-js/updateDefaultNamespace
Browse files Browse the repository at this point in the history
Default applicationNamespace: update regex ( wrt ORD)
  • Loading branch information
RoshniNaveenaS authored Jul 15, 2024
2 parents a2cd748 + 8af7079 commit b9adc2f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
The format is based on [Keep a Changelog](http://keepachangelog.com/).

## Version 1.0.2 tbd

### Changed

- Changed default namespace regex making it compatible with ORD.

## Version 1.0.2

### Changed
Expand Down
2 changes: 1 addition & 1 deletion lib/compile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function processor(csn, options = {}) {
}
if (!cds.env?.export?.asyncapi?.application_namespace) {
const packageJson = require(join(cds.root,'package.json'));
const appName = packageJson.name.replace(/\s/g, "-");
const appName = packageJson.name.replace(/^[@]/, "").replace(/[@/]/g, "-");
envConf["application_namespace"] = `customer.${appName}`
console.info(messages.APPLICATION_NAMESPACE);
}
Expand Down
2 changes: 1 addition & 1 deletion test/lib/compile/asyncapiMetadata.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ describe('asyncapi export: presets and annotations', () => {
cds.env.export.asyncapi = {};
const csn = cds.compile.to.csn(inputCDS);
const generatedAsyncAPI = toAsyncAPI(csn);
expect(generatedAsyncAPI).toHaveProperty('x-sap-application-namespace','customer.@cap-js/asyncapi')
expect(generatedAsyncAPI).toHaveProperty('x-sap-application-namespace','customer.cap-js-asyncapi')
});
});

0 comments on commit b9adc2f

Please sign in to comment.