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
docs: add composition-based alternative for allOf support
Enhanced the type mapping documentation with:
- Alternative composition approach for allOf using serde flatten
- Explanation of how to avoid property name conflicts
- Generated names for anonymous objects (Object$1, Object$2)
- Trade-offs between flattening vs composition approaches
This approach would maintain type safety while avoiding the complex
property merging issues that arise with allOf schemas.
**Current behavior**: The generator fails or produces incorrect output for allOf schemas.
161
178
179
+
**Note**: Option 2 avoids property name conflicts that could occur if multiple schemas in allOf define the same property names. This approach maintains type safety while preserving the composition structure.
180
+
162
181
### Nullable Handling
163
182
164
183
```yaml
@@ -195,7 +214,44 @@ pub struct Node {
195
214
196
215
## Alternatives Considered (But Not Implemented)
197
216
198
-
### Alternative 1: True anyOf Support with Validation Trait
217
+
### Alternative 1: Composition-based allOf Support
218
+
219
+
For allOf schemas, instead of trying to flatten all properties into a single struct (which can cause naming conflicts), use composition with serde's flatten:
0 commit comments