You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- This new structure will match your REST API documentation exactly
101
113
114
+
**Backcompat option:**
115
+
For complex flattened property access where direct migration is difficult:
116
+
117
+
```python
118
+
# Requires azure-core >= 1.35.0
119
+
from azure.core.serialization import as_attribute_dict
120
+
121
+
# Handles flattened properties automatically
122
+
model_dict = as_attribute_dict(model)
123
+
print(model_dict["properties_properties_name"]) # Works with flattened names
124
+
```
125
+
102
126
### Additional Properties Handling
103
127
104
128
**What changed**: Hybrid models inherently support additional properties through dictionary-like behavior, eliminating the need for a separate additional_properties parameter.
@@ -236,6 +260,32 @@ model = Model(name="example", value=42) # Still works as before
236
260
- Verify the output format matches your expectations
237
261
- Check that `camelCase` keys are handled correctly
238
262
263
+
**Backcompat option:**
264
+
If you need the exact same serialization format as the old `serialize()` method:
265
+
266
+
```python
267
+
# Requires azure-core >= 1.35.0
268
+
from azure.core.serialization import as_attribute_dict
269
+
270
+
# Returns the same format as old serialize() method with snake_case keys
For edge cases and generic code that works with models, Azure Core (version 1.35.0 or later) provides these utility methods in `azure.core.serialization`:
281
+
282
+
-**`is_generated_model(obj)`**: Check if an object is an SDK-generated model
283
+
-**`attribute_list(model)`**: Get list of model attribute names (excluding additional properties)
284
+
285
+
These are useful for writing generic code that needs to detect or introspect SDK models. These methods work with both the old and new hybrid models.
286
+
287
+
---
288
+
239
289
## Why These Changes?
240
290
241
291
Our hybrid models prioritize consistency with the underlying REST API:
0 commit comments