[Scenes] Removal of Optional for AttributeId (#27509)

* Removed the optionnal quality from the AttributeId in scene xml and refactored tests and clusters to work with the changes

* Update src/app/tests/TestSceneTable.cpp

Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>

---------

Co-authored-by: Andrei Litvin <andy314@gmail.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
index 1501b06..270a462 100644
--- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
+++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter
@@ -159,7 +159,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter
index 38e86b0..8e5945a 100644
--- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter
+++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter
@@ -153,7 +153,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter
index 394f1f2..0ac49ca 100644
--- a/examples/light-switch-app/light-switch-common/light-switch-app.matter
+++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter
@@ -207,7 +207,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter
index 533dba2..febaa91 100644
--- a/examples/lighting-app/lighting-common/lighting-app.matter
+++ b/examples/lighting-app/lighting-common/lighting-app.matter
@@ -159,7 +159,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter
index c872fe0..c26354f 100644
--- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter
+++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter
@@ -159,7 +159,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter
index 0855b1e..59752a7 100644
--- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter
+++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.matter
@@ -159,7 +159,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter
index 914da72..44beb24 100644
--- a/examples/placeholder/linux/apps/app1/config.matter
+++ b/examples/placeholder/linux/apps/app1/config.matter
@@ -207,7 +207,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter
index 628f032..2ec302c 100644
--- a/examples/placeholder/linux/apps/app2/config.matter
+++ b/examples/placeholder/linux/apps/app2/config.matter
@@ -207,7 +207,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/examples/thermostat/thermostat-common/thermostat.matter b/examples/thermostat/thermostat-common/thermostat.matter
index 11cd0f2..4a98c60 100644
--- a/examples/thermostat/thermostat-common/thermostat.matter
+++ b/examples/thermostat/thermostat-common/thermostat.matter
@@ -207,7 +207,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/examples/window-app/common/window-app.matter b/examples/window-app/common/window-app.matter
index 1b55588..cf59146 100644
--- a/examples/window-app/common/window-app.matter
+++ b/examples/window-app/common/window-app.matter
@@ -159,7 +159,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp
index bfda035..8bfbbed 100644
--- a/src/app/clusters/on-off-server/on-off-server.cpp
+++ b/src/app/clusters/on-off-server/on-off-server.cpp
@@ -199,7 +199,7 @@
 
         AttributeValuePair pairs[scenableAttributeCount];
 
-        pairs[0].attributeID.SetValue(Attributes::OnOff::Id);
+        pairs[0].attributeID    = Attributes::OnOff::Id;
         pairs[0].attributeValue = currentValue;
 
         app::DataModel::List<AttributeValuePair> attributeValueList(pairs);
@@ -230,11 +230,7 @@
         while (pair_iterator.Next())
         {
             auto & decodePair = pair_iterator.GetValue();
-            if (decodePair.attributeID.HasValue())
-            {
-                // If attribute ID was encoded, verify it is the proper ID for the OnOff attribute
-                VerifyOrReturnError(decodePair.attributeID.Value() == Attributes::OnOff::Id, CHIP_ERROR_INVALID_ARGUMENT);
-            }
+            VerifyOrReturnError(decodePair.attributeID == Attributes::OnOff::Id, CHIP_ERROR_INVALID_ARGUMENT);
             ReturnErrorOnFailure(
                 mSceneEndpointStatePairs.InsertPair(EndpointStatePair(endpoint, static_cast<bool>(decodePair.attributeValue))));
         }
@@ -545,7 +541,7 @@
 
 #ifdef EMBER_AF_PLUGIN_SCENES
         // Registers Scene handlers for the On/Off cluster on the server
-        // app::Clusters::Scenes::ScenesServer::Instance().RegisterSceneHandler(OnOffServer::Instance().GetSceneHandler());
+        app::Clusters::Scenes::ScenesServer::Instance().RegisterSceneHandler(OnOffServer::Instance().GetSceneHandler());
 #endif
 
 #ifdef EMBER_AF_PLUGIN_MODE_SELECT
diff --git a/src/app/tests/TestSceneTable.cpp b/src/app/tests/TestSceneTable.cpp
index f9c65ad..cba0ebe 100644
--- a/src/app/tests/TestSceneTable.cpp
+++ b/src/app/tests/TestSceneTable.cpp
@@ -494,29 +494,29 @@
     static const uint16_t LC_av_payload[2] = { 0x64, 0x01F0 };
     static const uint16_t CC_av_payload[8] = { 0 };
 
-    OOPairs[0].attributeID.SetValue(kOnOffAttId);
+    OOPairs[0].attributeID    = kOnOffAttId;
     OOPairs[0].attributeValue = OO_av_payload;
 
-    LCPairs[0].attributeID.SetValue(kCurrentLevelId);
+    LCPairs[0].attributeID    = kCurrentLevelId;
     LCPairs[0].attributeValue = LC_av_payload[0];
-    LCPairs[1].attributeID.SetValue(kCurrentFrequencyId);
+    LCPairs[1].attributeID    = kCurrentFrequencyId;
     LCPairs[1].attributeValue = LC_av_payload[1];
 
-    CCPairs[0].attributeID.SetValue(kCurrentSaturationId);
+    CCPairs[0].attributeID    = kCurrentSaturationId;
     CCPairs[0].attributeValue = CC_av_payload[0];
-    CCPairs[1].attributeID.SetValue(kCurrentXId);
+    CCPairs[1].attributeID    = kCurrentXId;
     CCPairs[1].attributeValue = CC_av_payload[1];
-    CCPairs[2].attributeID.SetValue(kCurrentYId);
+    CCPairs[2].attributeID    = kCurrentYId;
     CCPairs[2].attributeValue = CC_av_payload[2];
-    CCPairs[3].attributeID.SetValue(kColorTemperatureMiredsId);
+    CCPairs[3].attributeID    = kColorTemperatureMiredsId;
     CCPairs[3].attributeValue = CC_av_payload[3];
-    CCPairs[4].attributeID.SetValue(kEnhancedCurrentHueId);
+    CCPairs[4].attributeID    = kEnhancedCurrentHueId;
     CCPairs[4].attributeValue = CC_av_payload[4];
-    CCPairs[5].attributeID.SetValue(kColorLoopActiveId);
+    CCPairs[5].attributeID    = kColorLoopActiveId;
     CCPairs[5].attributeValue = CC_av_payload[5];
-    CCPairs[6].attributeID.SetValue(kColorLoopDirectionId);
+    CCPairs[6].attributeID    = kColorLoopDirectionId;
     CCPairs[6].attributeValue = CC_av_payload[6];
-    CCPairs[7].attributeID.SetValue(kColorLoopTimeId);
+    CCPairs[7].attributeID    = kColorLoopTimeId;
     CCPairs[7].attributeValue = CC_av_payload[7];
 
     // Initialize Extension Field sets as if they were received by add commands
@@ -637,7 +637,6 @@
     app::Clusters::Scenes::Structs::AttributeValuePair::Type TooManyPairs[16];
 
     uint8_t payloadOk = 0;
-
     for (uint8_t i = 0; i < 16; i++)
     {
         TooManyPairs[i].attributeValue = payloadOk;
@@ -646,7 +645,8 @@
     extensionFieldFailTestOut.clusterID          = kColorControlClusterId;
     extensionFieldFailTestOut.attributeValueList = TooManyPairs;
 
-    uint8_t failBuffer[scenes::kMaxFieldBytesPerCluster] = { 0 };
+    // Give a bigger buffer given we are using too many pairs on purpose
+    uint8_t failBuffer[2 * scenes::kMaxFieldBytesPerCluster] = { 0 };
     ByteSpan fail_list(failBuffer);
 
     // Serialize Extension Field sets as if they were recovered from memory
diff --git a/src/app/zap-templates/zcl/data-model/chip/scene.xml b/src/app/zap-templates/zcl/data-model/chip/scene.xml
index 02a9c65..313d921 100644
--- a/src/app/zap-templates/zcl/data-model/chip/scene.xml
+++ b/src/app/zap-templates/zcl/data-model/chip/scene.xml
@@ -22,7 +22,7 @@
 
   <struct name="AttributeValuePair">
     <cluster code="0x0005"/>
-    <item name="AttributeID" type="attrib_id" optional="true"/>
+    <item name="AttributeID" type="attrib_id" optional="false"/>
     <item name="AttributeValue" type="INT32U" optional="false"/>
   </struct>
 
diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter
index 6e95ea7..5ba4400 100644
--- a/src/controller/data_model/controller-clusters.matter
+++ b/src/controller/data_model/controller-clusters.matter
@@ -167,7 +167,7 @@
   }
 
   struct AttributeValuePair {
-    optional attrib_id attributeID = 0;
+    attrib_id attributeID = 0;
     int32u attributeValue = 1;
   }
 
diff --git a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp
index 0abae72..0a3e7d4 100644
--- a/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp
+++ b/src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp
@@ -504,22 +504,11 @@
                 auto & entry_3 = iter_newElement_1_attributeValueList_3.GetValue();
                 jobject newElement_3;
                 jobject newElement_3_attributeID;
-                if (!entry_3.attributeID.HasValue())
-                {
-                    chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_attributeID);
-                }
-                else
-                {
-                    jobject newElement_3_attributeIDInsideOptional;
-                    std::string newElement_3_attributeIDInsideOptionalClassName     = "java/lang/Long";
-                    std::string newElement_3_attributeIDInsideOptionalCtorSignature = "(J)V";
-                    chip::JniReferences::GetInstance().CreateBoxedObject<uint32_t>(
-                        newElement_3_attributeIDInsideOptionalClassName.c_str(),
-                        newElement_3_attributeIDInsideOptionalCtorSignature.c_str(), entry_3.attributeID.Value(),
-                        newElement_3_attributeIDInsideOptional);
-                    chip::JniReferences::GetInstance().CreateOptional(newElement_3_attributeIDInsideOptional,
-                                                                      newElement_3_attributeID);
-                }
+                std::string newElement_3_attributeIDClassName     = "java/lang/Long";
+                std::string newElement_3_attributeIDCtorSignature = "(J)V";
+                chip::JniReferences::GetInstance().CreateBoxedObject<uint32_t>(newElement_3_attributeIDClassName.c_str(),
+                                                                               newElement_3_attributeIDCtorSignature.c_str(),
+                                                                               entry_3.attributeID, newElement_3_attributeID);
                 jobject newElement_3_attributeValue;
                 std::string newElement_3_attributeValueClassName     = "java/lang/Long";
                 std::string newElement_3_attributeValueCtorSignature = "(J)V";
@@ -536,7 +525,7 @@
                     return;
                 }
                 jmethodID attributeValuePairStructCtor_4 =
-                    env->GetMethodID(attributeValuePairStructClass_4, "<init>", "(Ljava/util/Optional;Ljava/lang/Long;)V");
+                    env->GetMethodID(attributeValuePairStructClass_4, "<init>", "(Ljava/lang/Long;Ljava/lang/Long;)V");
                 if (attributeValuePairStructCtor_4 == nullptr)
                 {
                     ChipLogError(Zcl, "Could not find ChipStructs$ScenesClusterAttributeValuePair constructor");
@@ -1078,22 +1067,11 @@
                 auto & entry_3 = iter_newElement_1_attributeValueList_3.GetValue();
                 jobject newElement_3;
                 jobject newElement_3_attributeID;
-                if (!entry_3.attributeID.HasValue())
-                {
-                    chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_3_attributeID);
-                }
-                else
-                {
-                    jobject newElement_3_attributeIDInsideOptional;
-                    std::string newElement_3_attributeIDInsideOptionalClassName     = "java/lang/Long";
-                    std::string newElement_3_attributeIDInsideOptionalCtorSignature = "(J)V";
-                    chip::JniReferences::GetInstance().CreateBoxedObject<uint32_t>(
-                        newElement_3_attributeIDInsideOptionalClassName.c_str(),
-                        newElement_3_attributeIDInsideOptionalCtorSignature.c_str(), entry_3.attributeID.Value(),
-                        newElement_3_attributeIDInsideOptional);
-                    chip::JniReferences::GetInstance().CreateOptional(newElement_3_attributeIDInsideOptional,
-                                                                      newElement_3_attributeID);
-                }
+                std::string newElement_3_attributeIDClassName     = "java/lang/Long";
+                std::string newElement_3_attributeIDCtorSignature = "(J)V";
+                chip::JniReferences::GetInstance().CreateBoxedObject<uint32_t>(newElement_3_attributeIDClassName.c_str(),
+                                                                               newElement_3_attributeIDCtorSignature.c_str(),
+                                                                               entry_3.attributeID, newElement_3_attributeID);
                 jobject newElement_3_attributeValue;
                 std::string newElement_3_attributeValueClassName     = "java/lang/Long";
                 std::string newElement_3_attributeValueCtorSignature = "(J)V";
@@ -1110,7 +1088,7 @@
                     return;
                 }
                 jmethodID attributeValuePairStructCtor_4 =
-                    env->GetMethodID(attributeValuePairStructClass_4, "<init>", "(Ljava/util/Optional;Ljava/lang/Long;)V");
+                    env->GetMethodID(attributeValuePairStructClass_4, "<init>", "(Ljava/lang/Long;Ljava/lang/Long;)V");
                 if (attributeValuePairStructCtor_4 == nullptr)
                 {
                     ChipLogError(Zcl, "Could not find ChipStructs$ScenesClusterAttributeValuePair constructor");
diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java
index b024e13..e8d9aab 100644
--- a/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java
+++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipStructs.java
@@ -25,11 +25,11 @@
 
 public class ChipStructs {
 public static class ScenesClusterAttributeValuePair {
-public Optional<Long> attributeID;
+public Long attributeID;
 public Long attributeValue;
 
   public ScenesClusterAttributeValuePair(
-    Optional<Long> attributeID
+    Long attributeID
       , Long attributeValue
   ) {
     this.attributeID = attributeID;
diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py
index e9ee0c0..361c55c 100644
--- a/src/controller/python/chip/clusters/Objects.py
+++ b/src/controller/python/chip/clusters/Objects.py
@@ -635,11 +635,11 @@
             def descriptor(cls) -> ClusterObjectDescriptor:
                 return ClusterObjectDescriptor(
                     Fields=[
-                        ClusterObjectFieldDescriptor(Label="attributeID", Tag=0, Type=typing.Optional[uint]),
+                        ClusterObjectFieldDescriptor(Label="attributeID", Tag=0, Type=uint),
                         ClusterObjectFieldDescriptor(Label="attributeValue", Tag=1, Type=uint),
                     ])
 
-            attributeID: 'typing.Optional[uint]' = None
+            attributeID: 'uint' = 0
             attributeValue: 'uint' = 0
 
         @dataclass
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm
index 41d6c11..0588c01 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm
@@ -1817,10 +1817,7 @@
                                         return CHIP_ERROR_INVALID_ARGUMENT;
                                     }
                                     auto element_2 = (MTRScenesClusterAttributeValuePair *) element_0.attributeValueList[i_2];
-                                    if (element_2.attributeID != nil) {
-                                        auto & definedValue_4 = listHolder_2->mList[i_2].attributeID.Emplace();
-                                        definedValue_4 = element_2.attributeID.unsignedIntValue;
-                                    }
+                                    listHolder_2->mList[i_2].attributeID = element_2.attributeID.unsignedIntValue;
                                     listHolder_2->mList[i_2].attributeValue = element_2.attributeValue.unsignedIntValue;
                                 }
                                 listHolder_0->mList[i_0].attributeValueList
@@ -2126,10 +2123,7 @@
                                         return CHIP_ERROR_INVALID_ARGUMENT;
                                     }
                                     auto element_2 = (MTRScenesClusterAttributeValuePair *) element_0.attributeValueList[i_2];
-                                    if (element_2.attributeID != nil) {
-                                        auto & definedValue_4 = listHolder_2->mList[i_2].attributeID.Emplace();
-                                        definedValue_4 = element_2.attributeID.unsignedIntValue;
-                                    }
+                                    listHolder_2->mList[i_2].attributeID = element_2.attributeID.unsignedIntValue;
                                     listHolder_2->mList[i_2].attributeValue = element_2.attributeValue.unsignedIntValue;
                                 }
                                 listHolder_0->mList[i_0].attributeValueList
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm
index 3b7d52b..f6518c2 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm
@@ -1039,10 +1039,7 @@
                                             return CHIP_ERROR_INVALID_ARGUMENT;
                                         }
                                         auto element_2 = (MTRScenesClusterAttributeValuePair *) element_0.attributeValueList[i_2];
-                                        if (element_2.attributeID != nil) {
-                                            auto & definedValue_4 = listHolder_2->mList[i_2].attributeID.Emplace();
-                                            definedValue_4 = element_2.attributeID.unsignedIntValue;
-                                        }
+                                        listHolder_2->mList[i_2].attributeID = element_2.attributeID.unsignedIntValue;
                                         listHolder_2->mList[i_2].attributeValue = element_2.attributeValue.unsignedIntValue;
                                     }
                                     listHolder_0->mList[i_0].attributeValueList
@@ -1591,10 +1588,7 @@
                                             return CHIP_ERROR_INVALID_ARGUMENT;
                                         }
                                         auto element_2 = (MTRScenesClusterAttributeValuePair *) element_0.attributeValueList[i_2];
-                                        if (element_2.attributeID != nil) {
-                                            auto & definedValue_4 = listHolder_2->mList[i_2].attributeID.Emplace();
-                                            definedValue_4 = element_2.attributeID.unsignedIntValue;
-                                        }
+                                        listHolder_2->mList[i_2].attributeID = element_2.attributeID.unsignedIntValue;
                                         listHolder_2->mList[i_2].attributeValue = element_2.attributeValue.unsignedIntValue;
                                     }
                                     listHolder_0->mList[i_0].attributeValueList
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
index a99cceb..20d5e7f 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandPayloadsObjc.mm
@@ -1121,11 +1121,7 @@
                             auto & entry_3 = iter_3.GetValue();
                             MTRScenesClusterAttributeValuePair * newElement_3;
                             newElement_3 = [MTRScenesClusterAttributeValuePair new];
-                            if (entry_3.attributeID.HasValue()) {
-                                newElement_3.attributeID = [NSNumber numberWithUnsignedInt:entry_3.attributeID.Value()];
-                            } else {
-                                newElement_3.attributeID = nil;
-                            }
+                            newElement_3.attributeID = [NSNumber numberWithUnsignedInt:entry_3.attributeID];
                             newElement_3.attributeValue = [NSNumber numberWithUnsignedInt:entry_3.attributeValue];
                             [array_3 addObject:newElement_3];
                         }
@@ -2274,11 +2270,7 @@
                             auto & entry_3 = iter_3.GetValue();
                             MTRScenesClusterAttributeValuePair * newElement_3;
                             newElement_3 = [MTRScenesClusterAttributeValuePair new];
-                            if (entry_3.attributeID.HasValue()) {
-                                newElement_3.attributeID = [NSNumber numberWithUnsignedInt:entry_3.attributeID.Value()];
-                            } else {
-                                newElement_3.attributeID = nil;
-                            }
+                            newElement_3.attributeID = [NSNumber numberWithUnsignedInt:entry_3.attributeID];
                             newElement_3.attributeValue = [NSNumber numberWithUnsignedInt:entry_3.attributeValue];
                             [array_3 addObject:newElement_3];
                         }
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
index 076ed26..c169c3c 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h
@@ -21,8 +21,8 @@
 
 API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
 @interface MTRScenesClusterAttributeValuePair : NSObject <NSCopying>
-@property (nonatomic, copy) NSNumber * _Nullable attributeID API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4));
-@property (nonatomic, copy) NSNumber * _Nullable attributeId MTR_DEPRECATED(
+@property (nonatomic, copy) NSNumber * _Nonnull attributeID API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4));
+@property (nonatomic, copy) NSNumber * _Nonnull attributeId MTR_DEPRECATED(
     "Please use attributeID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4));
 @property (nonatomic, copy) NSNumber * _Nonnull attributeValue API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1));
 @end
diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
index f81221f..9aed49b 100644
--- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
+++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm
@@ -24,7 +24,7 @@
 {
     if (self = [super init]) {
 
-        _attributeID = nil;
+        _attributeID = @(0);
 
         _attributeValue = @(0);
     }
@@ -48,12 +48,12 @@
     return descriptionString;
 }
 
-- (void)setAttributeId:(NSNumber * _Nullable)attributeId
+- (void)setAttributeId:(NSNumber * _Nonnull)attributeId
 {
     self.attributeID = attributeId;
 }
 
-- (NSNumber * _Nullable)attributeId
+- (NSNumber * _Nonnull)attributeId
 {
     return self.attributeID;
 }
diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
index 3b906f7..6555c0e 100644
--- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
+++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h
@@ -924,8 +924,8 @@
 struct Type
 {
 public:
-    Optional<chip::AttributeId> attributeID;
-    uint32_t attributeValue = static_cast<uint32_t>(0);
+    chip::AttributeId attributeID = static_cast<chip::AttributeId>(0);
+    uint32_t attributeValue       = static_cast<uint32_t>(0);
 
     CHIP_ERROR Decode(TLV::TLVReader & reader);
 
diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp
index b7ba3d6..f55c84a 100644
--- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp
+++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp
@@ -229,15 +229,14 @@
     // Copy to track which members we already processed.
     Json::Value valueCopy(value);
 
+    ReturnErrorOnFailure(
+        ComplexArgumentParser::EnsureMemberExist("AttributeValuePair.attributeID", "attributeID", value.isMember("attributeID")));
     ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("AttributeValuePair.attributeValue", "attributeValue",
                                                                   value.isMember("attributeValue")));
 
     char labelWithMember[kMaxLabelLength];
-    if (value.isMember("attributeID"))
-    {
-        snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "attributeID");
-        ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.attributeID, value["attributeID"]));
-    }
+    snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "attributeID");
+    ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.attributeID, value["attributeID"]));
     valueCopy.removeMember("attributeID");
 
     snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "attributeValue");
diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h
index 2d73030..8d1e024 100644
--- a/zzz_generated/chip-tool/zap-generated/test/Commands.h
+++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h
@@ -132014,10 +132014,8 @@
                         auto iter_3 = iter_1.GetValue().attributeValueList.begin();
                         VerifyOrReturn(CheckNextListItemDecodes<decltype(iter_1.GetValue().attributeValueList)>(
                             "extensionFieldSets.Value()[0].attributeValueList", iter_3, 0));
-                        VerifyOrReturn(CheckValuePresent("extensionFieldSets.Value()[0].attributeValueList[0].attributeID",
-                                                         iter_3.GetValue().attributeID));
-                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[0].attributeValueList[0].attributeID.Value()",
-                                                  iter_3.GetValue().attributeID.Value(), 0UL));
+                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[0].attributeValueList[0].attributeID",
+                                                  iter_3.GetValue().attributeID, 0UL));
                         VerifyOrReturn(CheckValue("extensionFieldSets.Value()[0].attributeValueList[0].attributeValue",
                                                   iter_3.GetValue().attributeValue, 1UL));
                         VerifyOrReturn(CheckNoMoreListItems<decltype(iter_1.GetValue().attributeValueList)>(
@@ -132030,18 +132028,14 @@
                         auto iter_3 = iter_1.GetValue().attributeValueList.begin();
                         VerifyOrReturn(CheckNextListItemDecodes<decltype(iter_1.GetValue().attributeValueList)>(
                             "extensionFieldSets.Value()[1].attributeValueList", iter_3, 0));
-                        VerifyOrReturn(CheckValuePresent("extensionFieldSets.Value()[1].attributeValueList[0].attributeID",
-                                                         iter_3.GetValue().attributeID));
-                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[0].attributeID.Value()",
-                                                  iter_3.GetValue().attributeID.Value(), 0UL));
+                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[0].attributeID",
+                                                  iter_3.GetValue().attributeID, 0UL));
                         VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[0].attributeValue",
                                                   iter_3.GetValue().attributeValue, 100UL));
                         VerifyOrReturn(CheckNextListItemDecodes<decltype(iter_1.GetValue().attributeValueList)>(
                             "extensionFieldSets.Value()[1].attributeValueList", iter_3, 1));
-                        VerifyOrReturn(CheckValuePresent("extensionFieldSets.Value()[1].attributeValueList[1].attributeID",
-                                                         iter_3.GetValue().attributeID));
-                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[1].attributeID.Value()",
-                                                  iter_3.GetValue().attributeID.Value(), 1UL));
+                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[1].attributeID",
+                                                  iter_3.GetValue().attributeID, 1UL));
                         VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[1].attributeValue",
                                                   iter_3.GetValue().attributeValue, 0UL));
                         VerifyOrReturn(CheckNoMoreListItems<decltype(iter_1.GetValue().attributeValueList)>(
@@ -132661,9 +132655,8 @@
                     auto * listHolder_2 = new ListHolder<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(1);
                     listFreer.add(listHolder_2);
 
-                    listHolder_2->mList[0].attributeID.Emplace();
-                    listHolder_2->mList[0].attributeID.Value() = 0UL;
-                    listHolder_2->mList[0].attributeValue      = 1UL;
+                    listHolder_2->mList[0].attributeID    = 0UL;
+                    listHolder_2->mList[0].attributeValue = 1UL;
 
                     listHolder_0->mList[0].attributeValueList =
                         chip::app::DataModel::List<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(
@@ -132676,13 +132669,11 @@
                     auto * listHolder_2 = new ListHolder<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(2);
                     listFreer.add(listHolder_2);
 
-                    listHolder_2->mList[0].attributeID.Emplace();
-                    listHolder_2->mList[0].attributeID.Value() = 0UL;
-                    listHolder_2->mList[0].attributeValue      = 100UL;
+                    listHolder_2->mList[0].attributeID    = 0UL;
+                    listHolder_2->mList[0].attributeValue = 100UL;
 
-                    listHolder_2->mList[1].attributeID.Emplace();
-                    listHolder_2->mList[1].attributeID.Value() = 1UL;
-                    listHolder_2->mList[1].attributeValue      = 0UL;
+                    listHolder_2->mList[1].attributeID    = 1UL;
+                    listHolder_2->mList[1].attributeValue = 0UL;
 
                     listHolder_0->mList[1].attributeValueList =
                         chip::app::DataModel::List<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(
@@ -133109,10 +133100,8 @@
                         auto iter_3 = iter_1.GetValue().attributeValueList.begin();
                         VerifyOrReturn(CheckNextListItemDecodes<decltype(iter_1.GetValue().attributeValueList)>(
                             "extensionFieldSets.Value()[0].attributeValueList", iter_3, 0));
-                        VerifyOrReturn(CheckValuePresent("extensionFieldSets.Value()[0].attributeValueList[0].attributeID",
-                                                         iter_3.GetValue().attributeID));
-                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[0].attributeValueList[0].attributeID.Value()",
-                                                  iter_3.GetValue().attributeID.Value(), 0UL));
+                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[0].attributeValueList[0].attributeID",
+                                                  iter_3.GetValue().attributeID, 0UL));
                         VerifyOrReturn(CheckValue("extensionFieldSets.Value()[0].attributeValueList[0].attributeValue",
                                                   iter_3.GetValue().attributeValue, 1UL));
                         VerifyOrReturn(CheckNoMoreListItems<decltype(iter_1.GetValue().attributeValueList)>(
@@ -133125,18 +133114,14 @@
                         auto iter_3 = iter_1.GetValue().attributeValueList.begin();
                         VerifyOrReturn(CheckNextListItemDecodes<decltype(iter_1.GetValue().attributeValueList)>(
                             "extensionFieldSets.Value()[1].attributeValueList", iter_3, 0));
-                        VerifyOrReturn(CheckValuePresent("extensionFieldSets.Value()[1].attributeValueList[0].attributeID",
-                                                         iter_3.GetValue().attributeID));
-                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[0].attributeID.Value()",
-                                                  iter_3.GetValue().attributeID.Value(), 0UL));
+                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[0].attributeID",
+                                                  iter_3.GetValue().attributeID, 0UL));
                         VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[0].attributeValue",
                                                   iter_3.GetValue().attributeValue, 100UL));
                         VerifyOrReturn(CheckNextListItemDecodes<decltype(iter_1.GetValue().attributeValueList)>(
                             "extensionFieldSets.Value()[1].attributeValueList", iter_3, 1));
-                        VerifyOrReturn(CheckValuePresent("extensionFieldSets.Value()[1].attributeValueList[1].attributeID",
-                                                         iter_3.GetValue().attributeID));
-                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[1].attributeID.Value()",
-                                                  iter_3.GetValue().attributeID.Value(), 1UL));
+                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[1].attributeID",
+                                                  iter_3.GetValue().attributeID, 1UL));
                         VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[1].attributeValue",
                                                   iter_3.GetValue().attributeValue, 0UL));
                         VerifyOrReturn(CheckNoMoreListItems<decltype(iter_1.GetValue().attributeValueList)>(
@@ -133167,10 +133152,8 @@
                         auto iter_3 = iter_1.GetValue().attributeValueList.begin();
                         VerifyOrReturn(CheckNextListItemDecodes<decltype(iter_1.GetValue().attributeValueList)>(
                             "extensionFieldSets.Value()[0].attributeValueList", iter_3, 0));
-                        VerifyOrReturn(CheckValuePresent("extensionFieldSets.Value()[0].attributeValueList[0].attributeID",
-                                                         iter_3.GetValue().attributeID));
-                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[0].attributeValueList[0].attributeID.Value()",
-                                                  iter_3.GetValue().attributeID.Value(), 0UL));
+                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[0].attributeValueList[0].attributeID",
+                                                  iter_3.GetValue().attributeID, 0UL));
                         VerifyOrReturn(CheckValue("extensionFieldSets.Value()[0].attributeValueList[0].attributeValue",
                                                   iter_3.GetValue().attributeValue, 1UL));
                         VerifyOrReturn(CheckNoMoreListItems<decltype(iter_1.GetValue().attributeValueList)>(
@@ -133183,18 +133166,14 @@
                         auto iter_3 = iter_1.GetValue().attributeValueList.begin();
                         VerifyOrReturn(CheckNextListItemDecodes<decltype(iter_1.GetValue().attributeValueList)>(
                             "extensionFieldSets.Value()[1].attributeValueList", iter_3, 0));
-                        VerifyOrReturn(CheckValuePresent("extensionFieldSets.Value()[1].attributeValueList[0].attributeID",
-                                                         iter_3.GetValue().attributeID));
-                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[0].attributeID.Value()",
-                                                  iter_3.GetValue().attributeID.Value(), 0UL));
+                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[0].attributeID",
+                                                  iter_3.GetValue().attributeID, 0UL));
                         VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[0].attributeValue",
                                                   iter_3.GetValue().attributeValue, 100UL));
                         VerifyOrReturn(CheckNextListItemDecodes<decltype(iter_1.GetValue().attributeValueList)>(
                             "extensionFieldSets.Value()[1].attributeValueList", iter_3, 1));
-                        VerifyOrReturn(CheckValuePresent("extensionFieldSets.Value()[1].attributeValueList[1].attributeID",
-                                                         iter_3.GetValue().attributeID));
-                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[1].attributeID.Value()",
-                                                  iter_3.GetValue().attributeID.Value(), 1UL));
+                        VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[1].attributeID",
+                                                  iter_3.GetValue().attributeID, 1UL));
                         VerifyOrReturn(CheckValue("extensionFieldSets.Value()[1].attributeValueList[1].attributeValue",
                                                   iter_3.GetValue().attributeValue, 0UL));
                         VerifyOrReturn(CheckNoMoreListItems<decltype(iter_1.GetValue().attributeValueList)>(
@@ -133425,9 +133404,8 @@
                     auto * listHolder_2 = new ListHolder<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(1);
                     listFreer.add(listHolder_2);
 
-                    listHolder_2->mList[0].attributeID.Emplace();
-                    listHolder_2->mList[0].attributeID.Value() = 0UL;
-                    listHolder_2->mList[0].attributeValue      = 1UL;
+                    listHolder_2->mList[0].attributeID    = 0UL;
+                    listHolder_2->mList[0].attributeValue = 1UL;
 
                     listHolder_0->mList[0].attributeValueList =
                         chip::app::DataModel::List<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(
@@ -133440,13 +133418,11 @@
                     auto * listHolder_2 = new ListHolder<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(2);
                     listFreer.add(listHolder_2);
 
-                    listHolder_2->mList[0].attributeID.Emplace();
-                    listHolder_2->mList[0].attributeID.Value() = 0UL;
-                    listHolder_2->mList[0].attributeValue      = 100UL;
+                    listHolder_2->mList[0].attributeID    = 0UL;
+                    listHolder_2->mList[0].attributeValue = 100UL;
 
-                    listHolder_2->mList[1].attributeID.Emplace();
-                    listHolder_2->mList[1].attributeID.Value() = 1UL;
-                    listHolder_2->mList[1].attributeValue      = 0UL;
+                    listHolder_2->mList[1].attributeID    = 1UL;
+                    listHolder_2->mList[1].attributeValue = 0UL;
 
                     listHolder_0->mList[1].attributeValueList =
                         chip::app::DataModel::List<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(
@@ -133484,9 +133460,8 @@
                     auto * listHolder_2 = new ListHolder<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(1);
                     listFreer.add(listHolder_2);
 
-                    listHolder_2->mList[0].attributeID.Emplace();
-                    listHolder_2->mList[0].attributeID.Value() = 0UL;
-                    listHolder_2->mList[0].attributeValue      = 1UL;
+                    listHolder_2->mList[0].attributeID    = 0UL;
+                    listHolder_2->mList[0].attributeValue = 1UL;
 
                     listHolder_0->mList[0].attributeValueList =
                         chip::app::DataModel::List<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(
@@ -133499,13 +133474,11 @@
                     auto * listHolder_2 = new ListHolder<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(2);
                     listFreer.add(listHolder_2);
 
-                    listHolder_2->mList[0].attributeID.Emplace();
-                    listHolder_2->mList[0].attributeID.Value() = 0UL;
-                    listHolder_2->mList[0].attributeValue      = 100UL;
+                    listHolder_2->mList[0].attributeID    = 0UL;
+                    listHolder_2->mList[0].attributeValue = 100UL;
 
-                    listHolder_2->mList[1].attributeID.Emplace();
-                    listHolder_2->mList[1].attributeID.Value() = 1UL;
-                    listHolder_2->mList[1].attributeValue      = 0UL;
+                    listHolder_2->mList[1].attributeID    = 1UL;
+                    listHolder_2->mList[1].attributeValue = 0UL;
 
                     listHolder_0->mList[1].attributeValueList =
                         chip::app::DataModel::List<chip::app::Clusters::Scenes::Structs::AttributeValuePair::Type>(
diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
index 61f12b5..b2b58d0 100644
--- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
+++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h
@@ -1693,11 +1693,7 @@
                     for (auto & entry_2 : entry_0.attributeValueList) {
                         MTRScenesClusterAttributeValuePair * newElement_2;
                         newElement_2 = [MTRScenesClusterAttributeValuePair new];
-                        if (entry_2.attributeID.HasValue()) {
-                            newElement_2.attributeID = [NSNumber numberWithUnsignedInt:entry_2.attributeID.Value()];
-                        } else {
-                            newElement_2.attributeID = nil;
-                        }
+                        newElement_2.attributeID = [NSNumber numberWithUnsignedInt:entry_2.attributeID];
                         newElement_2.attributeValue = [NSNumber numberWithUnsignedInt:entry_2.attributeValue];
                         [array_2 addObject:newElement_2];
                     }
@@ -2066,11 +2062,7 @@
                     for (auto & entry_2 : entry_0.attributeValueList) {
                         MTRScenesClusterAttributeValuePair * newElement_2;
                         newElement_2 = [MTRScenesClusterAttributeValuePair new];
-                        if (entry_2.attributeID.HasValue()) {
-                            newElement_2.attributeID = [NSNumber numberWithUnsignedInt:entry_2.attributeID.Value()];
-                        } else {
-                            newElement_2.attributeID = nil;
-                        }
+                        newElement_2.attributeID = [NSNumber numberWithUnsignedInt:entry_2.attributeID];
                         newElement_2.attributeValue = [NSNumber numberWithUnsignedInt:entry_2.attributeValue];
                         [array_2 addObject:newElement_2];
                     }