Skip to content

Handling of transitive allOf/refs is busted (for omicron)#21

Merged
ahl merged 5 commits intomainfrom
broky
May 1, 2026
Merged

Handling of transitive allOf/refs is busted (for omicron)#21
ahl merged 5 commits intomainfrom
broky

Conversation

@ahl
Copy link
Copy Markdown
Collaborator

@ahl ahl commented Apr 30, 2026

It looks like #10 broke an untested case that arose in oxidecomputer/omicron#10037

Comment thread src/schema.rs
new_inner,
)?))
}
(BareRef | InlineType | MultiElement, BareRef | InlineType | MultiElement)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. My understanding is that the breakage/test case falls into this category where we end up returning None -- is that accurate?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. It's an allof ref pointing to an allof ref--a bit unusual

Comment thread src/schema.rs
Comment on lines 736 to 742
fn compare_schema_type_all_of(
&mut self,
comparison: SchemaComparison,
dry_run: bool,
old_all_of: Contextual<'_, &Vec<ReferenceOr<Schema>>>,
new_all_of: Contextual<'_, &Vec<ReferenceOr<Schema>>>,
) -> anyhow::Result<bool> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not totally important but I'm wondering if we can make allOf, oneOf and anyOf (which I believe is inlined into compare_schema_kind) look as similar to each other as possible. It feels like they should generally be symmetric, at least in the length = 1 case.

Comment thread src/schema.rs
Comment on lines 328 to 340
if old_any_of != new_any_of {
self.schema_push_change(
dry_run,
"unhandled, 'anyOf' schema",
&old_schema_kind,
&new_schema_kind,
comparison,
ChangeClass::Unhandled,
ChangeDetails::UnknownDifference,
)
} else {
Ok(true)
}
Copy link
Copy Markdown
Contributor

@sunshowers sunshowers Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paging the context back in (was trying to figure out how I screwed up, haha)... I think this is theoretically buggy in the same way, though single-element anyOf is not idiomatic so we probably won't hit it in practice.

(let me know if these comments are unhelpful)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I realized that anyOf wasn't handled and I figured if it came up we might want to actually know about it. I could see it either way

@ahl ahl merged commit a091ec5 into main May 1, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants