Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).

### Added
### Changed
- Removed special characters from placeholders for fields like short text, description, etc.
### Deprecated
### Removed
### Fixed
Expand Down
10 changes: 5 additions & 5 deletions lib/compile/csdl2openapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
* @param {{ url?: string, servers?: object, odataVersion?: string, scheme?: string, host?: string, basePath?: string, diagram?: boolean, maxLevels?: number }} options Optional parameters
* @return {object} OpenAPI description
*/
module.exports.csdl2openapi = function (

Check warning on line 93 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / lint

Function has a complexity of 20. Maximum allowed is 15

Check warning on line 93 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Function has a complexity of 20. Maximum allowed is 15
csdl,
{
url: serviceRoot,
Expand All @@ -104,10 +104,10 @@
} = {}
) {
// as preProcess below mutates the csdl, copy it before, to avoid side-effects on the caller side
csdl = JSON.parse(JSON.stringify(csdl))

Check warning on line 107 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / lint

Assignment to function parameter 'csdl'

Check warning on line 107 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Assignment to function parameter 'csdl'
csdl.$Version = odataVersion ? odataVersion : '4.01'
const meta = new CSDLMeta(csdl)
serviceRoot = serviceRoot ?? (`${scheme}://${host}${basePath}`);

Check warning on line 110 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / lint

Assignment to function parameter 'serviceRoot'

Check warning on line 110 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Assignment to function parameter 'serviceRoot'
const queryOptionPrefix = csdl.$Version <= '4.01' ? '$' : '';
const typesToInline = {}; // filled in schema() and used in inlineTypes()

Expand All @@ -120,8 +120,8 @@
Object.keys(entityContainer).forEach(element => {
if (entityContainer[element].$Type) {
const fullTypeName = entityContainer[element].$Type;
const type = fullTypeName.startsWith(serviceName + '.')
? fullTypeName.substring(serviceName.length + 1)
const type = fullTypeName.startsWith(serviceName + '.')

Check warning on line 123 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected string concatenation

Check warning on line 123 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Unexpected string concatenation
? fullTypeName.substring(serviceName.length + 1)
: nameParts(fullTypeName).name;
if ((csdl[serviceName]?.[type]?.['@cds.autoexpose'] || csdl[serviceName]?.[type]?.['@cds.autoexposed'])
&& (!entityContainer[type] || type.endsWith('_texts'))) {
Expand Down Expand Up @@ -288,15 +288,15 @@
description = containerSchema[meta.voc.Core.Description];
}
else {
description = "Use @Core.LongDescription: '...' or @Core.Description: '...' on your CDS service to provide a meaningful description.";
description = "Use the Core.LongDescription or Core.Description annotation on your CDS service to provide a meaningful description.";
}
description += (diagram ? new Diagram(meta).getResourceDiagram(entityContainer) : '');
let title;
if (entityContainer && entityContainer[meta.voc.Common.Label]) {
title = entityContainer[meta.voc.Common.Label];
}
else {
title = "Use @title: '...' on your CDS service to provide a meaningful title.";
title = "Use the title annotation on your CDS service to provide a meaningful title.";
}
return {
title,
Expand Down Expand Up @@ -338,7 +338,7 @@
shortText = containerSchema[meta.voc.Core.Description];
}
else {
shortText = "Use @Core.Description: '...' on your CDS service to provide a meaningful short text.";
shortText = "Use the Core.Description annotation on your CDS service to provide a meaningful short text.";
}
return shortText;
}
Expand Down Expand Up @@ -406,7 +406,7 @@
.replaceAll('_', ' ')
.replace(/([a-z])([A-Z])/g, '$1 $2'); // "camelCase" to "camel Case"
if (typeof tag === 'string') {
tag = normalise(tag);

Check warning on line 409 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / lint

Assignment to function parameter 'tag'

Check warning on line 409 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Assignment to function parameter 'tag'
} else {
tag.name = normalise(tag.name);
}
Expand Down Expand Up @@ -458,7 +458,7 @@
* @param {number} level Number of navigation segments so far
* @param {string} navigationPath Path for finding navigation restrictions
*/
function pathItems(paths, prefix, prefixParameters, element, root, sourceName, targetName, target, level, navigationPath) {

Check warning on line 461 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / lint

Function 'pathItems' has too many parameters (10). Maximum allowed is 4

Check warning on line 461 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Function 'pathItems' has too many parameters (10). Maximum allowed is 4
const name = prefix.substring(prefix.lastIndexOf('/') + 1);
const type = meta.modelElement(element.$Type);
const pathItem = {};
Expand Down Expand Up @@ -540,7 +540,7 @@
* @param {object} restrictions Navigation property restrictions of navigation segment
* @param {array} nonExpandable Non-expandable navigation properties
*/
function pathItemsWithKey(paths, prefix, prefixParameters, element, root, sourceName, targetName, target, level, navigationPath, restrictions, nonExpandable) {

Check warning on line 543 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / lint

Function 'pathItemsWithKey' has too many parameters (12). Maximum allowed is 4

Check warning on line 543 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Function 'pathItemsWithKey' has too many parameters (12). Maximum allowed is 4
const targetIndexable = target == null || target[meta.voc.Capabilities.IndexableByKey] != false;
if (restrictions.IndexableByKey == true || restrictions.IndexableByKey != false && targetIndexable) {
const name = prefix.substring(prefix.lastIndexOf('/') + 1);
Expand Down Expand Up @@ -577,7 +577,7 @@
* @param {number} level Number of navigation segments so far
* @param {object} restrictions Navigation property restrictions of navigation segment
*/
function operationCreate(pathItem, element, name, sourceName, targetName, target, level, restrictions) {

Check warning on line 580 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / lint

Function 'operationCreate' has too many parameters (8). Maximum allowed is 4

Check warning on line 580 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Function 'operationCreate' has too many parameters (8). Maximum allowed is 4
const insertRestrictions = restrictions.InsertRestrictions || target?.[meta.voc.Capabilities.InsertRestrictions] || {};
const countRestrictions = target?.[meta.voc.Capabilities.CountRestrictions]?.Countable === false // count property will be added if CountRestrictions is false
if (insertRestrictions.Insertable !== false) {
Expand Down Expand Up @@ -613,7 +613,7 @@
* @param {boolean} byKey Access by key
* @return Operation Text
*/
function operationSummary(operation, name, sourceName, level, collection, byKey) {

Check warning on line 616 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / lint

Function 'operationSummary' has too many parameters (6). Maximum allowed is 4

Check warning on line 616 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Function 'operationSummary' has too many parameters (6). Maximum allowed is 4
const lname = splitName(name);
const sname = splitName(sourceName);

Expand All @@ -638,7 +638,7 @@
* @param {boolean} byKey Read by key
* @param {array} nonExpandable Non-expandable navigation properties
*/
function operationRead(pathItem, element, name, sourceName, targetName, target, level, restrictions, byKey, nonExpandable) {

Check warning on line 641 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / lint

Function 'operationRead' has too many parameters (10). Maximum allowed is 4

Check warning on line 641 in lib/compile/csdl2openapi.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Function 'operationRead' has too many parameters (10). Maximum allowed is 4
const targetRestrictions = target?.[meta.voc.Capabilities.ReadRestrictions];
const readRestrictions = restrictions.ReadRestrictions || targetRestrictions || {};
const readByKeyRestrictions = readRestrictions.ReadByKeyRestrictions;
Expand Down
Loading
Loading