Skip to content

Commit 62ea31c

Browse files
authored
Fix doc (#41397)
1 parent da6ff75 commit 62ea31c

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

doc/dev/mgmt/hybrid_model_migration.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ When migrating to the hybrid model design, expect these breaking changes:
1616
| [Model Hierarchy](#model-hierarchy-reflects-rest-api-structure) | Multi-level flattened properties removed | Replace `obj.level1_level2_prop` with `obj.level1.level2.prop` |
1717
| [Additional Properties](#additional-properties-handling) | `additional_properties` parameter removed | Use direct dictionary syntax: `model["key"] = value` |
1818
| [String Representation](#string-representation-matches-rest-api) | Model key output changed from `snake_case` to `camelCase` | Update any code parsing model strings to expect `camelCase` |
19-
| [Serialization/Deserialization](#serialization-and-deserialization-methods-removed) | `serialization` and `deserialization` methods removed | Use dictionary access for serialization, constructor for deserialization |
19+
| [Serialization/Deserialization](#serialization-and-deserialization-methods-removed) | `serialize` and `deserialize` methods removed | Use dictionary access for serialization, constructor for deserialization |
2020

2121
## Detailed Breaking Changes
2222

@@ -26,14 +26,14 @@ When migrating to the hybrid model design, expect these breaking changes:
2626

2727
**What will break**:
2828

29-
- Code that relies on parameter `keep_readonly` to `.on_dict()`
29+
- Code that relies on parameter `keep_readonly` to `.as_dict()`
3030
- Code that expects `snake_case` keys in dictionary output
3131

3232
**Before**:
3333

3434
```python
3535
from azure.mgmt.test.models import Model
36-
model = Model(name="example")
36+
model = Model(my_name="example")
3737

3838
# Dictionary access required as_dict()
3939
json_model = model.as_dict(keep_readonly=True)
@@ -44,7 +44,7 @@ print(json_model["my_name"]) # snake_case key
4444

4545
```python
4646
from azure.mgmt.test.models import Model
47-
model = Model(name="example")
47+
model = Model(my_name="example")
4848

4949
# Direct dictionary access now works
5050
print(model["myName"]) # Works directly
@@ -67,7 +67,7 @@ print(json_model["myName"]) # Now returns camelCase key (matches REST API)
6767
**What will break**:
6868

6969
- We've maintained backcompat for attribute access for single-level flattened properties, but multi-level flattening will no longer be supported.
70-
- No level of flattening will be supported when dealing with the the response object from `.to_dict()`.
70+
- No level of flattening will be supported when dealing with the response object from `.as_dict()`.
7171

7272
**Before**:
7373

@@ -82,7 +82,6 @@ print(json_model["properties_properties_name"]) # Works (artificially flattened
8282
**After**:
8383

8484
```python
85-
8685
model = Model(...)
8786
print(model.properties_name) # Still works (single-level flattening maintained for compatibility)
8887
print(model.properties.name) # Equivalent to above, preferred approach
@@ -95,11 +94,10 @@ print(model["properties"]["properties"]["name"]) # ✅ Mirrors actual API struc
9594

9695
**Migration steps:**
9796

98-
Identify any properties with multiple underscores that represent nested structures
99-
Replace them with the actual nested property access using dot notation
100-
101-
Example: `obj.level1_level2_property``obj.level1.level2.property`
102-
This new structure will match your REST API documentation exactly
97+
- Identify any properties with multiple underscores that represent nested structures
98+
- Replace them with the actual nested property access using dot notation
99+
- Example: `obj.level1_level2_property``obj.level1.level2.property`
100+
- This new structure will match your REST API documentation exactly
103101

104102
### Additional Properties Handling
105103

@@ -187,7 +185,7 @@ import json
187185

188186
# Serialization
189187
model = Model(name="example", value=42)
190-
serialized_dict = model.serialize() # Returns dict using the REST API name, compatible with `json.dump`
188+
serialized_dict = model.serialize() # Returns dict using the REST API name, compatible with `json.dumps`
191189
json_string = json.dumps(serialized_dict)
192190

193191
# Deserialization

0 commit comments

Comments
 (0)