Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
### Removed
### Fixed
- Entities that are transitively autoexposed and should still be considered readonly, do not generate documentation for write endpoints anymore
- OpenAPI compilation is now pure: the input CSN is no longer mutated during compilation
### Security

## [1.6.0] - 2026-08-04
Expand Down
1 change: 1 addition & 0 deletions lib/compile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function compileToOpenAPI(csn, options = {}) {
}

function processor(csn, options = {}) {
csn = cds.clone(csn);
const edmOptions = {
odataOpenapiHints: true, // hint to cds-compiler
edm4OpenAPI: true, // downgrades certain OData errors to warnings in cds-compiler
Expand Down
13 changes: 13 additions & 0 deletions test/lib/compile/openapi.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,19 @@ service CatalogService {
assert(!openapi.servers[0].url.includes('odata'));
});

test('does not mutate @protocol annotation after compilation', () => {
const csn = cds.compile.to.csn(`
namespace com.sap;
@protocol: ['odata', 'rest']
service A { entity E { key ID : UUID; }; }
`);
const originalProtocol = csn.definitions['com.sap.A']['@protocol'];
assert(Array.isArray(originalProtocol), '@protocol should be an array before compilation');
toOpenApi(csn);
assert(Array.isArray(csn.definitions['com.sap.A']['@protocol']),
'@protocol must not be mutated by toOpenApi');
});

test('options: Multiple servers', () => {
const csn = cds.compile.to.csn(`
service A {entity E { key ID : UUID; };};`
Expand Down
Loading