@@ -947,12 +947,19 @@ async function processString(db, filePath, packageId, data) {
947947 * @param {* } dataType
948948 * @returns An Object
949949 */
950- function prepareEnumsOrBitmaps ( a , dataType ) {
950+ function prepareEnumsOrBitmaps ( a , dataTypeRef , dataType ) {
951+ if ( a . type . toLowerCase ( ) . includes ( 'uint' ) ) {
952+ let correctedType = dataType == dbEnum . zclType . enum ? 'enum' : 'map'
953+ env . logWarning (
954+ `Warning: ${ a . name } is declared incorrectly as ${ a . type } in XML. Replace ${ a . type } with ${ correctedType } type.`
955+ )
956+ a . type = a . type . toLowerCase ( ) . replace ( 'uint' , correctedType )
957+ }
951958 return {
952959 name : a . name ,
953960 type : a . type . toLowerCase ( ) ,
954961 cluster_code : a . cluster ? a . cluster : null ,
955- discriminator_ref : dataType
962+ discriminator_ref : dataTypeRef
956963 }
957964}
958965
@@ -971,7 +978,13 @@ async function processEnums(db, filePath, packageId, data) {
971978 return queryLoader . insertEnum (
972979 db ,
973980 [ packageId ] ,
974- data . map ( ( x ) => prepareEnumsOrBitmaps ( x , typeMap . get ( dbEnum . zclType . enum ) ) )
981+ data . map ( ( x ) =>
982+ prepareEnumsOrBitmaps (
983+ x ,
984+ typeMap . get ( dbEnum . zclType . enum ) ,
985+ dbEnum . zclType . enum
986+ )
987+ )
975988 )
976989}
977990
@@ -1024,7 +1037,11 @@ async function processBitmaps(db, filePath, packageId, data) {
10241037 db ,
10251038 [ packageId ] ,
10261039 data . map ( ( x ) =>
1027- prepareEnumsOrBitmaps ( x , typeMap . get ( dbEnum . zclType . bitmap ) )
1040+ prepareEnumsOrBitmaps (
1041+ x ,
1042+ typeMap . get ( dbEnum . zclType . bitmap ) ,
1043+ dbEnum . zclType . bitmap
1044+ )
10281045 )
10291046 )
10301047}
0 commit comments