-
Notifications
You must be signed in to change notification settings - Fork 1
Normalize allOf with single model to aliases #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces an AllOfNormalizer transformer that simplifies OpenAPI allOf schemas containing a single model by converting them to type aliases. This addresses common patterns (used by Spotify and others) where allOf: [$ref, {description: ...}] is used solely to add documentation to referenced schemas.
Changes:
- Adds
AllOfNormalizerclass with deep transformation logic and memoization for referential consistency - Makes
ResponseHeaderObject,ResponseBody, andRequestContentclasses mutable by removing@immutableannotations, making fields non-final, and removing equality implementations - Adds comprehensive test coverage for the normalizer including edge cases and deep transformations
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/tonik_core/lib/src/transformer/allof_normalizer.dart |
New transformer implementing single-model AllOf → Alias normalization with deep traversal and memoization |
packages/tonik_core/test/src/transformer/allof_normalizer_test.dart |
Comprehensive test suite covering normalization, edge cases, and deep transformation scenarios |
packages/tonik_core/lib/tonik_core.dart |
Exports the new AllOfNormalizer transformer |
packages/tonik_core/lib/src/model/response_header.dart |
Makes ResponseHeaderObject mutable to enable in-place model updates |
packages/tonik_core/lib/src/model/response.dart |
Makes Response and ResponseBody classes mutable |
packages/tonik_core/lib/src/model/request_body.dart |
Makes RequestContent mutable |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #71 +/- ##
==========================================
- Coverage 89.09% 88.80% -0.29%
==========================================
Files 146 147 +1
Lines 11838 11925 +87
==========================================
+ Hits 10547 10590 +43
- Misses 1291 1335 +44
🚀 New features to boost your workflow:
|
No description provided.