feat: JSONify variant types when flattening records#3416
Draft
edgarrmondragon wants to merge 3 commits into
Draft
feat: JSONify variant types when flattening records#3416edgarrmondragon wants to merge 3 commits into
edgarrmondragon wants to merge 3 commits into
Conversation
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Contributor
Reviewer's GuideAdjusts schema flattening to coerce typeless and combined-schema fields (oneOf/anyOf/allOf) to JSON-serialized strings, and updates record flattening logic and tests to rely on an x-json-serialize marker for consistent JSON encoding of flattened values. Flow diagram for schema flattening with x-json-serialize markersflowchart TD
A[Start flatten_schema] --> B[Call _flatten_schema with schema_node]
B --> C[Iterate over field_schema entries]
C --> D{field_schema has type key}
D --> E[Normalize type to list]
E --> F[Append new_key and field_schema or coerced type to items]
F --> G[Next field]
D --> H[No type key]
H --> I[Handle oneOf anyOf allOf or typeless]
I --> J[Append new_key type null or string x-json-serialize True to items]
J --> G
G --> K{More fields?}
K --> C
K --> L[Sort items and check duplicates]
L --> M[Build flattened_schema.properties from items]
M --> N[Return flattened_schema]
N --> O[End]
subgraph Legend
L1[Fields with explicit type] --> L2[Flatten normally]
L3[oneOf anyOf allOf or typeless fields] --> L4[Marked x-json-serialize True]
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3416 +/- ##
==========================================
- Coverage 94.07% 94.01% -0.07%
==========================================
Files 69 69
Lines 5777 5769 -8
Branches 716 713 -3
==========================================
- Hits 5435 5424 -11
- Misses 239 241 +2
- Partials 103 104 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
CodSpeed Performance ReportMerging #3416 will not alter performanceComparing Summary
Footnotes |
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Coerce variant and typeless schema properties to JSON-serialized strings during flattening and ensure record flattening respects these markers.
New Features:
Enhancements:
Tests: