@@ -156,9 +156,10 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
156156 * UI5Types: ["sap.ui.core.Control"] // skip template if its value is "${0}" (default value)
157157 * }
158158 * @param {string } sComplexType
159+ * @param {Object<string,object> } oAllDependentAPIs Map of entity names to their symbol
159160 * @returns {{template=: string, UI5Types=: string[]} }
160161 */
161- function parseUI5Types ( sComplexType ) {
162+ function parseUI5Types ( sComplexType , oAllDependentAPIs ) {
162163 let oParsed ;
163164 try {
164165 oParsed = typeParser . parseSimpleTypes ( sComplexType , isUI5Type ) ;
@@ -176,6 +177,14 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
176177
177178 if ( oParsed . simpleTypes ?. length ) { // it can be empty if none of the included simple types satisfied the filter function
178179 result . UI5Types = oParsed . simpleTypes ;
180+
181+ // check whether the type refers to a typedef and set a marker
182+ if ( result . template == null && result . UI5Types . length === 1 ) {
183+ const symbol = oAllDependentAPIs [ result . UI5Types [ 0 ] ] ;
184+ if ( symbol ?. kind === "typedef" && Array . isArray ( symbol . properties ) ) {
185+ result . refersToTypedef = true ;
186+ }
187+ }
179188 }
180189
181190 return result ;
@@ -266,6 +275,8 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
266275 * @param {object } oChainObject chain object
267276 */
268277 const transformApiJson = function ( oChainObject ) {
278+ const { oAllDependentAPIs} = oChainObject ;
279+
269280 // Function is a copy from: LibraryInfo.js => LibraryInfo.prototype._getActualComponent => "match" inline method
270281 function matchComponent ( sModuleName , sPattern ) {
271282 sModuleName = sModuleName . toLowerCase ( ) ;
@@ -435,7 +446,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
435446 // Types
436447 oParameter . types = [ ] ;
437448 if ( oParameter . type ) {
438- oParameter . typeInfo = parseUI5Types ( oParameter . type ) ;
449+ oParameter . typeInfo = parseUI5Types ( oParameter . type , oAllDependentAPIs ) ;
439450 // Keep file size in check
440451 delete oParameter . type ;
441452 }
@@ -520,7 +531,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
520531 // Type
521532 if ( oSymbol . kind !== "enum" ) { // enum properties don't have an own type
522533 if ( oProperty . type ) {
523- oProperty . typeInfo = parseUI5Types ( oProperty . type ) ;
534+ oProperty . typeInfo = parseUI5Types ( oProperty . type , oAllDependentAPIs ) ;
524535 // Keep file size in check
525536 delete oProperty . type ;
526537 }
@@ -560,7 +571,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
560571
561572 // Type
562573 if ( oProperty . type ) {
563- oProperty . typeInfo = parseUI5Types ( oProperty . type ) ;
574+ oProperty . typeInfo = parseUI5Types ( oProperty . type , oAllDependentAPIs ) ;
564575 // Keep file size in check
565576 delete oProperty . type ;
566577 }
@@ -687,7 +698,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
687698
688699 // Link Enabled
689700 if ( oSetting . type ) {
690- oSetting . typeInfo = parseUI5Types ( oSetting . type ) ;
701+ oSetting . typeInfo = parseUI5Types ( oSetting . type , oAllDependentAPIs ) ;
691702 delete oSetting . type ; // Keep file size in check
692703 }
693704
@@ -756,7 +767,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
756767 oEvent . parameters . forEach ( ( oParameter ) => {
757768
758769 if ( oParameter . type ) {
759- oParameter . typeInfo = parseUI5Types ( oParameter . type ) ;
770+ oParameter . typeInfo = parseUI5Types ( oParameter . type , oAllDependentAPIs ) ;
760771 delete oParameter . type ; // Keep file size in check
761772 }
762773
@@ -789,7 +800,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
789800 if ( oSymbol . methods ) {
790801
791802 // Pre-process methods
792- methods . buildMethodsModel ( oSymbol . methods ) ;
803+ methods . buildMethodsModel ( oSymbol . methods , oAllDependentAPIs ) ;
793804
794805 oSymbol . methods . forEach ( ( oMethod ) => {
795806
@@ -950,6 +961,14 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
950961 }
951962
952963 function loadDependencyLibraryFiles ( oChainObject ) {
964+ const oAllDependentAPIs = oChainObject . oAllDependentAPIs = Object . create ( null ) ;
965+ // add symbols from current library
966+ if ( oChainObject . fileData . symbols ) {
967+ for ( const oSymbol of oChainObject . fileData . symbols ) {
968+ oAllDependentAPIs [ oSymbol . name ] = oSymbol ;
969+ }
970+ }
971+
953972 if ( ! oChainObject . aDependentLibraryFiles ) {
954973 return oChainObject ;
955974 }
@@ -978,6 +997,12 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
978997 // In this case we don't add it to the dependency list to skip double iteration.
979998 if ( oData && oChainObject . fileData . library !== oData . library ) {
980999 oDependentAPIs [ oData . library ] = oData . symbols ;
1000+
1001+ if ( Array . isArray ( oData . symbols ) ) {
1002+ for ( const oSymbol of oData . symbols ) {
1003+ oAllDependentAPIs [ oSymbol . name ] = oSymbol ;
1004+ }
1005+ }
9811006 }
9821007 } ) ;
9831008
@@ -2196,7 +2221,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
21962221 * Adjusts methods info so that it can be easily displayed in a table
21972222 * @param aMethods - the methods array initially coming from the server
21982223 */
2199- buildMethodsModel : function ( aMethods ) {
2224+ buildMethodsModel : function ( aMethods , oAllDependentAPIs ) {
22002225 var fnExtractParameterProperties = function ( oParameter , aParameters , iDepth , aPhoneName ) {
22012226 if ( oParameter . parameterProperties ) {
22022227 Object . keys ( oParameter . parameterProperties ) . forEach ( function ( sProperty ) {
@@ -2206,7 +2231,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
22062231
22072232 // Handle types
22082233 if ( oProperty . type ) {
2209- oProperty . typeInfo = parseUI5Types ( oProperty . type ) ;
2234+ oProperty . typeInfo = parseUI5Types ( oProperty . type , oAllDependentAPIs ) ;
22102235 // Keep file size in check
22112236 delete oProperty . type ;
22122237 }
@@ -2238,7 +2263,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
22382263 if ( oMethod . parameters ) {
22392264 oMethod . parameters . forEach ( function ( oParameter ) {
22402265 if ( oParameter . type ) {
2241- oParameter . typeInfo = parseUI5Types ( oParameter . type ) ;
2266+ oParameter . typeInfo = parseUI5Types ( oParameter . type , oAllDependentAPIs ) ;
22422267 // Keep file size in check
22432268 delete oParameter . type ;
22442269 }
@@ -2259,7 +2284,7 @@ function transformer(sInputFile, sOutputFile, sLibraryFile, vDependencyAPIFiles,
22592284 // Handle return values
22602285 if ( oMethod . returnValue && oMethod . returnValue . type ) {
22612286 // Handle types
2262- oMethod . returnValue . typeInfo = parseUI5Types ( oMethod . returnValue . type ) ;
2287+ oMethod . returnValue . typeInfo = parseUI5Types ( oMethod . returnValue . type , oAllDependentAPIs ) ;
22632288 }
22642289
22652290 } ) ;
0 commit comments