Repository navigation
Fix several issues with oneof responses - #924
Merged
ezilber-akamai merged 7 commits intoSep 16, 2026
Merged
ezilber-akamai merged 7 commits into
ezilber-akamai merged 7 commits into
Conversation
ezilber-akamai
requested review from
jriddle-linode and
mawilk90
and removed request for
a team
September 9, 2026 15:16
Contributor
|
The tests passed locally. Thanks for addressing it! |
mawilk90
approved these changes
Sep 15, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Richness ties remain order-dependent, and scalar oneOf arrays can disappear from generated output.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Balanced
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved moderate schema-aggregation issues and missing coverage block approval.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (3)
linodecli/baked/util.py:121
- The
<=comparison also discards equal-richness definitions. Two branches can define the same object property with disjoint nested fields but the same score, andallOfbranches are conjunctive, so keeping only the first loses fields that must be exposed. Use a composition-aware merge for ties/allOf rather than a winner-takes-all selection.
if key in properties and _schema_richness(
value
) <= _schema_richness(properties[key]):
continue
properties[key] = value
linodecli/baked/util.py:52
- Each duplicate-property comparison recursively walks properties, compositions, and items. The depth cap prevents unbounded recursion but not exponential work for a cyclic schema with multiple recursive children; a branching cycle can expand to roughly 2^32 visits during one comparison and make baking unresponsive. Memoize scores by schema identity or track active nodes in addition to the depth limit.
properties = get(schema, "properties")
if properties:
for _, prop in properties.items():
score += 1 + _schema_richness(prop, _depth + 1)
linodecli/baked/util.py:58
_schema_richnessadds1for every composition branch even when that branch contributes no object properties. A property defined asoneOf: [{type: string}, {type: integer}]therefore scores 2 and can beat a competing object definition with one nested field (score 1); the aggregator keeps the scalar oneOf schema, and_parse_response_modelthen emits only the parent value instead of the nested field. Score renderable structure rather than counting scalar alternatives, or merge the alternatives before choosing a definition.
# Account for composite (oneOf/allOf/anyOf) definitions by summing the
# richness of each branch.
for composition_field in ("oneOf", "allOf", "anyOf"):
for branch in get(schema, composition_field) or []:
score += 1 + _schema_richness(branch, _depth + 1)
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
Comment on lines
+62
to
+64
| array_items = get(schema, "items") | ||
| if array_items is not None: | ||
| score += _schema_richness(array_items, _depth + 1) |
Contributor
There was a problem hiding this comment.
I think we can apply this comment for the edge case
yec-akamai
approved these changes
Sep 15, 2026
yec-akamai
left a comment
Contributor
There was a problem hiding this comment.
Tests passed locally!
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.
📝 Description
Fixed
oneOfresponse properties being overwritten during schema aggregation. When aoneOfdefines the same property across multiple branches, keep the most complete definition instead of letting a later, emptier branch overwrite it. This fixes fields likepublic.ipv6.rangesbeing dropped from output.Also fixed an issue with oneOf schemas in
_parse_response_modelthat was causing nested response data to be displayed incorrectly.✔️ How to Test
make test-unitmake test-int TEST_CASE=test_interface_update(was previously failing)make test-int TEST_SUITE=firewalls(was previously failing)