@sap/cds-compiler
Advanced tools
Comparing version 2.15.8 to 2.15.10
@@ -1190,2 +1190,17 @@ // Populate views with elements, elements with association targets, ... | ||
}; | ||
// forward target parameters to projection | ||
if (target.params) { | ||
art.params = Object.create(null); | ||
// is art.query.from.path[0].$syntax: ':' required? | ||
art.query.from.path[0].args = Object.create(null); | ||
forEachGeneric(target, 'params', (p, pn) => { | ||
art.params[pn] = linkToOrigin(p, pn, art, 'params', p.location); | ||
art.query.from.path[0].args[pn] = { | ||
name: { id: p.name.id, location: p.location }, | ||
location: p.location, | ||
scope: 'param', | ||
path: [ { id: pn, location: p.location } ], | ||
}; | ||
}); | ||
} | ||
// TODO: do we need to tag the generated entity with elemScope = 'auto'? | ||
@@ -1192,0 +1207,0 @@ if (autoexposed) { |
@@ -1147,24 +1147,26 @@ 'use strict'; | ||
// explicitly mentioned type, render in XML and JSON | ||
newRecord.setEdmAttribute('Type', actualTypeName); | ||
newRecord.setXml({ 'Type': actualTypeName}); | ||
// unknown dictionary type: can't fully qualify it | ||
newRecord.setJSON({ 'Type': actualTypeName}); | ||
} | ||
else if (dTypeName && !isDerivedFrom(actualTypeName, dTypeName)) { | ||
// this type doesn't fit the expected one | ||
message(warning, context, `explicitly specified type '${ actualTypeName | ||
}' is not derived from expected type '${ dTypeName }'`); | ||
actualTypeName = dTypeName; | ||
// explicitly mentioned type, render in XML and JSON | ||
newRecord.setEdmAttribute('Type', actualTypeName); | ||
} | ||
else if (isAbstractType(actualTypeName)) { | ||
// this type is abstract | ||
message(warning, context, `explicitly specified type '${ actualTypeName }' is abstract, specify a concrete type`); | ||
if(dTypeName) | ||
else { | ||
if (isAbstractType(actualTypeName)) { | ||
// this type is abstract | ||
message(warning, context, `explicitly specified type '${ actualTypeName }' is abstract, specify a concrete type`); | ||
if(dTypeName) | ||
actualTypeName = dTypeName; | ||
} | ||
else if (dTypeName && !isDerivedFrom(actualTypeName, dTypeName)) { | ||
// this type doesn't fit the expected one | ||
message(warning, context, `explicitly specified type '${ actualTypeName | ||
}' is not derived from expected type '${ dTypeName }'`); | ||
actualTypeName = dTypeName; | ||
// set to definition name and render in XML and JSON | ||
newRecord.setEdmAttribute('Type', actualTypeName); | ||
} | ||
else { | ||
// ok | ||
} | ||
// Dictionary Type, render in XML only for backward compatibility | ||
newRecord.setXml( { Type: actualTypeName }); | ||
const vocName = actualTypeName.slice(0, actualTypeName.indexOf('.')); | ||
const vocDef = vocabularyDefinitions[vocName]; | ||
// Set full qualified type in JSON | ||
if(vocDef) | ||
newRecord.setJSON( { 'Type': `${vocDef.ref.Uri}#${actualTypeName}` }); | ||
} | ||
@@ -1327,3 +1329,7 @@ } | ||
if(k === '@type') { | ||
edmNode.setEdmAttribute('Type', val); | ||
edmNode.setJSON({ 'Type': val}); | ||
// try to shorten full qualified type URI to short type name | ||
const parts = val.split('#'); | ||
const shortTypeName = parts[parts.length-1]; | ||
edmNode.setXml({ Type: shortTypeName }); | ||
} | ||
@@ -1330,0 +1336,0 @@ else { |
@@ -1354,4 +1354,4 @@ 'use strict' | ||
{ | ||
if(this._edmAttributes.Type) | ||
json['@type'] = this._edmAttributes.Type; | ||
if(this._jsonOnlyAttributes.Type) | ||
json['@type'] = this._jsonOnlyAttributes.Type; | ||
let keys = Object.keys(this._edmAttributes).filter(k => k !== 'Type'); | ||
@@ -1358,0 +1358,0 @@ for(const key of keys) |
{ | ||
"name": "@sap/cds-compiler", | ||
"version": "2.15.8", | ||
"version": "2.15.10", | ||
"description": "CDS (Core Data Services) compiler and backends", | ||
@@ -5,0 +5,0 @@ "homepage": "https://cap.cloud.sap/", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4053289
80109