@sap-ux/annotation-converter
Advanced tools
Comparing version 0.5.10 to 0.5.11
# @sap-ux/annotation-converter | ||
## 0.5.11 | ||
### Patch Changes | ||
- a5b4df9: Make sure annotations object is defined like the type says | ||
## 0.5.10 | ||
@@ -4,0 +10,0 @@ |
@@ -170,2 +170,5 @@ "use strict"; | ||
} | ||
if (pathPart === '$' && currentValue._type === 'EntitySet') { | ||
return currentValue; | ||
} | ||
if ((pathPart === '@$ui5.overload' || pathPart === '0') && currentValue._type === 'Action') { | ||
@@ -200,2 +203,6 @@ return currentValue; | ||
} | ||
else if (currentValue._type === 'EntitySet' && pathPart === '$NavigationPropertyBinding') { | ||
currentValue = currentValue.navigationPropertyBinding; | ||
return currentValue; | ||
} | ||
else if (currentValue._type === 'EntitySet' && currentValue.entityType) { | ||
@@ -464,3 +471,4 @@ currentPath = combinePath(currentValue.entityTypeName, pathPart); | ||
$Type: targetType, | ||
fullyQualifiedName: currentFQN | ||
fullyQualifiedName: currentFQN, | ||
annotations: {} | ||
}; | ||
@@ -865,3 +873,7 @@ const annotationContent = {}; | ||
if (resolveDirectly) { | ||
const targetResolution = _resolveTarget(objectMap, convertedOutput, '/' + sPath, false, true); | ||
let targetPath = sPath; | ||
if (!sPath.startsWith('/')) { | ||
targetPath = `/${sPath}`; | ||
} | ||
const targetResolution = _resolveTarget(objectMap, convertedOutput, targetPath, false, true); | ||
if (targetResolution.target) { | ||
@@ -943,2 +955,6 @@ targetResolution.visitedObjects.push(targetResolution.target); | ||
} | ||
if (typeof currentTarget.annotations[vocAlias][vocTermWithQualifier] === 'object' && | ||
!currentTarget.annotations[vocAlias][vocTermWithQualifier].annotations) { | ||
currentTarget.annotations[vocAlias][vocTermWithQualifier].annotations = {}; | ||
} | ||
if (currentTarget.annotations[vocAlias][vocTermWithQualifier] !== null && | ||
@@ -945,0 +961,0 @@ typeof currentTarget.annotations[vocAlias][vocTermWithQualifier] === 'object') { |
@@ -197,3 +197,3 @@ "use strict"; | ||
} | ||
else if (collectionKey === 'annotations') { | ||
else if (collectionKey === 'annotations' && Object.keys(collectionItem[collectionKey]).length > 0) { | ||
outItem.annotations = []; | ||
@@ -239,3 +239,3 @@ revertAnnotationsToRawType(references, collectionItem[collectionKey], outItem.annotations); | ||
// Collection | ||
if (annotation.hasOwnProperty('annotations')) { | ||
if (annotation.hasOwnProperty('annotations') && Object.keys(annotation.annotations).length > 0) { | ||
// Annotation on a collection itself, not sure when that happens if at all | ||
@@ -242,0 +242,0 @@ baseAnnotation.annotations = []; |
{ | ||
"name": "@sap-ux/annotation-converter", | ||
"version": "0.5.10", | ||
"version": "0.5.11", | ||
"description": "SAP Fiori OData - Annotation converter", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -217,2 +217,5 @@ import type { | ||
} | ||
if (pathPart === '$' && currentValue._type === 'EntitySet') { | ||
return currentValue; | ||
} | ||
if ((pathPart === '@$ui5.overload' || pathPart === '0') && currentValue._type === 'Action') { | ||
@@ -245,2 +248,5 @@ return currentValue; | ||
return currentValue; | ||
} else if (currentValue._type === 'EntitySet' && pathPart === '$NavigationPropertyBinding') { | ||
currentValue = currentValue.navigationPropertyBinding; | ||
return currentValue; | ||
} else if (currentValue._type === 'EntitySet' && currentValue.entityType) { | ||
@@ -551,3 +557,4 @@ currentPath = combinePath(currentValue.entityTypeName, pathPart); | ||
$Type: targetType, | ||
fullyQualifiedName: currentFQN | ||
fullyQualifiedName: currentFQN, | ||
annotations: {} | ||
}; | ||
@@ -1074,3 +1081,7 @@ const annotationContent: any = {}; | ||
if (resolveDirectly) { | ||
const targetResolution: any = _resolveTarget(objectMap, convertedOutput, '/' + sPath, false, true); | ||
let targetPath = sPath; | ||
if (!sPath.startsWith('/')) { | ||
targetPath = `/${sPath}`; | ||
} | ||
const targetResolution: any = _resolveTarget(objectMap, convertedOutput, targetPath, false, true); | ||
if (targetResolution.target) { | ||
@@ -1158,2 +1169,3 @@ targetResolution.visitedObjects.push(targetResolution.target); | ||
); | ||
switch (typeof currentTarget.annotations[vocAlias][vocTermWithQualifier]) { | ||
@@ -1177,2 +1189,8 @@ case 'string': | ||
if ( | ||
typeof currentTarget.annotations[vocAlias][vocTermWithQualifier] === 'object' && | ||
!currentTarget.annotations[vocAlias][vocTermWithQualifier].annotations | ||
) { | ||
currentTarget.annotations[vocAlias][vocTermWithQualifier].annotations = {}; | ||
} | ||
if ( | ||
currentTarget.annotations[vocAlias][vocTermWithQualifier] !== null && | ||
@@ -1179,0 +1197,0 @@ typeof currentTarget.annotations[vocAlias][vocTermWithQualifier] === 'object' |
@@ -210,3 +210,3 @@ import type { | ||
}); | ||
} else if (collectionKey === 'annotations') { | ||
} else if (collectionKey === 'annotations' && Object.keys(collectionItem[collectionKey]).length > 0) { | ||
outItem.annotations = []; | ||
@@ -250,3 +250,3 @@ revertAnnotationsToRawType(references, collectionItem[collectionKey], outItem.annotations); | ||
// Collection | ||
if (annotation.hasOwnProperty('annotations')) { | ||
if (annotation.hasOwnProperty('annotations') && Object.keys((annotation as any).annotations).length > 0) { | ||
// Annotation on a collection itself, not sure when that happens if at all | ||
@@ -253,0 +253,0 @@ baseAnnotation.annotations = []; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
275718
4127